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

Unified Diff: vm/stub_code_ia32.cc

Issue 9965042: - Add a class index to the classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« vm/raw_object.cc ('K') | « vm/snapshot.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/stub_code_ia32.cc
===================================================================
--- vm/stub_code_ia32.cc (revision 6994)
+++ vm/stub_code_ia32.cc (working copy)
@@ -680,12 +680,15 @@
__ cmpl(ECX, Immediate(RawObject::SizeTag::kMaxSizeTag));
__ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
__ shll(ECX, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2));
- __ movl(FieldAddress(EAX, Array::tags_offset()), ECX);
__ jmp(&done);
__ Bind(&size_tag_overflow);
- __ movl(FieldAddress(EAX, Array::tags_offset()), Immediate(0));
+ __ movl(ECX, Immediate(0));
__ Bind(&done);
+
+ // Get the class index and insert it into the tags.
+ __ orl(ECX, Immediate(RawObject::ClassTag::encode(kArray)));
+ __ movl(FieldAddress(EAX, Array::tags_offset()), ECX);
}
// Initialize all array elements to raw_null.
@@ -1000,13 +1003,19 @@
__ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag));
__ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
__ shll(EBX, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2));
- __ movl(FieldAddress(EAX, Context::tags_offset()), EBX); // Tags.
__ jmp(&done);
__ Bind(&size_tag_overflow);
// Set overflow size tag value.
- __ movl(FieldAddress(EAX, Context::tags_offset()), Immediate(0));
+ __ movl(EBX, Immediate(0));
+
__ Bind(&done);
+ // EAX: new object.
+ // EDX: number of context variables.
+ // EBX: size and bit tags.
+ __ orl(EBX,
+ Immediate(RawObject::ClassTag::encode(context_class.index())));
+ __ movl(FieldAddress(EAX, Context::tags_offset()), EBX); // Tags.
}
// Setup up number of context variables field.
@@ -1163,8 +1172,11 @@
__ LoadObject(EDX, cls); // Load class of object to be allocated.
__ movl(Address(EAX, Instance::class_offset()), EDX);
// Set the tags.
- __ movl(Address(EAX, Instance::tags_offset()),
- Immediate(RawObject::SizeTag::encode(instance_size)));
+ intptr_t tags = 0;
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ ASSERT(cls.index() != kIllegalObjectKind);
+ tags = RawObject::ClassTag::update(cls.index(), tags);
+ __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags));
// Initialize the remaining words of the object.
const Immediate raw_null =
@@ -1313,8 +1325,10 @@
__ LoadObject(EDX, cls); // Load signature class of closure.
__ movl(Address(EAX, Closure::class_offset()), EDX);
// Set the tags.
- __ movl(Address(EAX, Closure::tags_offset()),
- Immediate(RawObject::SizeTag::encode(closure_size)));
+ intptr_t tags = 0;
+ tags = RawObject::SizeTag::update(closure_size, tags);
+ tags = RawObject::ClassTag::update(cls.index(), tags);
+ __ movl(Address(EAX, Closure::tags_offset()), Immediate(tags));
// Initialize the function field in the object.
// EAX: new closure object.
@@ -1335,11 +1349,14 @@
// Initialize the new context capturing the receiver.
// Set the class field to the Context class.
- __ LoadObject(EBX, Class::ZoneHandle(Object::context_class()));
+ const Class& context_class = Class::ZoneHandle(Object::context_class());
+ __ LoadObject(EBX, context_class);
__ movl(Address(ECX, Context::class_offset()), EBX);
// Set the tags.
- __ movl(Address(ECX, Context::tags_offset()),
- Immediate(RawObject::SizeTag::encode(context_size)));
+ intptr_t tags = 0;
+ tags = RawObject::SizeTag::update(context_size, tags);
+ tags = RawObject::ClassTag::update(context_class.index(), tags);
+ __ movl(Address(ECX, Context::tags_offset()), Immediate(tags));
// Set number of variables field to 1 (for captured receiver).
__ movl(Address(ECX, Context::num_variables_offset()), Immediate(1));
« vm/raw_object.cc ('K') | « vm/snapshot.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698