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/assembler_macros.h" | 8 #include "vm/assembler_macros.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 DECLARE_FLAG(bool, inline_alloc); | 14 DECLARE_FLAG(bool, inline_alloc); |
15 | 15 |
16 #define __ assembler-> | 16 #define __ assembler-> |
17 | 17 |
18 // Static. | 18 // Static. |
19 void AssemblerMacros::TryAllocate(Assembler* assembler, | 19 void AssemblerMacros::TryAllocate(Assembler* assembler, |
20 const Class& cls, | 20 const Class& cls, |
21 Label* failure, | 21 Label* failure, |
| 22 bool near_jump, |
22 Register instance_reg) { | 23 Register instance_reg) { |
23 ASSERT(failure != NULL); | 24 ASSERT(failure != NULL); |
24 if (FLAG_inline_alloc) { | 25 if (FLAG_inline_alloc) { |
25 Heap* heap = Isolate::Current()->heap(); | 26 Heap* heap = Isolate::Current()->heap(); |
26 const intptr_t instance_size = cls.instance_size(); | 27 const intptr_t instance_size = cls.instance_size(); |
27 __ movl(instance_reg, Address::Absolute(heap->TopAddress())); | 28 __ movl(instance_reg, Address::Absolute(heap->TopAddress())); |
28 __ addl(instance_reg, Immediate(instance_size)); | 29 __ addl(instance_reg, Immediate(instance_size)); |
29 // instance_reg: potential next object start. | 30 // instance_reg: potential next object start. |
30 __ cmpl(instance_reg, Address::Absolute(heap->EndAddress())); | 31 __ cmpl(instance_reg, Address::Absolute(heap->EndAddress())); |
31 __ j(ABOVE_EQUAL, failure, Assembler::kNearJump); | 32 __ j(ABOVE_EQUAL, failure, near_jump); |
32 // Successfully allocated the object, now update top to point to | 33 // Successfully allocated the object, now update top to point to |
33 // next object start and store the class in the class field of object. | 34 // next object start and store the class in the class field of object. |
34 __ movl(Address::Absolute(heap->TopAddress()), instance_reg); | 35 __ movl(Address::Absolute(heap->TopAddress()), instance_reg); |
35 ASSERT(instance_size >= kHeapObjectTag); | 36 ASSERT(instance_size >= kHeapObjectTag); |
36 __ subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); | 37 __ subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); |
37 uword tags = 0; | 38 uword tags = 0; |
38 tags = RawObject::SizeTag::update(instance_size, tags); | 39 tags = RawObject::SizeTag::update(instance_size, tags); |
39 ASSERT(cls.id() != kIllegalCid); | 40 ASSERT(cls.id() != kIllegalCid); |
40 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 41 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
41 __ movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); | 42 __ movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void AssemblerMacros::EnterStubFrame(Assembler* assembler) { | 81 void AssemblerMacros::EnterStubFrame(Assembler* assembler) { |
81 __ EnterFrame(0); | 82 __ EnterFrame(0); |
82 __ pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames. | 83 __ pushl(Immediate(0)); // Push 0 in the saved PC area for stub frames. |
83 } | 84 } |
84 | 85 |
85 #undef __ | 86 #undef __ |
86 | 87 |
87 } // namespace dart | 88 } // namespace dart |
88 | 89 |
89 #endif // defined TARGET_ARCH_IA32 | 90 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |