OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
13 #include "vm/heap.h" | 13 #include "vm/heap.h" |
14 #include "vm/instructions.h" | 14 #include "vm/instructions.h" |
15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
16 #include "vm/stack_frame.h" | 16 #include "vm/stack_frame.h" |
17 #include "vm/stub_code.h" | 17 #include "vm/stub_code.h" |
18 #include "vm/tags.h" | 18 #include "vm/tags.h" |
19 | 19 |
20 #define __ assembler-> | 20 #define __ assembler-> |
21 | 21 |
22 namespace dart { | 22 namespace dart { |
23 | 23 |
24 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); | 24 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); |
25 DEFINE_FLAG(bool, use_slow_path, false, | 25 DEFINE_FLAG(bool, use_slow_path, false, |
26 "Set to true for debugging & verifying the slow paths."); | 26 "Set to true for debugging & verifying the slow paths."); |
27 DECLARE_FLAG(bool, trace_optimized_ic_calls); | 27 DECLARE_FLAG(bool, trace_optimized_ic_calls); |
28 | 28 |
| 29 DECLARE_FLAG(bool, enable_debugger); |
| 30 |
29 // Input parameters: | 31 // Input parameters: |
30 // LR : return address. | 32 // LR : return address. |
31 // SP : address of last argument in argument array. | 33 // SP : address of last argument in argument array. |
32 // SP + 8*R4 - 8 : address of first argument in argument array. | 34 // SP + 8*R4 - 8 : address of first argument in argument array. |
33 // SP + 8*R4 : address of return value. | 35 // SP + 8*R4 : address of return value. |
34 // R5 : address of the runtime function to call. | 36 // R5 : address of the runtime function to call. |
35 // R4 : number of arguments to the call. | 37 // R4 : number of arguments to the call. |
36 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 38 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
37 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 39 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
38 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 40 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 kNoPP, kUnsignedWord); | 1305 kNoPP, kUnsignedWord); |
1304 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. | 1306 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. |
1305 __ andi(R6, R6, ICData::NumArgsTestedMask()); | 1307 __ andi(R6, R6, ICData::NumArgsTestedMask()); |
1306 __ CompareImmediate(R6, num_args, kNoPP); | 1308 __ CompareImmediate(R6, num_args, kNoPP); |
1307 __ b(&ok, EQ); | 1309 __ b(&ok, EQ); |
1308 __ Stop("Incorrect stub for IC data"); | 1310 __ Stop("Incorrect stub for IC data"); |
1309 __ Bind(&ok); | 1311 __ Bind(&ok); |
1310 } | 1312 } |
1311 #endif // DEBUG | 1313 #endif // DEBUG |
1312 | 1314 |
1313 // Check single stepping. | 1315 if (FLAG_enable_debugger) { |
1314 Label not_stepping; | 1316 // Check single stepping. |
1315 __ LoadFieldFromOffset(R6, CTX, Context::isolate_offset(), kNoPP); | 1317 Label not_stepping; |
1316 __ LoadFromOffset( | 1318 __ LoadFieldFromOffset(R6, CTX, Context::isolate_offset(), kNoPP); |
1317 R6, R6, Isolate::single_step_offset(), kNoPP, kUnsignedByte); | 1319 __ LoadFromOffset( |
1318 __ CompareRegisters(R6, ZR); | 1320 R6, R6, Isolate::single_step_offset(), kNoPP, kUnsignedByte); |
1319 __ b(¬_stepping, EQ); | 1321 __ CompareRegisters(R6, ZR); |
1320 __ EnterStubFrame(); | 1322 __ b(¬_stepping, EQ); |
1321 __ Push(R5); // Preserve IC data. | 1323 __ EnterStubFrame(); |
1322 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1324 __ Push(R5); // Preserve IC data. |
1323 __ Pop(R5); | 1325 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
1324 __ LeaveStubFrame(); | 1326 __ Pop(R5); |
1325 __ Bind(¬_stepping); | 1327 __ LeaveStubFrame(); |
| 1328 __ Bind(¬_stepping); |
| 1329 } |
1326 | 1330 |
1327 // Load arguments descriptor into R4. | 1331 // Load arguments descriptor into R4. |
1328 __ LoadFieldFromOffset(R4, R5, ICData::arguments_descriptor_offset(), kNoPP); | 1332 __ LoadFieldFromOffset(R4, R5, ICData::arguments_descriptor_offset(), kNoPP); |
1329 // Loop that checks if there is an IC data match. | 1333 // Loop that checks if there is an IC data match. |
1330 Label loop, update, test, found, get_class_id_as_smi; | 1334 Label loop, update, test, found, get_class_id_as_smi; |
1331 // R5: IC data object (preserved). | 1335 // R5: IC data object (preserved). |
1332 __ LoadFieldFromOffset(R6, R5, ICData::ic_data_offset(), kNoPP); | 1336 __ LoadFieldFromOffset(R6, R5, ICData::ic_data_offset(), kNoPP); |
1333 // R6: ic_data_array with check entries: classes and target functions. | 1337 // R6: ic_data_array with check entries: classes and target functions. |
1334 __ AddImmediate(R6, R6, Array::data_offset() - kHeapObjectTag, kNoPP); | 1338 __ AddImmediate(R6, R6, Array::data_offset() - kHeapObjectTag, kNoPP); |
1335 // R6: points directly to the first ic data array element. | 1339 // R6: points directly to the first ic data array element. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 const Register right = R0; | 1918 const Register right = R0; |
1915 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 1919 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
1916 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 1920 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
1917 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1921 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
1918 __ ret(); | 1922 __ ret(); |
1919 } | 1923 } |
1920 | 1924 |
1921 } // namespace dart | 1925 } // namespace dart |
1922 | 1926 |
1923 #endif // defined TARGET_ARCH_ARM64 | 1927 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |