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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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/dart_entry.h" | 12 #include "vm/dart_entry.h" |
13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
14 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
15 #include "vm/locations.h" | 15 #include "vm/locations.h" |
16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
17 #include "vm/parser.h" | 17 #include "vm/parser.h" |
18 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| 21 #include "vm/verified_memory.h" |
21 | 22 |
22 namespace dart { | 23 namespace dart { |
23 | 24 |
24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
25 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 26 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
26 DECLARE_FLAG(bool, enable_type_checks); | 27 DECLARE_FLAG(bool, enable_type_checks); |
27 DECLARE_FLAG(bool, enable_simd_inline); | 28 DECLARE_FLAG(bool, enable_simd_inline); |
28 | 29 |
29 | 30 |
30 FlowGraphCompiler::~FlowGraphCompiler() { | 31 FlowGraphCompiler::~FlowGraphCompiler() { |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 void FlowGraphCompiler::EmitEdgeCounter() { | 1259 void FlowGraphCompiler::EmitEdgeCounter() { |
1259 // We do not check for overflow when incrementing the edge counter. The | 1260 // We do not check for overflow when incrementing the edge counter. The |
1260 // function should normally be optimized long before the counter can | 1261 // function should normally be optimized long before the counter can |
1261 // overflow; and though we do not reset the counters when we optimize or | 1262 // overflow; and though we do not reset the counters when we optimize or |
1262 // deoptimize, there is a bound on the number of | 1263 // deoptimize, there is a bound on the number of |
1263 // optimization/deoptimization cycles we will attempt. | 1264 // optimization/deoptimization cycles we will attempt. |
1264 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1265 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
1265 counter.SetAt(0, Smi::Handle(Smi::New(0))); | 1266 counter.SetAt(0, Smi::Handle(Smi::New(0))); |
1266 __ Comment("Edge counter"); | 1267 __ Comment("Edge counter"); |
1267 __ LoadObject(RAX, counter, PP); | 1268 __ LoadObject(RAX, counter, PP); |
1268 __ AddImmediate(FieldAddress(RAX, Array::element_offset(0)), | 1269 #if defined(DEBUG) |
1269 Immediate(Smi::RawValue(1)), PP); | 1270 intptr_t increment_start = assembler_->CodeSize(); |
| 1271 #endif // DEBUG |
| 1272 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1); |
| 1273 DEBUG_ASSERT((assembler_->CodeSize() - increment_start) == |
| 1274 EdgeCounterIncrementSizeInBytes()); |
| 1275 } |
| 1276 |
| 1277 |
| 1278 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { |
| 1279 return VerifiedMemory::enabled() ? 70 : 5; |
1270 } | 1280 } |
1271 | 1281 |
1272 | 1282 |
1273 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1283 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1274 ExternalLabel* target_label, | 1284 ExternalLabel* target_label, |
1275 const ICData& ic_data, | 1285 const ICData& ic_data, |
1276 intptr_t argument_count, | 1286 intptr_t argument_count, |
1277 intptr_t deopt_id, | 1287 intptr_t deopt_id, |
1278 intptr_t token_pos, | 1288 intptr_t token_pos, |
1279 LocationSummary* locs) { | 1289 LocationSummary* locs) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 __ movups(reg, Address(RSP, 0)); | 1777 __ movups(reg, Address(RSP, 0)); |
1768 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1778 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
1769 } | 1779 } |
1770 | 1780 |
1771 | 1781 |
1772 #undef __ | 1782 #undef __ |
1773 | 1783 |
1774 } // namespace dart | 1784 } // namespace dart |
1775 | 1785 |
1776 #endif // defined TARGET_ARCH_X64 | 1786 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |