| 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" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 __ EnterStubFrame(); | 1327 __ EnterStubFrame(); |
| 1328 __ PushList((1 << R5) | (1 << R6)); // Preserve. | 1328 __ PushList((1 << R5) | (1 << R6)); // Preserve. |
| 1329 __ Push(ic_reg); // Argument. | 1329 __ Push(ic_reg); // Argument. |
| 1330 __ Push(func_reg); // Argument. | 1330 __ Push(func_reg); // Argument. |
| 1331 __ CallRuntime(kTraceICCallRuntimeEntry); | 1331 __ CallRuntime(kTraceICCallRuntimeEntry); |
| 1332 __ Drop(2); // Discard argument; | 1332 __ Drop(2); // Discard argument; |
| 1333 __ PopList((1 << R5) | (1 << R6)); // Restore. | 1333 __ PopList((1 << R5) | (1 << R6)); // Restore. |
| 1334 __ LeaveStubFrame(); | 1334 __ LeaveStubFrame(); |
| 1335 } | 1335 } |
| 1336 __ ldr(R7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1336 __ ldr(R7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1337 Label is_hot; | |
| 1338 if (FlowGraphCompiler::CanOptimize()) { | |
| 1339 ASSERT(FLAG_optimization_counter_threshold > 1); | |
| 1340 __ CompareImmediate(R7, FLAG_optimization_counter_threshold); | |
| 1341 __ b(&is_hot, GE); | |
| 1342 // As long as VM has no OSR do not optimize in the middle of the function | |
| 1343 // but only at exit so that we have collected all type feedback before | |
| 1344 // optimizing. | |
| 1345 } | |
| 1346 __ add(R7, R7, ShifterOperand(1)); | 1337 __ add(R7, R7, ShifterOperand(1)); |
| 1347 __ str(R7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1338 __ str(R7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1348 __ Bind(&is_hot); | |
| 1349 } | 1339 } |
| 1350 | 1340 |
| 1351 | 1341 |
| 1352 // Loads function into 'temp_reg'. | 1342 // Loads function into 'temp_reg'. |
| 1353 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, | 1343 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, |
| 1354 Register temp_reg) { | 1344 Register temp_reg) { |
| 1355 Register ic_reg = R5; | 1345 Register ic_reg = R5; |
| 1356 Register func_reg = temp_reg; | 1346 Register func_reg = temp_reg; |
| 1357 ASSERT(temp_reg == R6); | 1347 ASSERT(temp_reg == R6); |
| 1358 __ ldr(func_reg, FieldAddress(ic_reg, ICData::function_offset())); | 1348 __ ldr(func_reg, FieldAddress(ic_reg, ICData::function_offset())); |
| 1359 __ ldr(R7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1349 __ ldr(R7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1360 Label is_hot; | |
| 1361 if (FlowGraphCompiler::CanOptimize()) { | |
| 1362 ASSERT(FLAG_optimization_counter_threshold > 1); | |
| 1363 // The usage_counter is always less than FLAG_optimization_counter_threshold | |
| 1364 // except when the function gets optimized. | |
| 1365 __ CompareImmediate(R7, FLAG_optimization_counter_threshold); | |
| 1366 __ b(&is_hot, EQ); | |
| 1367 // As long as VM has no OSR do not optimize in the middle of the function | |
| 1368 // but only at exit so that we have collected all type feedback before | |
| 1369 // optimizing. | |
| 1370 } | |
| 1371 __ add(R7, R7, ShifterOperand(1)); | 1350 __ add(R7, R7, ShifterOperand(1)); |
| 1372 __ str(R7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1351 __ str(R7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1373 __ Bind(&is_hot); | |
| 1374 } | 1352 } |
| 1375 | 1353 |
| 1376 | 1354 |
| 1377 // Generate inline cache check for 'num_args'. | 1355 // Generate inline cache check for 'num_args'. |
| 1378 // LR: return address. | 1356 // LR: return address. |
| 1379 // R5: inline cache data object. | 1357 // R5: inline cache data object. |
| 1380 // Control flow: | 1358 // Control flow: |
| 1381 // - If receiver is null -> jump to IC miss. | 1359 // - If receiver is null -> jump to IC miss. |
| 1382 // - If receiver is Smi -> load Smi class. | 1360 // - If receiver is Smi -> load Smi class. |
| 1383 // - If receiver is not-Smi -> load receiver's class. | 1361 // - If receiver is not-Smi -> load receiver's class. |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2113 __ ldr(left, Address(SP, 4 * kWordSize)); | 2091 __ ldr(left, Address(SP, 4 * kWordSize)); |
| 2114 __ ldr(right, Address(SP, 3 * kWordSize)); | 2092 __ ldr(right, Address(SP, 3 * kWordSize)); |
| 2115 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2093 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2116 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2094 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
| 2117 __ Ret(); | 2095 __ Ret(); |
| 2118 } | 2096 } |
| 2119 | 2097 |
| 2120 } // namespace dart | 2098 } // namespace dart |
| 2121 | 2099 |
| 2122 #endif // defined TARGET_ARCH_ARM | 2100 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |