| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/ic_data.h" | 10 #include "vm/ic_data.h" |
| 11 #include "vm/object_store.h" | 11 #include "vm/object_store.h" |
| 12 #include "vm/pages.h" | 12 #include "vm/pages.h" |
| 13 #include "vm/resolver.h" | 13 #include "vm/resolver.h" |
| 14 #include "vm/scavenger.h" | 14 #include "vm/scavenger.h" |
| 15 #include "vm/stub_code.h" | 15 #include "vm/stub_code.h" |
| 16 | 16 |
| 17 | 17 |
| 18 #define __ assembler-> | 18 #define __ assembler-> |
| 19 | 19 |
| 20 namespace dart { | 20 namespace dart { |
| 21 | 21 |
| 22 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); | 22 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); |
| 23 DEFINE_FLAG(bool, use_slow_path, false, |
| 24 "Set to true for debugging & verifying the slow paths."); |
| 23 | 25 |
| 24 // Input parameters: | 26 // Input parameters: |
| 25 // ESP : points to return address. | 27 // ESP : points to return address. |
| 26 // ESP + 4 : address of last argument in argument array. | 28 // ESP + 4 : address of last argument in argument array. |
| 27 // ESP + 4*EDX : address of first argument in argument array. | 29 // ESP + 4*EDX : address of first argument in argument array. |
| 28 // ESP + 4*EDX + 4 : address of return value. | 30 // ESP + 4*EDX + 4 : address of return value. |
| 29 // ECX : address of the runtime function to call. | 31 // ECX : address of the runtime function to call. |
| 30 // EDX : number of arguments to the call. | 32 // EDX : number of arguments to the call. |
| 31 // Must preserve callee saved registers EDI and EBX. | 33 // Must preserve callee saved registers EDI and EBX. |
| 32 static void GenerateCallRuntimeStub(Assembler* assembler) { | 34 static void GenerateCallRuntimeStub(Assembler* assembler) { |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 if (FLAG_inline_alloc && | 1253 if (FLAG_inline_alloc && |
| 1252 PageSpace::IsPageAllocatableSize(closure_size + context_size)) { | 1254 PageSpace::IsPageAllocatableSize(closure_size + context_size)) { |
| 1253 Label slow_case; | 1255 Label slow_case; |
| 1254 Heap* heap = Isolate::Current()->heap(); | 1256 Heap* heap = Isolate::Current()->heap(); |
| 1255 __ movl(EAX, Address::Absolute(heap->TopAddress())); | 1257 __ movl(EAX, Address::Absolute(heap->TopAddress())); |
| 1256 __ leal(EBX, Address(EAX, closure_size)); | 1258 __ leal(EBX, Address(EAX, closure_size)); |
| 1257 if (is_implicit_instance_closure) { | 1259 if (is_implicit_instance_closure) { |
| 1258 __ movl(ECX, EBX); // ECX: new context address. | 1260 __ movl(ECX, EBX); // ECX: new context address. |
| 1259 __ addl(EBX, Immediate(context_size)); | 1261 __ addl(EBX, Immediate(context_size)); |
| 1260 } | 1262 } |
| 1263 if (FLAG_use_slow_path) { |
| 1264 __ jmp(&slow_case); |
| 1265 } |
| 1261 // Check if the allocation fits into the remaining space. | 1266 // Check if the allocation fits into the remaining space. |
| 1262 // EAX: potential new closure object. | 1267 // EAX: potential new closure object. |
| 1263 // ECX: potential new context object (only if is_implicit_closure). | 1268 // ECX: potential new context object (only if is_implicit_closure). |
| 1264 // EBX: potential next object start. | 1269 // EBX: potential next object start. |
| 1265 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 1270 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
| 1266 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); | 1271 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); |
| 1267 | 1272 |
| 1268 // Successfully allocated the object, now update top to point to | 1273 // Successfully allocated the object, now update top to point to |
| 1269 // next object start and initialize the object. | 1274 // next object start and initialize the object. |
| 1270 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 1275 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 // EAX: Target function. | 1523 // EAX: Target function. |
| 1519 __ movl(EAX, FieldAddress(EAX, Function::code_offset())); | 1524 __ movl(EAX, FieldAddress(EAX, Function::code_offset())); |
| 1520 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset())); | 1525 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset())); |
| 1521 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1526 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1522 __ jmp(EAX); | 1527 __ jmp(EAX); |
| 1523 } | 1528 } |
| 1524 | 1529 |
| 1525 } // namespace dart | 1530 } // namespace dart |
| 1526 | 1531 |
| 1527 #endif // defined TARGET_ARCH_IA32 | 1532 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |