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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 // deoptimize, there is a bound on the number of | 1228 // deoptimize, there is a bound on the number of |
1229 // optimization/deoptimization cycles we will attempt. | 1229 // optimization/deoptimization cycles we will attempt. |
1230 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1230 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
1231 counter.SetAt(0, Smi::Handle(Smi::New(0))); | 1231 counter.SetAt(0, Smi::Handle(Smi::New(0))); |
1232 __ Comment("Edge counter"); | 1232 __ Comment("Edge counter"); |
1233 __ LoadObject(EAX, counter); | 1233 __ LoadObject(EAX, counter); |
1234 #if defined(DEBUG) | 1234 #if defined(DEBUG) |
1235 intptr_t increment_start = assembler_->CodeSize(); | 1235 intptr_t increment_start = assembler_->CodeSize(); |
1236 #endif // DEBUG | 1236 #endif // DEBUG |
1237 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(0)), 1); | 1237 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(0)), 1); |
| 1238 #if defined(DEBUG) |
1238 // If the assertion below fails, update EdgeCounterIncrementSizeInBytes. | 1239 // If the assertion below fails, update EdgeCounterIncrementSizeInBytes. |
1239 DEBUG_ASSERT((assembler_->CodeSize() - increment_start) == | 1240 intptr_t expected = EdgeCounterIncrementSizeInBytes(); |
1240 EdgeCounterIncrementSizeInBytes()); | 1241 intptr_t actual = assembler_->CodeSize() - increment_start; |
| 1242 if (actual != expected) { |
| 1243 FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n", |
| 1244 actual, |
| 1245 expected); |
| 1246 } |
| 1247 #endif // DEBUG |
1241 } | 1248 } |
1242 | 1249 |
1243 | 1250 |
1244 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | 1251 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { |
1245 // Used by CodePatcher; so must be constant across all code in an isolate. | 1252 // Used by CodePatcher; so must be constant across all code in an isolate. |
1246 return VerifiedMemory::enabled() ? 50 : 4; | 1253 int32_t size = 4; |
| 1254 #if defined(DEBUG) |
| 1255 size += 19; // VerifySmi |
| 1256 #endif // DEBUG |
| 1257 if (VerifiedMemory::enabled()) { |
| 1258 size += 50; |
| 1259 } |
| 1260 return size; |
1247 } | 1261 } |
1248 | 1262 |
1249 | 1263 |
1250 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1264 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
1251 ExternalLabel* target_label, | 1265 ExternalLabel* target_label, |
1252 const ICData& ic_data, | 1266 const ICData& ic_data, |
1253 intptr_t argument_count, | 1267 intptr_t argument_count, |
1254 intptr_t deopt_id, | 1268 intptr_t deopt_id, |
1255 intptr_t token_pos, | 1269 intptr_t token_pos, |
1256 LocationSummary* locs) { | 1270 LocationSummary* locs) { |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 __ movups(reg, Address(ESP, 0)); | 1851 __ movups(reg, Address(ESP, 0)); |
1838 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1852 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1839 } | 1853 } |
1840 | 1854 |
1841 | 1855 |
1842 #undef __ | 1856 #undef __ |
1843 | 1857 |
1844 } // namespace dart | 1858 } // namespace dart |
1845 | 1859 |
1846 #endif // defined TARGET_ARCH_IA32 | 1860 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |