| 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" |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 // optimization/deoptimization cycles we will attempt. | 1264 // optimization/deoptimization cycles we will attempt. |
| 1265 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1265 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
| 1266 counter.SetAt(0, Smi::Handle(Smi::New(0))); | 1266 counter.SetAt(0, Smi::Handle(Smi::New(0))); |
| 1267 __ Comment("Edge counter"); | 1267 __ Comment("Edge counter"); |
| 1268 __ LoadObject(RAX, counter, PP); | 1268 __ LoadObject(RAX, counter, PP); |
| 1269 #if defined(DEBUG) | 1269 #if defined(DEBUG) |
| 1270 intptr_t increment_start = assembler_->CodeSize(); | 1270 intptr_t increment_start = assembler_->CodeSize(); |
| 1271 #endif // DEBUG | 1271 #endif // DEBUG |
| 1272 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1); | 1272 __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1); |
| 1273 #if defined(DEBUG) | 1273 #if defined(DEBUG) |
| 1274 // If the assertion below fails, update EdgeCounterIncrementSizeInBytes. |
| 1274 intptr_t expected = EdgeCounterIncrementSizeInBytes(); | 1275 intptr_t expected = EdgeCounterIncrementSizeInBytes(); |
| 1275 intptr_t actual = assembler_->CodeSize() - increment_start; | 1276 intptr_t actual = assembler_->CodeSize() - increment_start; |
| 1276 if (actual != expected) { | 1277 if (actual != expected) { |
| 1277 FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n", | 1278 FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n", |
| 1278 actual, | 1279 actual, |
| 1279 expected); | 1280 expected); |
| 1280 } | 1281 } |
| 1281 #endif // DEBUG | 1282 #endif // DEBUG |
| 1282 } | 1283 } |
| 1283 | 1284 |
| 1284 | 1285 |
| 1285 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | 1286 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { |
| 1287 // Used by CodePatcher; so must be constant across all code in an isolate. |
| 1286 return VerifiedMemory::enabled() ? 73 : 5; | 1288 return VerifiedMemory::enabled() ? 73 : 5; |
| 1287 } | 1289 } |
| 1288 | 1290 |
| 1289 | 1291 |
| 1290 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1292 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1291 ExternalLabel* target_label, | 1293 ExternalLabel* target_label, |
| 1292 const ICData& ic_data, | 1294 const ICData& ic_data, |
| 1293 intptr_t argument_count, | 1295 intptr_t argument_count, |
| 1294 intptr_t deopt_id, | 1296 intptr_t deopt_id, |
| 1295 intptr_t token_pos, | 1297 intptr_t token_pos, |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 __ movups(reg, Address(RSP, 0)); | 1786 __ movups(reg, Address(RSP, 0)); |
| 1785 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1787 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1786 } | 1788 } |
| 1787 | 1789 |
| 1788 | 1790 |
| 1789 #undef __ | 1791 #undef __ |
| 1790 | 1792 |
| 1791 } // namespace dart | 1793 } // namespace dart |
| 1792 | 1794 |
| 1793 #endif // defined TARGET_ARCH_X64 | 1795 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |