Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 1343383003: VM: Store edge counters in one per-function array. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: clean up comments, save space in IL Instruction class. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 __ LoadObject(ECX, ic_data); 1213 __ LoadObject(ECX, ic_data);
1214 GenerateDartCall(deopt_id, 1214 GenerateDartCall(deopt_id,
1215 token_pos, 1215 token_pos,
1216 stub_entry, 1216 stub_entry,
1217 RawPcDescriptors::kUnoptStaticCall, 1217 RawPcDescriptors::kUnoptStaticCall,
1218 locs); 1218 locs);
1219 __ Drop(argument_count); 1219 __ Drop(argument_count);
1220 } 1220 }
1221 1221
1222 1222
1223 void FlowGraphCompiler::EmitEdgeCounter() { 1223 void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) {
1224 // We do not check for overflow when incrementing the edge counter. The 1224 // We do not check for overflow when incrementing the edge counter. The
1225 // function should normally be optimized long before the counter can 1225 // function should normally be optimized long before the counter can
1226 // overflow; and though we do not reset the counters when we optimize or 1226 // overflow; and though we do not reset the counters when we optimize or
1227 // deoptimize, there is a bound on the number of 1227 // deoptimize, there is a bound on the number of
1228 // optimization/deoptimization cycles we will attempt. 1228 // optimization/deoptimization cycles we will attempt.
1229 const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld)); 1229 ASSERT(!edge_counters_array_.IsNull());
1230 counter.SetAt(0, Smi::Handle(zone(), Smi::New(0)));
1231 __ Comment("Edge counter"); 1230 __ Comment("Edge counter");
1232 __ LoadObject(EAX, counter); 1231 __ LoadObject(EAX, edge_counters_array_);
1233 intptr_t increment_start = assembler_->CodeSize(); 1232 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(edge_id)), 1);
1234 __ IncrementSmiField(FieldAddress(EAX, Array::element_offset(0)), 1);
1235 int32_t size = assembler_->CodeSize() - increment_start;
1236 if (isolate()->edge_counter_increment_size() == -1) {
1237 isolate()->set_edge_counter_increment_size(size);
1238 } else {
1239 ASSERT(size == isolate()->edge_counter_increment_size());
1240 }
1241 } 1233 }
1242 1234
1243 1235
1244 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() {
1245 const int32_t size = Isolate::Current()->edge_counter_increment_size();
1246 ASSERT(size != -1);
1247 return size;
1248 }
1249
1250
1251 void FlowGraphCompiler::EmitOptimizedInstanceCall( 1236 void FlowGraphCompiler::EmitOptimizedInstanceCall(
1252 const StubEntry& stub_entry, 1237 const StubEntry& stub_entry,
1253 const ICData& ic_data, 1238 const ICData& ic_data,
1254 intptr_t argument_count, 1239 intptr_t argument_count,
1255 intptr_t deopt_id, 1240 intptr_t deopt_id,
1256 intptr_t token_pos, 1241 intptr_t token_pos,
1257 LocationSummary* locs) { 1242 LocationSummary* locs) {
1258 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); 1243 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
1259 // Each ICData propagated from unoptimized to optimized code contains the 1244 // Each ICData propagated from unoptimized to optimized code contains the
1260 // function that corresponds to the Dart function of that IC call. Due 1245 // function that corresponds to the Dart function of that IC call. Due
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 __ movups(reg, Address(ESP, 0)); 1832 __ movups(reg, Address(ESP, 0));
1848 __ addl(ESP, Immediate(kFpuRegisterSize)); 1833 __ addl(ESP, Immediate(kFpuRegisterSize));
1849 } 1834 }
1850 1835
1851 1836
1852 #undef __ 1837 #undef __
1853 1838
1854 } // namespace dart 1839 } // namespace dart
1855 1840
1856 #endif // defined TARGET_ARCH_IA32 1841 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698