| 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 __ Ret(); | 1041 __ Ret(); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 | 1044 |
| 1045 // Called for inline allocation of objects. | 1045 // Called for inline allocation of objects. |
| 1046 // Input parameters: | 1046 // Input parameters: |
| 1047 // LR : return address. | 1047 // LR : return address. |
| 1048 // SP + 0 : type arguments object (only if class is parameterized). | 1048 // SP + 0 : type arguments object (only if class is parameterized). |
| 1049 // Returns patch_code_pc offset where patching code for disabling the stub | 1049 // Returns patch_code_pc offset where patching code for disabling the stub |
| 1050 // has been generated (similar to regularly generated Dart code). | 1050 // has been generated (similar to regularly generated Dart code). |
| 1051 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1051 void StubCode::GenerateAllocationStubForClass( |
| 1052 const Class& cls) { | 1052 Assembler* assembler, const Class& cls, |
| 1053 uword* entry_patch_offset, uword* patch_code_pc_offset) { |
| 1054 *entry_patch_offset = assembler->CodeSize(); |
| 1053 // The generated code is different if the class is parameterized. | 1055 // The generated code is different if the class is parameterized. |
| 1054 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; | 1056 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1055 ASSERT(!is_cls_parameterized || | 1057 ASSERT(!is_cls_parameterized || |
| 1056 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1058 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1057 // kInlineInstanceSize is a constant used as a threshold for determining | 1059 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1058 // when the object initialization should be done as a loop or as | 1060 // when the object initialization should be done as a loop or as |
| 1059 // straight line code. | 1061 // straight line code. |
| 1060 const int kInlineInstanceSize = 12; | 1062 const int kInlineInstanceSize = 12; |
| 1061 const intptr_t instance_size = cls.instance_size(); | 1063 const intptr_t instance_size = cls.instance_size(); |
| 1062 ASSERT(instance_size > 0); | 1064 ASSERT(instance_size > 0); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 // Push null type arguments. | 1162 // Push null type arguments. |
| 1161 __ Push(R2); | 1163 __ Push(R2); |
| 1162 } | 1164 } |
| 1163 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1165 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1164 __ Drop(2); // Pop arguments. | 1166 __ Drop(2); // Pop arguments. |
| 1165 __ Pop(R0); // Pop result (newly allocated object). | 1167 __ Pop(R0); // Pop result (newly allocated object). |
| 1166 // R0: new object | 1168 // R0: new object |
| 1167 // Restore the frame pointer. | 1169 // Restore the frame pointer. |
| 1168 __ LeaveStubFrame(); | 1170 __ LeaveStubFrame(); |
| 1169 __ Ret(); | 1171 __ Ret(); |
| 1170 uword patch_code_pc_offset = assembler->CodeSize(); | 1172 *patch_code_pc_offset = assembler->CodeSize(); |
| 1171 StubCode* stub_code = Isolate::Current()->stub_code(); | 1173 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 1172 __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel()); | 1174 __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel()); |
| 1173 return patch_code_pc_offset; | |
| 1174 } | 1175 } |
| 1175 | 1176 |
| 1176 | 1177 |
| 1177 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1178 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1178 // from the entry code of a dart function after an error in passed argument | 1179 // from the entry code of a dart function after an error in passed argument |
| 1179 // name or number is detected. | 1180 // name or number is detected. |
| 1180 // Input parameters: | 1181 // Input parameters: |
| 1181 // LR : return address. | 1182 // LR : return address. |
| 1182 // SP : address of last argument. | 1183 // SP : address of last argument. |
| 1183 // R4: arguments descriptor array. | 1184 // R4: arguments descriptor array. |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 const Register right = R0; | 1972 const Register right = R0; |
| 1972 __ ldr(left, Address(SP, 1 * kWordSize)); | 1973 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 1973 __ ldr(right, Address(SP, 0 * kWordSize)); | 1974 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 1974 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1975 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 1975 __ Ret(); | 1976 __ Ret(); |
| 1976 } | 1977 } |
| 1977 | 1978 |
| 1978 } // namespace dart | 1979 } // namespace dart |
| 1979 | 1980 |
| 1980 #endif // defined TARGET_ARCH_ARM | 1981 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |