| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 // Set RBX to new object end. | 1080 // Set RBX to new object end. |
| 1081 __ movq(RBX, RCX); | 1081 __ movq(RBX, RCX); |
| 1082 __ Bind(&type_arguments_ready); | 1082 __ Bind(&type_arguments_ready); |
| 1083 // RAX: new object. | 1083 // RAX: new object. |
| 1084 // RDI: new object type arguments. | 1084 // RDI: new object type arguments. |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 // RAX: new object start. | 1087 // RAX: new object start. |
| 1088 // RBX: next object start. | 1088 // RBX: next object start. |
| 1089 // RDI: new object type arguments (if is_cls_parameterized). | 1089 // RDI: new object type arguments (if is_cls_parameterized). |
| 1090 __ LoadObject(RDX, cls); // Load class of object to be allocated. | |
| 1091 // Set the tags. | 1090 // Set the tags. |
| 1092 uword tags = 0; | 1091 uword tags = 0; |
| 1093 tags = RawObject::SizeTag::update(instance_size, tags); | 1092 tags = RawObject::SizeTag::update(instance_size, tags); |
| 1094 ASSERT(cls.id() != kIllegalCid); | 1093 ASSERT(cls.id() != kIllegalCid); |
| 1095 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1094 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 1096 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); | 1095 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); |
| 1097 | 1096 |
| 1098 // Initialize the remaining words of the object. | 1097 // Initialize the remaining words of the object. |
| 1099 const Immediate& raw_null = | 1098 const Immediate& raw_null = |
| 1100 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1099 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1101 | 1100 |
| 1102 // RAX: new object start. | 1101 // RAX: new object start. |
| 1103 // RBX: next object start. | 1102 // RBX: next object start. |
| 1104 // RDX: class of the object to be allocated. | |
| 1105 // RDI: new object type arguments (if is_cls_parameterized). | 1103 // RDI: new object type arguments (if is_cls_parameterized). |
| 1106 // First try inlining the initialization without a loop. | 1104 // First try inlining the initialization without a loop. |
| 1107 if (instance_size < (kInlineInstanceSize * kWordSize)) { | 1105 if (instance_size < (kInlineInstanceSize * kWordSize)) { |
| 1108 // Check if the object contains any non-header fields. | 1106 // Check if the object contains any non-header fields. |
| 1109 // Small objects are initialized using a consecutive set of writes. | 1107 // Small objects are initialized using a consecutive set of writes. |
| 1110 for (intptr_t current_offset = sizeof(RawObject); | 1108 for (intptr_t current_offset = sizeof(RawObject); |
| 1111 current_offset < instance_size; | 1109 current_offset < instance_size; |
| 1112 current_offset += kWordSize) { | 1110 current_offset += kWordSize) { |
| 1113 __ movq(Address(RAX, current_offset), raw_null); | 1111 __ movq(Address(RAX, current_offset), raw_null); |
| 1114 } | 1112 } |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 __ cmpq(left, right); | 2072 __ cmpq(left, right); |
| 2075 __ Bind(&done); | 2073 __ Bind(&done); |
| 2076 __ popq(right); | 2074 __ popq(right); |
| 2077 __ popq(left); | 2075 __ popq(left); |
| 2078 __ ret(); | 2076 __ ret(); |
| 2079 } | 2077 } |
| 2080 | 2078 |
| 2081 } // namespace dart | 2079 } // namespace dart |
| 2082 | 2080 |
| 2083 #endif // defined TARGET_ARCH_X64 | 2081 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |