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

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 10441111: - Rename class index to class id. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months 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 | « runtime/vm/snapshot.cc ('k') | runtime/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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 __ cmpl(ECX, Immediate(RawObject::SizeTag::kMaxSizeTag)); 695 __ cmpl(ECX, Immediate(RawObject::SizeTag::kMaxSizeTag));
696 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 696 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
697 __ shll(ECX, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); 697 __ shll(ECX, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2));
698 __ jmp(&done); 698 __ jmp(&done);
699 699
700 __ Bind(&size_tag_overflow); 700 __ Bind(&size_tag_overflow);
701 __ movl(ECX, Immediate(0)); 701 __ movl(ECX, Immediate(0));
702 __ Bind(&done); 702 __ Bind(&done);
703 703
704 // Get the class index and insert it into the tags. 704 // Get the class index and insert it into the tags.
705 __ orl(ECX, Immediate(RawObject::ClassTag::encode(kArray))); 705 __ orl(ECX, Immediate(RawObject::ClassIdTag::encode(kArray)));
706 __ movl(FieldAddress(EAX, Array::tags_offset()), ECX); 706 __ movl(FieldAddress(EAX, Array::tags_offset()), ECX);
707 } 707 }
708 708
709 // Initialize all array elements to raw_null. 709 // Initialize all array elements to raw_null.
710 // EAX: new object start as a tagged pointer. 710 // EAX: new object start as a tagged pointer.
711 // EBX: new object end address. 711 // EBX: new object end address.
712 // EDX: Array length as Smi. 712 // EDX: Array length as Smi.
713 __ leal(ECX, FieldAddress(EAX, Array::data_offset())); 713 __ leal(ECX, FieldAddress(EAX, Array::data_offset()));
714 // ECX: iterator which initially points to the start of the variable 714 // ECX: iterator which initially points to the start of the variable
715 // data area to be initialized. 715 // data area to be initialized.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 1025
1026 __ Bind(&size_tag_overflow); 1026 __ Bind(&size_tag_overflow);
1027 // Set overflow size tag value. 1027 // Set overflow size tag value.
1028 __ movl(EBX, Immediate(0)); 1028 __ movl(EBX, Immediate(0));
1029 1029
1030 __ Bind(&done); 1030 __ Bind(&done);
1031 // EAX: new object. 1031 // EAX: new object.
1032 // EDX: number of context variables. 1032 // EDX: number of context variables.
1033 // EBX: size and bit tags. 1033 // EBX: size and bit tags.
1034 __ orl(EBX, 1034 __ orl(EBX,
1035 Immediate(RawObject::ClassTag::encode(context_class.index()))); 1035 Immediate(RawObject::ClassIdTag::encode(context_class.id())));
1036 __ movl(FieldAddress(EAX, Context::tags_offset()), EBX); // Tags. 1036 __ movl(FieldAddress(EAX, Context::tags_offset()), EBX); // Tags.
1037 } 1037 }
1038 1038
1039 // Setup up number of context variables field. 1039 // Setup up number of context variables field.
1040 // EAX: new object. 1040 // EAX: new object.
1041 // EDX: number of context variables as integer value (not object). 1041 // EDX: number of context variables as integer value (not object).
1042 __ movl(FieldAddress(EAX, Context::num_variables_offset()), EDX); 1042 __ movl(FieldAddress(EAX, Context::num_variables_offset()), EDX);
1043 1043
1044 // Setup isolate field. 1044 // Setup isolate field.
1045 // Load Isolate pointer from Context structure into EBX. 1045 // Load Isolate pointer from Context structure into EBX.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 __ movl(Address(ECX, 1167 __ movl(Address(ECX,
1168 InstantiatedTypeArguments::instantiator_type_arguments_offset()), 1168 InstantiatedTypeArguments::instantiator_type_arguments_offset()),
1169 EDX); 1169 EDX);
1170 const Class& ita_cls = 1170 const Class& ita_cls =
1171 Class::ZoneHandle(Object::instantiated_type_arguments_class()); 1171 Class::ZoneHandle(Object::instantiated_type_arguments_class());
1172 __ LoadObject(EDX, ita_cls); 1172 __ LoadObject(EDX, ita_cls);
1173 __ movl(Address(ECX, Instance::class_offset()), EDX); // Set its class. 1173 __ movl(Address(ECX, Instance::class_offset()), EDX); // Set its class.
1174 // Set the tags. 1174 // Set the tags.
1175 uword tags = 0; 1175 uword tags = 0;
1176 tags = RawObject::SizeTag::update(type_args_size, tags); 1176 tags = RawObject::SizeTag::update(type_args_size, tags);
1177 tags = RawObject::ClassTag::update(ita_cls.index(), tags); 1177 tags = RawObject::ClassIdTag::update(ita_cls.id(), tags);
1178 __ movl(Address(ECX, Instance::tags_offset()), Immediate(tags)); 1178 __ movl(Address(ECX, Instance::tags_offset()), Immediate(tags));
1179 // Set the new InstantiatedTypeArguments object (ECX) as the type 1179 // Set the new InstantiatedTypeArguments object (ECX) as the type
1180 // arguments (EDI) of the new object (EAX). 1180 // arguments (EDI) of the new object (EAX).
1181 __ movl(EDI, ECX); 1181 __ movl(EDI, ECX);
1182 __ addl(EDI, Immediate(kHeapObjectTag)); 1182 __ addl(EDI, Immediate(kHeapObjectTag));
1183 // Set EBX to new object end. 1183 // Set EBX to new object end.
1184 __ movl(EBX, ECX); 1184 __ movl(EBX, ECX);
1185 __ Bind(&type_arguments_ready); 1185 __ Bind(&type_arguments_ready);
1186 // EAX: new object. 1186 // EAX: new object.
1187 // EDI: new object type arguments. 1187 // EDI: new object type arguments.
1188 } 1188 }
1189 1189
1190 // Initialize the class field in the object. 1190 // Initialize the class field in the object.
1191 // EAX: new object start. 1191 // EAX: new object start.
1192 // EBX: next object start. 1192 // EBX: next object start.
1193 // EDI: new object type arguments (if is_cls_parameterized). 1193 // EDI: new object type arguments (if is_cls_parameterized).
1194 __ LoadObject(EDX, cls); // Load class of object to be allocated. 1194 __ LoadObject(EDX, cls); // Load class of object to be allocated.
1195 __ movl(Address(EAX, Instance::class_offset()), EDX); 1195 __ movl(Address(EAX, Instance::class_offset()), EDX);
1196 // Set the tags. 1196 // Set the tags.
1197 uword tags = 0; 1197 uword tags = 0;
1198 tags = RawObject::SizeTag::update(instance_size, tags); 1198 tags = RawObject::SizeTag::update(instance_size, tags);
1199 ASSERT(cls.index() != kIllegalObjectKind); 1199 ASSERT(cls.id() != kIllegalObjectKind);
1200 tags = RawObject::ClassTag::update(cls.index(), tags); 1200 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1201 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); 1201 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags));
1202 1202
1203 // Initialize the remaining words of the object. 1203 // Initialize the remaining words of the object.
1204 const Immediate raw_null = 1204 const Immediate raw_null =
1205 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1205 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1206 1206
1207 // EAX: new object start. 1207 // EAX: new object start.
1208 // EBX: next object start. 1208 // EBX: next object start.
1209 // EDX: class of the object to be allocated. 1209 // EDX: class of the object to be allocated.
1210 // First try inlining the initialization without a loop. 1210 // First try inlining the initialization without a loop.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 __ movl(Address::Absolute(heap->TopAddress()), EBX); 1343 __ movl(Address::Absolute(heap->TopAddress()), EBX);
1344 1344
1345 // Initialize the class field in the object. 1345 // Initialize the class field in the object.
1346 // EAX: new closure object. 1346 // EAX: new closure object.
1347 // ECX: new context object (only if is_implicit_closure). 1347 // ECX: new context object (only if is_implicit_closure).
1348 __ LoadObject(EDX, cls); // Load signature class of closure. 1348 __ LoadObject(EDX, cls); // Load signature class of closure.
1349 __ movl(Address(EAX, Closure::class_offset()), EDX); 1349 __ movl(Address(EAX, Closure::class_offset()), EDX);
1350 // Set the tags. 1350 // Set the tags.
1351 uword tags = 0; 1351 uword tags = 0;
1352 tags = RawObject::SizeTag::update(closure_size, tags); 1352 tags = RawObject::SizeTag::update(closure_size, tags);
1353 tags = RawObject::ClassTag::update(cls.index(), tags); 1353 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1354 __ movl(Address(EAX, Closure::tags_offset()), Immediate(tags)); 1354 __ movl(Address(EAX, Closure::tags_offset()), Immediate(tags));
1355 1355
1356 // Initialize the function field in the object. 1356 // Initialize the function field in the object.
1357 // EAX: new closure object. 1357 // EAX: new closure object.
1358 // ECX: new context object (only if is_implicit_closure). 1358 // ECX: new context object (only if is_implicit_closure).
1359 // EBX: next object start. 1359 // EBX: next object start.
1360 __ LoadObject(EDX, func); // Load function of closure to be allocated. 1360 __ LoadObject(EDX, func); // Load function of closure to be allocated.
1361 __ movl(Address(EAX, Closure::function_offset()), EDX); 1361 __ movl(Address(EAX, Closure::function_offset()), EDX);
1362 1362
1363 // Setup the context for this closure. 1363 // Setup the context for this closure.
1364 if (is_implicit_static_closure) { 1364 if (is_implicit_static_closure) {
1365 ObjectStore* object_store = Isolate::Current()->object_store(); 1365 ObjectStore* object_store = Isolate::Current()->object_store();
1366 ASSERT(object_store != NULL); 1366 ASSERT(object_store != NULL);
1367 const Context& empty_context = 1367 const Context& empty_context =
1368 Context::ZoneHandle(object_store->empty_context()); 1368 Context::ZoneHandle(object_store->empty_context());
1369 __ LoadObject(EDX, empty_context); 1369 __ LoadObject(EDX, empty_context);
1370 __ movl(Address(EAX, Closure::context_offset()), EDX); 1370 __ movl(Address(EAX, Closure::context_offset()), EDX);
1371 } else if (is_implicit_instance_closure) { 1371 } else if (is_implicit_instance_closure) {
1372 // Initialize the new context capturing the receiver. 1372 // Initialize the new context capturing the receiver.
1373 1373
1374 // Set the class field to the Context class. 1374 // Set the class field to the Context class.
1375 const Class& context_class = Class::ZoneHandle(Object::context_class()); 1375 const Class& context_class = Class::ZoneHandle(Object::context_class());
1376 __ LoadObject(EBX, context_class); 1376 __ LoadObject(EBX, context_class);
1377 __ movl(Address(ECX, Context::class_offset()), EBX); 1377 __ movl(Address(ECX, Context::class_offset()), EBX);
1378 // Set the tags. 1378 // Set the tags.
1379 uword tags = 0; 1379 uword tags = 0;
1380 tags = RawObject::SizeTag::update(context_size, tags); 1380 tags = RawObject::SizeTag::update(context_size, tags);
1381 tags = RawObject::ClassTag::update(context_class.index(), tags); 1381 tags = RawObject::ClassIdTag::update(context_class.id(), tags);
1382 __ movl(Address(ECX, Context::tags_offset()), Immediate(tags)); 1382 __ movl(Address(ECX, Context::tags_offset()), Immediate(tags));
1383 1383
1384 // Set number of variables field to 1 (for captured receiver). 1384 // Set number of variables field to 1 (for captured receiver).
1385 __ movl(Address(ECX, Context::num_variables_offset()), Immediate(1)); 1385 __ movl(Address(ECX, Context::num_variables_offset()), Immediate(1));
1386 1386
1387 // Set isolate field to isolate of current context. 1387 // Set isolate field to isolate of current context.
1388 __ movl(EDX, FieldAddress(CTX, Context::isolate_offset())); 1388 __ movl(EDX, FieldAddress(CTX, Context::isolate_offset()));
1389 __ movl(Address(ECX, Context::isolate_offset()), EDX); 1389 __ movl(Address(ECX, Context::isolate_offset()), EDX);
1390 1390
1391 // Set the parent field to null. 1391 // Set the parent field to null.
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 // TOS + 2: instance. 1892 // TOS + 2: instance.
1893 // TOS + 3: cache array. 1893 // TOS + 3: cache array.
1894 // Result in ECX: null -> not found, otherwise result (true or false). 1894 // Result in ECX: null -> not found, otherwise result (true or false).
1895 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1895 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1896 GenerateSubtypeNTestCacheStub(assembler, 3); 1896 GenerateSubtypeNTestCacheStub(assembler, 3);
1897 } 1897 }
1898 1898
1899 } // namespace dart 1899 } // namespace dart
1900 1900
1901 #endif // defined TARGET_ARCH_IA32 1901 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698