| 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #define __ assembler-> | 22 #define __ assembler-> |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); | 26 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); |
| 27 DEFINE_FLAG(bool, use_slow_path, false, | 27 DEFINE_FLAG(bool, use_slow_path, false, |
| 28 "Set to true for debugging & verifying the slow paths."); | 28 "Set to true for debugging & verifying the slow paths."); |
| 29 DECLARE_FLAG(bool, trace_optimized_ic_calls); | 29 DECLARE_FLAG(bool, trace_optimized_ic_calls); |
| 30 DEFINE_FLAG(bool, verify_incoming_contexts, false, ""); | 30 DEFINE_FLAG(bool, verify_incoming_contexts, false, ""); |
| 31 | 31 |
| 32 #define INT32_SIZEOF(x) static_cast<int32_t>(sizeof(x)) |
| 33 |
| 32 // Input parameters: | 34 // Input parameters: |
| 33 // ESP : points to return address. | 35 // ESP : points to return address. |
| 34 // ESP + 4 : address of last argument in argument array. | 36 // ESP + 4 : address of last argument in argument array. |
| 35 // ESP + 4*EDX : address of first argument in argument array. | 37 // ESP + 4*EDX : address of first argument in argument array. |
| 36 // ESP + 4*EDX + 4 : address of return value. | 38 // ESP + 4*EDX + 4 : address of return value. |
| 37 // ECX : address of the runtime function to call. | 39 // ECX : address of the runtime function to call. |
| 38 // EDX : number of arguments to the call. | 40 // EDX : number of arguments to the call. |
| 39 // Must preserve callee saved registers EDI and EBX. | 41 // Must preserve callee saved registers EDI and EBX. |
| 40 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
| 41 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 __ j(EQUAL, &ok, Assembler::kNearJump); | 81 __ j(EQUAL, &ok, Assembler::kNearJump); |
| 80 __ Stop("Not coming from Dart code."); | 82 __ Stop("Not coming from Dart code."); |
| 81 __ Bind(&ok); | 83 __ Bind(&ok); |
| 82 } | 84 } |
| 83 #endif | 85 #endif |
| 84 | 86 |
| 85 // Mark that the isolate is executing VM code. | 87 // Mark that the isolate is executing VM code. |
| 86 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); | 88 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); |
| 87 | 89 |
| 88 // Reserve space for arguments and align frame before entering C++ world. | 90 // Reserve space for arguments and align frame before entering C++ world. |
| 89 __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments))); | 91 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments))); |
| 90 if (OS::ActivationFrameAlignment() > 1) { | 92 if (OS::ActivationFrameAlignment() > 1) { |
| 91 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 93 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 92 } | 94 } |
| 93 | 95 |
| 94 // Pass NativeArguments structure by value and call runtime. | 96 // Pass NativeArguments structure by value and call runtime. |
| 95 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. | 97 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| 96 // There are no runtime calls to closures, so we do not need to set the tag | 98 // There are no runtime calls to closures, so we do not need to set the tag |
| 97 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 99 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 98 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 100 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
| 99 __ leal(EAX, Address(EBP, EDX, TIMES_4, 1 * kWordSize)); // Compute argv. | 101 __ leal(EAX, Address(EBP, EDX, TIMES_4, 1 * kWordSize)); // Compute argv. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 __ Bind(&ok); | 205 __ Bind(&ok); |
| 204 } | 206 } |
| 205 #endif | 207 #endif |
| 206 | 208 |
| 207 // Mark that the isolate is executing Native code. | 209 // Mark that the isolate is executing Native code. |
| 208 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); | 210 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); |
| 209 | 211 |
| 210 // Reserve space for the native arguments structure, the outgoing parameters | 212 // Reserve space for the native arguments structure, the outgoing parameters |
| 211 // (pointer to the native arguments structure, the C function entry point) | 213 // (pointer to the native arguments structure, the C function entry point) |
| 212 // and align frame before entering the C++ world. | 214 // and align frame before entering the C++ world. |
| 213 __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments) - (2 * kWordSize))); | 215 __ AddImmediate(ESP, |
| 216 Immediate(-INT32_SIZEOF(NativeArguments) - (2 * kWordSize))); |
| 214 if (OS::ActivationFrameAlignment() > 1) { | 217 if (OS::ActivationFrameAlignment() > 1) { |
| 215 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 218 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 216 } | 219 } |
| 217 | 220 |
| 218 // Pass NativeArguments structure by value and call native function. | 221 // Pass NativeArguments structure by value and call native function. |
| 219 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. | 222 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| 220 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 223 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
| 221 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | 224 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
| 222 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. | 225 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
| 223 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. | 226 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 __ Bind(&ok); | 310 __ Bind(&ok); |
| 308 } | 311 } |
| 309 #endif | 312 #endif |
| 310 | 313 |
| 311 // Mark that the isolate is executing Native code. | 314 // Mark that the isolate is executing Native code. |
| 312 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); | 315 __ movl(Address(CTX, Isolate::vm_tag_offset()), ECX); |
| 313 | 316 |
| 314 // Reserve space for the native arguments structure, the outgoing parameter | 317 // Reserve space for the native arguments structure, the outgoing parameter |
| 315 // (pointer to the native arguments structure) and align frame before | 318 // (pointer to the native arguments structure) and align frame before |
| 316 // entering the C++ world. | 319 // entering the C++ world. |
| 317 __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments) - kWordSize)); | 320 __ AddImmediate(ESP, Immediate(-INT32_SIZEOF(NativeArguments) - kWordSize)); |
| 318 if (OS::ActivationFrameAlignment() > 1) { | 321 if (OS::ActivationFrameAlignment() > 1) { |
| 319 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 322 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 320 } | 323 } |
| 321 | 324 |
| 322 // Pass NativeArguments structure by value and call native function. | 325 // Pass NativeArguments structure by value and call native function. |
| 323 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. | 326 __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs. |
| 324 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. | 327 __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments. |
| 325 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | 328 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. |
| 326 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. | 329 __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr. |
| 327 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. | 330 __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments. |
| (...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 const Register temp = ECX; | 2085 const Register temp = ECX; |
| 2083 __ movl(left, Address(ESP, 2 * kWordSize)); | 2086 __ movl(left, Address(ESP, 2 * kWordSize)); |
| 2084 __ movl(right, Address(ESP, 1 * kWordSize)); | 2087 __ movl(right, Address(ESP, 1 * kWordSize)); |
| 2085 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2088 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2086 __ ret(); | 2089 __ ret(); |
| 2087 } | 2090 } |
| 2088 | 2091 |
| 2089 } // namespace dart | 2092 } // namespace dart |
| 2090 | 2093 |
| 2091 #endif // defined TARGET_ARCH_IA32 | 2094 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |