| 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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 | 1090 |
| 1091 // Called for inline allocation of objects. | 1091 // Called for inline allocation of objects. |
| 1092 // Input parameters: | 1092 // Input parameters: |
| 1093 // ESP + 4 : type arguments object (only if class is parameterized). | 1093 // ESP + 4 : type arguments object (only if class is parameterized). |
| 1094 // ESP : points to return address. | 1094 // ESP : points to return address. |
| 1095 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. | 1095 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. |
| 1096 // Returns patch_code_pc offset where patching code for disabling the stub | 1096 // Returns patch_code_pc offset where patching code for disabling the stub |
| 1097 // has been generated (similar to regularly generated Dart code). | 1097 // has been generated (similar to regularly generated Dart code). |
| 1098 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1098 void StubCode::GenerateAllocationStubForClass( |
| 1099 const Class& cls) { | 1099 Assembler* assembler, const Class& cls, |
| 1100 uword* entry_patch_offset, uword* patch_code_pc_offset) { |
| 1101 *entry_patch_offset = assembler->CodeSize(); |
| 1100 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; | 1102 const intptr_t kObjectTypeArgumentsOffset = 1 * kWordSize; |
| 1101 const Immediate& raw_null = | 1103 const Immediate& raw_null = |
| 1102 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1104 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1103 // The generated code is different if the class is parameterized. | 1105 // The generated code is different if the class is parameterized. |
| 1104 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; | 1106 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1105 ASSERT(!is_cls_parameterized || | 1107 ASSERT(!is_cls_parameterized || |
| 1106 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1108 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1107 // kInlineInstanceSize is a constant used as a threshold for determining | 1109 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1108 // when the object initialization should be done as a loop or as | 1110 // when the object initialization should be done as a loop or as |
| 1109 // straight line code. | 1111 // straight line code. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1206 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1205 __ popl(EAX); // Pop argument (type arguments of object). | 1207 __ popl(EAX); // Pop argument (type arguments of object). |
| 1206 __ popl(EAX); // Pop argument (class of object). | 1208 __ popl(EAX); // Pop argument (class of object). |
| 1207 __ popl(EAX); // Pop result (newly allocated object). | 1209 __ popl(EAX); // Pop result (newly allocated object). |
| 1208 // EAX: new object | 1210 // EAX: new object |
| 1209 // Restore the frame pointer. | 1211 // Restore the frame pointer. |
| 1210 __ LeaveFrame(); | 1212 __ LeaveFrame(); |
| 1211 __ ret(); | 1213 __ ret(); |
| 1212 // Emit function patching code. This will be swapped with the first 5 bytes | 1214 // Emit function patching code. This will be swapped with the first 5 bytes |
| 1213 // at entry point. | 1215 // at entry point. |
| 1214 uword patch_code_pc_offset = assembler->CodeSize(); | 1216 *patch_code_pc_offset = assembler->CodeSize(); |
| 1215 StubCode* stub_code = Isolate::Current()->stub_code(); | 1217 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 1216 __ jmp(&stub_code->FixAllocationStubTargetLabel()); | 1218 __ jmp(&stub_code->FixAllocationStubTargetLabel()); |
| 1217 return patch_code_pc_offset; | |
| 1218 } | 1219 } |
| 1219 | 1220 |
| 1220 | 1221 |
| 1221 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1222 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1222 // from the entry code of a dart function after an error in passed argument | 1223 // from the entry code of a dart function after an error in passed argument |
| 1223 // name or number is detected. | 1224 // name or number is detected. |
| 1224 // Input parameters: | 1225 // Input parameters: |
| 1225 // ESP : points to return address. | 1226 // ESP : points to return address. |
| 1226 // ESP + 4 : address of last argument. | 1227 // ESP + 4 : address of last argument. |
| 1227 // EDX : arguments descriptor array. | 1228 // EDX : arguments descriptor array. |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 const Register temp = ECX; | 2053 const Register temp = ECX; |
| 2053 __ movl(left, Address(ESP, 2 * kWordSize)); | 2054 __ movl(left, Address(ESP, 2 * kWordSize)); |
| 2054 __ movl(right, Address(ESP, 1 * kWordSize)); | 2055 __ movl(right, Address(ESP, 1 * kWordSize)); |
| 2055 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2056 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2056 __ ret(); | 2057 __ ret(); |
| 2057 } | 2058 } |
| 2058 | 2059 |
| 2059 } // namespace dart | 2060 } // namespace dart |
| 2060 | 2061 |
| 2061 #endif // defined TARGET_ARCH_IA32 | 2062 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |