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

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

Issue 1031673004: Caches the edge counter increment size in the isolate() (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 void FlowGraphCompiler::EmitEdgeCounter() { 1189 void FlowGraphCompiler::EmitEdgeCounter() {
1190 // We do not check for overflow when incrementing the edge counter. The 1190 // We do not check for overflow when incrementing the edge counter. The
1191 // function should normally be optimized long before the counter can 1191 // function should normally be optimized long before the counter can
1192 // overflow; and though we do not reset the counters when we optimize or 1192 // overflow; and though we do not reset the counters when we optimize or
1193 // deoptimize, there is a bound on the number of 1193 // deoptimize, there is a bound on the number of
1194 // optimization/deoptimization cycles we will attempt. 1194 // optimization/deoptimization cycles we will attempt.
1195 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); 1195 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
1196 counter.SetAt(0, Smi::Handle(Smi::New(0))); 1196 counter.SetAt(0, Smi::Handle(Smi::New(0)));
1197 __ Comment("Edge counter"); 1197 __ Comment("Edge counter");
1198 __ LoadObject(R0, counter); 1198 __ LoadObject(R0, counter);
1199 intptr_t increment_start = assembler_->CodeSize();
1199 #if defined(DEBUG) 1200 #if defined(DEBUG)
1200 intptr_t increment_start = assembler_->CodeSize();
1201 bool old_use_far_branches = assembler_->use_far_branches(); 1201 bool old_use_far_branches = assembler_->use_far_branches();
1202 assembler_->set_use_far_branches(true); 1202 assembler_->set_use_far_branches(true);
1203 #endif // DEBUG 1203 #endif // DEBUG
1204 __ ldr(IP, FieldAddress(R0, Array::element_offset(0))); 1204 __ ldr(IP, FieldAddress(R0, Array::element_offset(0)));
1205 __ add(IP, IP, Operand(Smi::RawValue(1))); 1205 __ add(IP, IP, Operand(Smi::RawValue(1)));
1206 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(0)), IP); 1206 __ StoreIntoSmiField(FieldAddress(R0, Array::element_offset(0)), IP);
1207 int32_t size = assembler_->CodeSize() - increment_start;
1208 if (isolate()->edge_counter_increment_size() == -1) {
1209 isolate()->set_edge_counter_increment_size(size);
1210 } else {
1211 ASSERT(size == isolate()->edge_counter_increment_size());
1212 }
1207 #if defined(DEBUG) 1213 #if defined(DEBUG)
1208 assembler_->set_use_far_branches(old_use_far_branches); 1214 assembler_->set_use_far_branches(old_use_far_branches);
1209 // If the assertion below fails, update EdgeCounterIncrementSizeInBytes.
1210 intptr_t expected = EdgeCounterIncrementSizeInBytes();
1211 intptr_t actual = assembler_->CodeSize() - increment_start;
1212 if (actual != expected) {
1213 FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n",
1214 actual,
1215 expected);
1216 }
1217 #endif // DEBUG 1215 #endif // DEBUG
1218 } 1216 }
1219 1217
1220 1218
1221 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() { 1219 int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() {
srdjan 2015/03/23 20:28:08 const
zra 2015/03/23 20:31:16 EdgeCounterIncrementSizeInBytes() is static.
1222 // Used by CodePatcher; so must be constant across all code in an isolate. 1220 const int32_t size = Isolate::Current()->edge_counter_increment_size();
1223 int32_t size = 3 * Instr::kInstrSize; 1221 ASSERT(size != -1);
1224 #if defined(DEBUG)
1225 if (TargetCPUFeatures::arm_version() == ARMv7) {
1226 size += 35 * Instr::kInstrSize;
1227 } else {
1228 // To update this number for e.g. ARMv6, run a SIMARM build with
1229 // --sim_use_armv6 on any Dart program.
1230 size += 51 * Instr::kInstrSize;
1231 }
1232 #endif // DEBUG
1233 if (VerifiedMemory::enabled()) {
1234 if (TargetCPUFeatures::arm_version() == ARMv7) {
1235 size += 20 * Instr::kInstrSize;
1236 } else {
1237 // To update this number for e.g. ARMv6, run a SIMARM build with
1238 // --sim_use_armv6 --verified_mem on any Dart program.
1239 size += 28 * Instr::kInstrSize;
1240 }
1241 }
1242 return size; 1222 return size;
1243 } 1223 }
1244 1224
1245 1225
1246 void FlowGraphCompiler::EmitOptimizedInstanceCall( 1226 void FlowGraphCompiler::EmitOptimizedInstanceCall(
1247 ExternalLabel* target_label, 1227 ExternalLabel* target_label,
1248 const ICData& ic_data, 1228 const ICData& ic_data,
1249 intptr_t argument_count, 1229 intptr_t argument_count,
1250 intptr_t deopt_id, 1230 intptr_t deopt_id,
1251 intptr_t token_pos, 1231 intptr_t token_pos,
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 DRegister dreg = EvenDRegisterOf(reg); 1880 DRegister dreg = EvenDRegisterOf(reg);
1901 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1881 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1902 } 1882 }
1903 1883
1904 1884
1905 #undef __ 1885 #undef __
1906 1886
1907 } // namespace dart 1887 } // namespace dart
1908 1888
1909 #endif // defined TARGET_ARCH_ARM 1889 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | runtime/vm/flow_graph_compiler_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698