| 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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); | 1060 __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1); |
| 1061 __ LeaveCallRuntimeFrame(); | 1061 __ LeaveCallRuntimeFrame(); |
| 1062 __ ret(); | 1062 __ ret(); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 | 1065 |
| 1066 // Called for inline allocation of objects. | 1066 // Called for inline allocation of objects. |
| 1067 // Input parameters: | 1067 // Input parameters: |
| 1068 // RSP + 8 : type arguments object (only if class is parameterized). | 1068 // RSP + 8 : type arguments object (only if class is parameterized). |
| 1069 // RSP : points to return address. | 1069 // RSP : points to return address. |
| 1070 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1070 void StubCode::GenerateAllocationStubForClass( |
| 1071 const Class& cls) { | 1071 Assembler* assembler, const Class& cls, |
| 1072 uword* entry_patch_offset, uword* patch_code_pc_offset) { |
| 1073 // Must load pool pointer before being able to patch. |
| 1074 Register new_pp = R13; |
| 1075 __ LoadPoolPointer(new_pp); |
| 1076 *entry_patch_offset = assembler->CodeSize(); |
| 1077 |
| 1072 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; | 1078 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; |
| 1073 // The generated code is different if the class is parameterized. | 1079 // The generated code is different if the class is parameterized. |
| 1074 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; | 1080 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1075 ASSERT(!is_cls_parameterized || | 1081 ASSERT(!is_cls_parameterized || |
| 1076 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1082 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1077 // kInlineInstanceSize is a constant used as a threshold for determining | 1083 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1078 // when the object initialization should be done as a loop or as | 1084 // when the object initialization should be done as a loop or as |
| 1079 // straight line code. | 1085 // straight line code. |
| 1080 const int kInlineInstanceSize = 12; // In words. | 1086 const int kInlineInstanceSize = 12; // In words. |
| 1081 const intptr_t instance_size = cls.instance_size(); | 1087 const intptr_t instance_size = cls.instance_size(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 __ pushq(R12); // Push null type arguments. | 1179 __ pushq(R12); // Push null type arguments. |
| 1174 } | 1180 } |
| 1175 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1181 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1176 __ popq(RAX); // Pop argument (type arguments of object). | 1182 __ popq(RAX); // Pop argument (type arguments of object). |
| 1177 __ popq(RAX); // Pop argument (class of object). | 1183 __ popq(RAX); // Pop argument (class of object). |
| 1178 __ popq(RAX); // Pop result (newly allocated object). | 1184 __ popq(RAX); // Pop result (newly allocated object). |
| 1179 // RAX: new object | 1185 // RAX: new object |
| 1180 // Restore the frame pointer. | 1186 // Restore the frame pointer. |
| 1181 __ LeaveStubFrame(); | 1187 __ LeaveStubFrame(); |
| 1182 __ ret(); | 1188 __ ret(); |
| 1183 uword patch_code_pc_offset = assembler->CodeSize(); | 1189 *patch_code_pc_offset = assembler->CodeSize(); |
| 1184 StubCode* stub_code = Isolate::Current()->stub_code(); | 1190 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 1185 __ JmpPatchable(&stub_code->FixAllocationStubTargetLabel(), R13); | 1191 __ JmpPatchable(&stub_code->FixAllocationStubTargetLabel(), new_pp); |
| 1186 return patch_code_pc_offset; | |
| 1187 } | 1192 } |
| 1188 | 1193 |
| 1189 | 1194 |
| 1190 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1195 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1191 // from the entry code of a dart function after an error in passed argument | 1196 // from the entry code of a dart function after an error in passed argument |
| 1192 // name or number is detected. | 1197 // name or number is detected. |
| 1193 // Input parameters: | 1198 // Input parameters: |
| 1194 // RSP : points to return address. | 1199 // RSP : points to return address. |
| 1195 // RSP + 8 : address of last argument. | 1200 // RSP + 8 : address of last argument. |
| 1196 // R10 : arguments descriptor array. | 1201 // R10 : arguments descriptor array. |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 | 2027 |
| 2023 __ movq(left, Address(RSP, 2 * kWordSize)); | 2028 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 2024 __ movq(right, Address(RSP, 1 * kWordSize)); | 2029 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 2025 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2030 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2026 __ ret(); | 2031 __ ret(); |
| 2027 } | 2032 } |
| 2028 | 2033 |
| 2029 } // namespace dart | 2034 } // namespace dart |
| 2030 | 2035 |
| 2031 #endif // defined TARGET_ARCH_X64 | 2036 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |