| 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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 // Set EBX to new object end. | 1094 // Set EBX to new object end. |
| 1095 __ movl(EBX, ECX); | 1095 __ movl(EBX, ECX); |
| 1096 __ Bind(&type_arguments_ready); | 1096 __ Bind(&type_arguments_ready); |
| 1097 // EAX: new object. | 1097 // EAX: new object. |
| 1098 // EDI: new object type arguments. | 1098 // EDI: new object type arguments. |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 // EAX: new object start. | 1101 // EAX: new object start. |
| 1102 // EBX: next object start. | 1102 // EBX: next object start. |
| 1103 // EDI: new object type arguments (if is_cls_parameterized). | 1103 // EDI: new object type arguments (if is_cls_parameterized). |
| 1104 __ LoadObject(EDX, cls); // Load class of object to be allocated. | |
| 1105 // Set the tags. | 1104 // Set the tags. |
| 1106 uword tags = 0; | 1105 uword tags = 0; |
| 1107 tags = RawObject::SizeTag::update(instance_size, tags); | 1106 tags = RawObject::SizeTag::update(instance_size, tags); |
| 1108 ASSERT(cls.id() != kIllegalCid); | 1107 ASSERT(cls.id() != kIllegalCid); |
| 1109 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1108 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 1110 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); | 1109 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); |
| 1111 | 1110 |
| 1112 // Initialize the remaining words of the object. | 1111 // Initialize the remaining words of the object. |
| 1113 const Immediate& raw_null = | 1112 const Immediate& raw_null = |
| 1114 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1113 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1115 | 1114 |
| 1116 // EAX: new object start. | 1115 // EAX: new object start. |
| 1117 // EBX: next object start. | 1116 // EBX: next object start. |
| 1118 // EDX: class of the object to be allocated. | |
| 1119 // EDI: new object type arguments (if is_cls_parameterized). | 1117 // EDI: new object type arguments (if is_cls_parameterized). |
| 1120 // First try inlining the initialization without a loop. | 1118 // First try inlining the initialization without a loop. |
| 1121 if (instance_size < (kInlineInstanceSize * kWordSize)) { | 1119 if (instance_size < (kInlineInstanceSize * kWordSize)) { |
| 1122 // Check if the object contains any non-header fields. | 1120 // Check if the object contains any non-header fields. |
| 1123 // Small objects are initialized using a consecutive set of writes. | 1121 // Small objects are initialized using a consecutive set of writes. |
| 1124 for (intptr_t current_offset = sizeof(RawObject); | 1122 for (intptr_t current_offset = sizeof(RawObject); |
| 1125 current_offset < instance_size; | 1123 current_offset < instance_size; |
| 1126 current_offset += kWordSize) { | 1124 current_offset += kWordSize) { |
| 1127 __ movl(Address(EAX, current_offset), raw_null); | 1125 __ movl(Address(EAX, current_offset), raw_null); |
| 1128 } | 1126 } |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 GenerateNArgsCheckInlineCacheStub(assembler, 2); | 1631 GenerateNArgsCheckInlineCacheStub(assembler, 2); |
| 1634 } | 1632 } |
| 1635 | 1633 |
| 1636 | 1634 |
| 1637 void StubCode::GenerateThreeArgsCheckInlineCacheStub(Assembler* assembler) { | 1635 void StubCode::GenerateThreeArgsCheckInlineCacheStub(Assembler* assembler) { |
| 1638 GenerateUsageCounterIncrement(assembler, EBX); | 1636 GenerateUsageCounterIncrement(assembler, EBX); |
| 1639 GenerateNArgsCheckInlineCacheStub(assembler, 3); | 1637 GenerateNArgsCheckInlineCacheStub(assembler, 3); |
| 1640 } | 1638 } |
| 1641 | 1639 |
| 1642 | 1640 |
| 1643 | |
| 1644 // Use inline cache data array to invoke the target or continue in inline | 1641 // Use inline cache data array to invoke the target or continue in inline |
| 1645 // cache miss handler. Stub for 1-argument check (receiver class). | 1642 // cache miss handler. Stub for 1-argument check (receiver class). |
| 1646 // EDI: function which counter needs to be incremented. | 1643 // EDI: function which counter needs to be incremented. |
| 1647 // ECX: Inline cache data object. | 1644 // ECX: Inline cache data object. |
| 1648 // EDX: Arguments descriptor array. | 1645 // EDX: Arguments descriptor array. |
| 1649 // TOS(0): Return address. | 1646 // TOS(0): Return address. |
| 1650 // Inline cache data object structure: | 1647 // Inline cache data object structure: |
| 1651 // 0: function-name | 1648 // 0: function-name |
| 1652 // 1: N, number of arguments checked. | 1649 // 1: N, number of arguments checked. |
| 1653 // 2 .. (length - 1): group of checks, each check containing: | 1650 // 2 .. (length - 1): group of checks, each check containing: |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 __ Bind(&done); | 2117 __ Bind(&done); |
| 2121 __ popl(temp); | 2118 __ popl(temp); |
| 2122 __ popl(right); | 2119 __ popl(right); |
| 2123 __ popl(left); | 2120 __ popl(left); |
| 2124 __ ret(); | 2121 __ ret(); |
| 2125 } | 2122 } |
| 2126 | 2123 |
| 2127 } // namespace dart | 2124 } // namespace dart |
| 2128 | 2125 |
| 2129 #endif // defined TARGET_ARCH_IA32 | 2126 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |