Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: vm/stub_code_ia32.cc

Issue 11316203: Rename the field type_arguments_instance_field_offset_ to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 // ESP : points to return address. 1107 // ESP : points to return address.
1108 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers. 1108 // Uses EAX, EBX, ECX, EDX, EDI as temporary registers.
1109 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, 1109 void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
1110 const Class& cls) { 1110 const Class& cls) {
1111 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize; 1111 const intptr_t kObjectTypeArgumentsOffset = 2 * kWordSize;
1112 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize; 1112 const intptr_t kInstantiatorTypeArgumentsOffset = 1 * kWordSize;
1113 const Immediate raw_null = 1113 const Immediate raw_null =
1114 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1114 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1115 // The generated code is different if the class is parameterized. 1115 // The generated code is different if the class is parameterized.
1116 const bool is_cls_parameterized = 1116 const bool is_cls_parameterized =
1117 cls.type_arguments_instance_field_offset() != Class::kNoTypeArguments; 1117 cls.type_arguments_field_offset() != Class::kNoTypeArguments;
1118 // kInlineInstanceSize is a constant used as a threshold for determining 1118 // kInlineInstanceSize is a constant used as a threshold for determining
1119 // when the object initialization should be done as a loop or as 1119 // when the object initialization should be done as a loop or as
1120 // straight line code. 1120 // straight line code.
1121 const int kInlineInstanceSize = 12; 1121 const int kInlineInstanceSize = 12;
1122 const intptr_t instance_size = cls.instance_size(); 1122 const intptr_t instance_size = cls.instance_size();
1123 ASSERT(instance_size > 0); 1123 ASSERT(instance_size > 0);
1124 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize(); 1124 const intptr_t type_args_size = InstantiatedTypeArguments::InstanceSize();
1125 if (FLAG_inline_alloc && 1125 if (FLAG_inline_alloc &&
1126 PageSpace::IsPageAllocatableSize(instance_size + type_args_size)) { 1126 PageSpace::IsPageAllocatableSize(instance_size + type_args_size)) {
1127 Label slow_case; 1127 Label slow_case;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 __ cmpl(ECX, EBX); 1232 __ cmpl(ECX, EBX);
1233 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); 1233 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump);
1234 __ movl(Address(ECX, 0), raw_null); 1234 __ movl(Address(ECX, 0), raw_null);
1235 __ addl(ECX, Immediate(kWordSize)); 1235 __ addl(ECX, Immediate(kWordSize));
1236 __ jmp(&init_loop, Assembler::kNearJump); 1236 __ jmp(&init_loop, Assembler::kNearJump);
1237 __ Bind(&done); 1237 __ Bind(&done);
1238 } 1238 }
1239 if (is_cls_parameterized) { 1239 if (is_cls_parameterized) {
1240 // EDI: new object type arguments. 1240 // EDI: new object type arguments.
1241 // Set the type arguments in the new object. 1241 // Set the type arguments in the new object.
1242 __ movl(Address(EAX, cls.type_arguments_instance_field_offset()), EDI); 1242 __ movl(Address(EAX, cls.type_arguments_field_offset()), EDI);
1243 } 1243 }
1244 // Done allocating and initializing the instance. 1244 // Done allocating and initializing the instance.
1245 // EAX: new object. 1245 // EAX: new object.
1246 __ addl(EAX, Immediate(kHeapObjectTag)); 1246 __ addl(EAX, Immediate(kHeapObjectTag));
1247 __ ret(); 1247 __ ret();
1248 1248
1249 __ Bind(&slow_case); 1249 __ Bind(&slow_case);
1250 } 1250 }
1251 if (is_cls_parameterized) { 1251 if (is_cls_parameterized) {
1252 __ movl(EAX, Address(ESP, kObjectTypeArgumentsOffset)); 1252 __ movl(EAX, Address(ESP, kObjectTypeArgumentsOffset));
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 const Immediate raw_null = 1874 const Immediate raw_null =
1875 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1875 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1876 __ movl(EAX, Address(ESP, kInstanceOffsetInBytes)); 1876 __ movl(EAX, Address(ESP, kInstanceOffsetInBytes));
1877 if (n > 1) { 1877 if (n > 1) {
1878 // Get instance type arguments. 1878 // Get instance type arguments.
1879 __ LoadClass(ECX, EAX, EBX); 1879 __ LoadClass(ECX, EAX, EBX);
1880 // Compute instance type arguments into EBX. 1880 // Compute instance type arguments into EBX.
1881 Label has_no_type_arguments; 1881 Label has_no_type_arguments;
1882 __ movl(EBX, raw_null); 1882 __ movl(EBX, raw_null);
1883 __ movl(EDI, FieldAddress(ECX, 1883 __ movl(EDI, FieldAddress(ECX,
1884 Class::type_arguments_instance_field_offset_offset())); 1884 Class::type_arguments_field_offset_offset()));
1885 __ cmpl(EDI, Immediate(Class::kNoTypeArguments)); 1885 __ cmpl(EDI, Immediate(Class::kNoTypeArguments));
1886 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); 1886 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump);
1887 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0)); 1887 __ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0));
1888 __ Bind(&has_no_type_arguments); 1888 __ Bind(&has_no_type_arguments);
1889 } 1889 }
1890 __ LoadClassId(ECX, EAX); 1890 __ LoadClassId(ECX, EAX);
1891 // EAX: instance, ECX: instance class id. 1891 // EAX: instance, ECX: instance class id.
1892 // EBX: instance type arguments (null if none), used only if n > 1. 1892 // EBX: instance type arguments (null if none), used only if n > 1.
1893 __ movl(EDX, Address(ESP, kCacheOffsetInBytes)); 1893 __ movl(EDX, Address(ESP, kCacheOffsetInBytes));
1894 // EDX: SubtypeTestCache. 1894 // EDX: SubtypeTestCache.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 __ Bind(&done); 2212 __ Bind(&done);
2213 __ popl(temp); 2213 __ popl(temp);
2214 __ popl(right); 2214 __ popl(right);
2215 __ popl(left); 2215 __ popl(left);
2216 __ ret(); 2216 __ ret();
2217 } 2217 }
2218 2218
2219 } // namespace dart 2219 } // namespace dart
2220 2220
2221 #endif // defined TARGET_ARCH_IA32 2221 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698