Chromium Code Reviews| 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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1226 void FlowGraphCompiler::EmitEdgeCounter() { | 1226 void FlowGraphCompiler::EmitEdgeCounter() { |
| 1227 // We do not check for overflow when incrementing the edge counter. The | 1227 // We do not check for overflow when incrementing the edge counter. The |
| 1228 // function should normally be optimized long before the counter can | 1228 // function should normally be optimized long before the counter can |
| 1229 // overflow; and though we do not reset the counters when we optimize or | 1229 // overflow; and though we do not reset the counters when we optimize or |
| 1230 // deoptimize, there is a bound on the number of | 1230 // deoptimize, there is a bound on the number of |
| 1231 // optimization/deoptimization cycles we will attempt. | 1231 // optimization/deoptimization cycles we will attempt. |
| 1232 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | 1232 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
| 1233 counter.SetAt(0, Smi::Handle(Smi::New(0))); | 1233 counter.SetAt(0, Smi::Handle(Smi::New(0))); |
| 1234 __ Comment("Edge counter"); | 1234 __ Comment("Edge counter"); |
| 1235 __ LoadObject(EAX, counter); | 1235 __ LoadObject(EAX, counter); |
| 1236 #if defined(DEBUG) | |
| 1237 intptr_t increment_start = assembler_->CodeSize(); | 1236 intptr_t increment_start = assembler_->CodeSize(); |
| 1238 #endif // DEBUG | |
| 1239 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(0)), 1); | 1237 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(0)), 1); |
| 1240 #if defined(DEBUG) | 1238 int32_t size = assembler_->CodeSize() - increment_start; |
| 1241 // If the assertion below fails, update EdgeCounterIncrementSizeInBytes. | 1239 if (isolate()->edge_counter_increment_size() == -1) { |
| 1242 intptr_t expected = EdgeCounterIncrementSizeInBytes(); | 1240 isolate()->set_edge_counter_increment_size(size); |
| 1243 intptr_t actual = assembler_->CodeSize() - increment_start; | 1241 } else { |
| 1244 if (actual != expected) { | 1242 ASSERT(size == isolate()->edge_counter_increment_size()); |
| 1245 FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n", | |
| 1246 actual, | |
| 1247 expected); | |
| 1248 } | 1243 } |
| 1249 #endif // DEBUG | |
| 1250 } | 1244 } |
| 1251 | 1245 |
| 1252 | 1246 |
| 1253 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { | 1247 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { |
|
Ivan Posva
2015/03/24 02:54:13
This function should now move to flow_graph_compil
| |
| 1254 // Used by CodePatcher; so must be constant across all code in an isolate. | 1248 const int32_t size = Isolate::Current()->edge_counter_increment_size(); |
| 1255 int32_t size = 4; | 1249 ASSERT(size != -1); |
| 1256 #if defined(DEBUG) | |
| 1257 size += 19; // VerifySmi | |
| 1258 #endif // DEBUG | |
| 1259 if (VerifiedMemory::enabled()) { | |
| 1260 size += 50; | |
| 1261 } | |
| 1262 return size; | 1250 return size; |
| 1263 } | 1251 } |
| 1264 | 1252 |
| 1265 | 1253 |
| 1266 void FlowGraphCompiler::EmitOptimizedInstanceCall( | 1254 void FlowGraphCompiler::EmitOptimizedInstanceCall( |
| 1267 ExternalLabel* target_label, | 1255 ExternalLabel* target_label, |
| 1268 const ICData& ic_data, | 1256 const ICData& ic_data, |
| 1269 intptr_t argument_count, | 1257 intptr_t argument_count, |
| 1270 intptr_t deopt_id, | 1258 intptr_t deopt_id, |
| 1271 intptr_t token_pos, | 1259 intptr_t token_pos, |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1853 __ movups(reg, Address(ESP, 0)); | 1841 __ movups(reg, Address(ESP, 0)); |
| 1854 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1842 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1855 } | 1843 } |
| 1856 | 1844 |
| 1857 | 1845 |
| 1858 #undef __ | 1846 #undef __ |
| 1859 | 1847 |
| 1860 } // namespace dart | 1848 } // namespace dart |
| 1861 | 1849 |
| 1862 #endif // defined TARGET_ARCH_IA32 | 1850 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |