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_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
11 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
12 #include "vm/heap.h" | 12 #include "vm/heap.h" |
13 #include "vm/instructions.h" | 13 #include "vm/instructions.h" |
14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
15 #include "vm/resolver.h" | 15 #include "vm/resolver.h" |
16 #include "vm/scavenger.h" | 16 #include "vm/scavenger.h" |
17 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
19 #include "vm/tags.h" | 19 #include "vm/tags.h" |
20 | 20 |
21 #define __ assembler-> | 21 #define __ assembler-> |
22 | 22 |
23 namespace dart { | 23 namespace dart { |
24 | 24 |
25 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); | 25 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); |
26 DEFINE_FLAG(bool, use_slow_path, false, | 26 DEFINE_FLAG(bool, use_slow_path, false, |
27 "Set to true for debugging & verifying the slow paths."); | 27 "Set to true for debugging & verifying the slow paths."); |
28 DECLARE_FLAG(bool, trace_optimized_ic_calls); | 28 DECLARE_FLAG(bool, trace_optimized_ic_calls); |
29 | 29 |
| 30 DECLARE_FLAG(bool, enable_debugger); |
30 | 31 |
31 // Input parameters: | 32 // Input parameters: |
32 // RSP : points to return address. | 33 // RSP : points to return address. |
33 // RSP + 8 : address of last argument in argument array. | 34 // RSP + 8 : address of last argument in argument array. |
34 // RSP + 8*R10 : address of first argument in argument array. | 35 // RSP + 8*R10 : address of first argument in argument array. |
35 // RSP + 8*R10 + 8 : address of return value. | 36 // RSP + 8*R10 + 8 : address of return value. |
36 // RBX : address of the runtime function to call. | 37 // RBX : address of the runtime function to call. |
37 // R10 : number of arguments to the call. | 38 // R10 : number of arguments to the call. |
38 // Must preserve callee saved registers R12 and R13. | 39 // Must preserve callee saved registers R12 and R13. |
39 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 40 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 __ movl(RCX, FieldAddress(RBX, ICData::state_bits_offset())); | 1224 __ movl(RCX, FieldAddress(RBX, ICData::state_bits_offset())); |
1224 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. | 1225 ASSERT(ICData::NumArgsTestedShift() == 0); // No shift needed. |
1225 __ andq(RCX, Immediate(ICData::NumArgsTestedMask())); | 1226 __ andq(RCX, Immediate(ICData::NumArgsTestedMask())); |
1226 __ cmpq(RCX, Immediate(num_args)); | 1227 __ cmpq(RCX, Immediate(num_args)); |
1227 __ j(EQUAL, &ok, Assembler::kNearJump); | 1228 __ j(EQUAL, &ok, Assembler::kNearJump); |
1228 __ Stop("Incorrect stub for IC data"); | 1229 __ Stop("Incorrect stub for IC data"); |
1229 __ Bind(&ok); | 1230 __ Bind(&ok); |
1230 } | 1231 } |
1231 #endif // DEBUG | 1232 #endif // DEBUG |
1232 | 1233 |
1233 // Check single stepping. | 1234 if (FLAG_enable_debugger) { |
1234 Label not_stepping; | 1235 // Check single stepping. |
1235 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); | 1236 Label not_stepping; |
1236 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); | 1237 __ movq(RAX, FieldAddress(CTX, Context::isolate_offset())); |
1237 __ cmpq(RAX, Immediate(0)); | 1238 __ movzxb(RAX, Address(RAX, Isolate::single_step_offset())); |
1238 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); | 1239 __ cmpq(RAX, Immediate(0)); |
1239 __ EnterStubFrame(); | 1240 __ j(EQUAL, ¬_stepping, Assembler::kNearJump); |
1240 __ pushq(RBX); | 1241 __ EnterStubFrame(); |
1241 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1242 __ pushq(RBX); |
1242 __ popq(RBX); | 1243 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
1243 __ LeaveStubFrame(); | 1244 __ popq(RBX); |
1244 __ Bind(¬_stepping); | 1245 __ LeaveStubFrame(); |
| 1246 __ Bind(¬_stepping); |
| 1247 } |
1245 | 1248 |
1246 // Load arguments descriptor into R10. | 1249 // Load arguments descriptor into R10. |
1247 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); | 1250 __ movq(R10, FieldAddress(RBX, ICData::arguments_descriptor_offset())); |
1248 // Loop that checks if there is an IC data match. | 1251 // Loop that checks if there is an IC data match. |
1249 Label loop, update, test, found, get_class_id_as_smi; | 1252 Label loop, update, test, found, get_class_id_as_smi; |
1250 // RBX: IC data object (preserved). | 1253 // RBX: IC data object (preserved). |
1251 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); | 1254 __ movq(R12, FieldAddress(RBX, ICData::ic_data_offset())); |
1252 // R12: ic_data_array with check entries: classes and target functions. | 1255 // R12: ic_data_array with check entries: classes and target functions. |
1253 __ leaq(R12, FieldAddress(R12, Array::data_offset())); | 1256 __ leaq(R12, FieldAddress(R12, Array::data_offset())); |
1254 // R12: points directly to the first ic data array element. | 1257 // R12: points directly to the first ic data array element. |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 | 1823 |
1821 __ movq(left, Address(RSP, 2 * kWordSize)); | 1824 __ movq(left, Address(RSP, 2 * kWordSize)); |
1822 __ movq(right, Address(RSP, 1 * kWordSize)); | 1825 __ movq(right, Address(RSP, 1 * kWordSize)); |
1823 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 1826 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
1824 __ ret(); | 1827 __ ret(); |
1825 } | 1828 } |
1826 | 1829 |
1827 } // namespace dart | 1830 } // namespace dart |
1828 | 1831 |
1829 #endif // defined TARGET_ARCH_X64 | 1832 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |