| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 __ cmpl(instance_reg, Address::Absolute(heap->EndAddress())); | 40 __ cmpl(instance_reg, Address::Absolute(heap->EndAddress())); |
| 41 __ j(ABOVE_EQUAL, failure, Assembler::kNearJump); | 41 __ j(ABOVE_EQUAL, failure, Assembler::kNearJump); |
| 42 // Successfully allocated the object, now update top to point to | 42 // Successfully allocated the object, now update top to point to |
| 43 // next object start and store the class in the class field of object. | 43 // next object start and store the class in the class field of object. |
| 44 __ movl(Address::Absolute(heap->TopAddress()), instance_reg); | 44 __ movl(Address::Absolute(heap->TopAddress()), instance_reg); |
| 45 ASSERT(instance_size >= kHeapObjectTag); | 45 ASSERT(instance_size >= kHeapObjectTag); |
| 46 __ subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); | 46 __ subl(instance_reg, Immediate(instance_size - kHeapObjectTag)); |
| 47 __ StoreIntoObject(instance_reg, | 47 __ StoreIntoObject(instance_reg, |
| 48 FieldAddress(instance_reg, Instance::class_offset()), | 48 FieldAddress(instance_reg, Instance::class_offset()), |
| 49 class_reg); | 49 class_reg); |
| 50 __ movl(FieldAddress(instance_reg, Object::tags_offset()), | 50 intptr_t tags = 0; |
| 51 Immediate(RawObject::SizeTag::encode(instance_size))); | 51 tags = RawObject::SizeTag::update(instance_size, tags); |
| 52 ASSERT(cls.index() != kIllegalObjectKind); |
| 53 tags = RawObject::ClassTag::update(cls.index(), tags); |
| 54 __ movl(FieldAddress(instance_reg, Object::tags_offset()), Immediate(tags)); |
| 52 } else { | 55 } else { |
| 53 __ jmp(failure); | 56 __ jmp(failure); |
| 54 } | 57 } |
| 55 } | 58 } |
| 56 | 59 |
| 57 #undef __ | 60 #undef __ |
| 58 | 61 |
| 59 } // namespace dart | 62 } // namespace dart |
| 60 | 63 |
| 61 #endif // defined TARGET_ARCH_IA32 | 64 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |