Rename the field type_arguments_instance_field_offset_ to

type_arguments_field_offset_ in preparation for calling it
type_arguments_field_offset_in_words_
Review URL: https://codereview.chromium.org//11316203

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15431 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
asiva@google.com 2012-11-28 01:36:04 +00:00
parent 33478d857f
commit 3b5f530a44
9 changed files with 35 additions and 36 deletions

View file

@ -1886,13 +1886,13 @@ Value* EffectGraphVisitor::BuildInstantiatorTypeArguments(
// The receiver cannot be null; extract its AbstractTypeArguments object.
// Note that in the factory case, the instantiator is the first parameter
// of the factory, i.e. already an AbstractTypeArguments object.
intptr_t type_arguments_instance_field_offset =
instantiator_class.type_arguments_instance_field_offset();
ASSERT(type_arguments_instance_field_offset != Class::kNoTypeArguments);
intptr_t type_arguments_field_offset =
instantiator_class.type_arguments_field_offset();
ASSERT(type_arguments_field_offset != Class::kNoTypeArguments);
return Bind(new LoadFieldInstr(
instantiator,
type_arguments_instance_field_offset,
type_arguments_field_offset,
Type::ZoneHandle())); // Not an instance, no type.
}

View file

@ -559,11 +559,11 @@ bool FlowGraphOptimizer::TryReplaceWithStoreIndexed(InstanceCallInstr* call) {
case kArrayCid:
case kGrowableObjectArrayCid: {
const Class& instantiator_class = Class::Handle(target.Owner());
intptr_t type_arguments_instance_field_offset =
instantiator_class.type_arguments_instance_field_offset();
intptr_t type_arguments_field_offset =
instantiator_class.type_arguments_field_offset();
LoadFieldInstr* load_type_args =
new LoadFieldInstr(array->Copy(),
type_arguments_instance_field_offset,
type_arguments_field_offset,
Type::ZoneHandle()); // No type.
InsertBefore(call, load_type_args, NULL, Definition::kValue);
instantiator = array->Copy();

View file

@ -181,7 +181,7 @@ static intptr_t ComputeObjectArrayTypeArgumentsOffset() {
ASSERT(!cls.IsNull());
ASSERT(cls.HasTypeArguments());
ASSERT(cls.NumTypeArguments() == 1);
const intptr_t field_offset = cls.type_arguments_instance_field_offset();
const intptr_t field_offset = cls.type_arguments_field_offset();
ASSERT(field_offset != Class::kNoTypeArguments);
return field_offset;
}

View file

@ -273,8 +273,7 @@ void Object::InitOnce() {
cls.set_id(Class::kClassId);
cls.raw_ptr()->state_bits_ = 0;
cls.set_is_finalized();
cls.raw_ptr()->type_arguments_instance_field_offset_ =
Class::kNoTypeArguments;
cls.raw_ptr()->type_arguments_field_offset_ = Class::kNoTypeArguments;
cls.raw_ptr()->num_native_fields_ = 0;
cls.InitEmptyFields();
isolate->class_table()->Register(cls);
@ -557,13 +556,13 @@ RawError* Object::Init(Isolate* isolate) {
// Since they are pre-finalized, CalculateFieldOffsets() is not called, so we
// need to set the offset of their type_arguments_ field, which is explicitly
// declared in RawArray.
cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset());
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
// Set up the growable object array class (Has to be done after the array
// class is setup as one of its field is an array object).
cls = Class::New<GrowableObjectArray>();
object_store->set_growable_object_array_class(cls);
cls.set_type_arguments_instance_field_offset(
cls.set_type_arguments_field_offset(
GrowableObjectArray::type_arguments_offset());
// canonical_type_arguments_ are NULL terminated.
@ -634,7 +633,7 @@ RawError* Object::Init(Isolate* isolate) {
cls = Class::New<ImmutableArray>();
object_store->set_immutable_array_class(cls);
cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset());
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
ASSERT(object_store->immutable_array_class() != object_store->array_class());
name = Symbols::ImmutableArray();
RegisterPrivateClass(cls, name, core_lib);
@ -1371,7 +1370,7 @@ RawClass* Class::New() {
// VM backed classes are almost ready: run checks and resolve class
// references, but do not recompute size.
result.set_is_prefinalized();
result.raw_ptr()->type_arguments_instance_field_offset_ = kNoTypeArguments;
result.raw_ptr()->type_arguments_field_offset_ = kNoTypeArguments;
result.raw_ptr()->num_native_fields_ = 0;
result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex;
result.InitEmptyFields();
@ -1525,7 +1524,7 @@ intptr_t Class::NumTypeArguments() const {
bool Class::HasTypeArguments() const {
if (!IsSignatureClass() && (is_finalized() || is_prefinalized())) {
// More efficient than calling NumTypeArguments().
return type_arguments_instance_field_offset() != kNoTypeArguments;
return type_arguments_field_offset() != kNoTypeArguments;
} else {
// No need to check NumTypeArguments() if class has type parameters.
return (NumTypeParameters() > 0) || (NumTypeArguments() > 0);
@ -1624,7 +1623,7 @@ void Class::CalculateFieldOffsets() const {
if (super.IsNull()) {
offset = sizeof(RawObject);
} else {
type_args_field_offset = super.type_arguments_instance_field_offset();
type_args_field_offset = super.type_arguments_field_offset();
offset = super.next_field_offset();
ASSERT(offset > 0);
// We should never call CalculateFieldOffsets for native wrapper
@ -1642,7 +1641,7 @@ void Class::CalculateFieldOffsets() const {
offset += kWordSize;
}
}
set_type_arguments_instance_field_offset(type_args_field_offset);
set_type_arguments_field_offset(type_args_field_offset);
ASSERT(offset != 0);
Field& field = Field::Handle();
intptr_t len = flds.Length();
@ -1791,7 +1790,7 @@ RawClass* Class::New(intptr_t index) {
result.set_next_field_offset(FakeInstance::InstanceSize());
result.set_id(index);
result.raw_ptr()->state_bits_ = 0;
result.raw_ptr()->type_arguments_instance_field_offset_ = kNoTypeArguments;
result.raw_ptr()->type_arguments_field_offset_ = kNoTypeArguments;
result.raw_ptr()->num_native_fields_ = 0;
result.raw_ptr()->token_pos_ = Scanner::kDummyTokenIndex;
result.InitEmptyFields();
@ -1856,7 +1855,7 @@ RawClass* Class::NewSignatureClass(const String& name,
result.set_type_parameters(type_parameters);
result.SetFields(empty_array);
result.SetFunctions(empty_array);
result.set_type_arguments_instance_field_offset(
result.set_type_arguments_field_offset(
Closure::type_arguments_offset());
// Implements interface "Function".
const Type& function_type = Type::Handle(Type::Function());
@ -8223,7 +8222,7 @@ RawType* Instance::GetType() const {
RawAbstractTypeArguments* Instance::GetTypeArguments() const {
const Class& cls = Class::Handle(clazz());
intptr_t field_offset = cls.type_arguments_instance_field_offset();
intptr_t field_offset = cls.type_arguments_field_offset();
ASSERT(field_offset != Class::kNoTypeArguments);
AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle();
type_arguments ^= *FieldAddrAtOffset(field_offset);
@ -8233,7 +8232,7 @@ RawAbstractTypeArguments* Instance::GetTypeArguments() const {
void Instance::SetTypeArguments(const AbstractTypeArguments& value) const {
const Class& cls = Class::Handle(clazz());
intptr_t field_offset = cls.type_arguments_instance_field_offset();
intptr_t field_offset = cls.type_arguments_field_offset();
ASSERT(field_offset != Class::kNoTypeArguments);
SetFieldAtOffset(field_offset, value);
}

View file

@ -540,15 +540,15 @@ class Class : public Object {
// If this class is parameterized, each instance has a type_arguments field.
static const intptr_t kNoTypeArguments = -1;
intptr_t type_arguments_instance_field_offset() const {
intptr_t type_arguments_field_offset() const {
ASSERT(is_finalized() || is_prefinalized());
return raw_ptr()->type_arguments_instance_field_offset_;
return raw_ptr()->type_arguments_field_offset_;
}
void set_type_arguments_instance_field_offset(intptr_t value) const {
raw_ptr()->type_arguments_instance_field_offset_ = value;
void set_type_arguments_field_offset(intptr_t value) const {
raw_ptr()->type_arguments_field_offset_ = value;
}
static intptr_t type_arguments_instance_field_offset_offset() {
return OFFSET_OF(RawClass, type_arguments_instance_field_offset_);
static intptr_t type_arguments_field_offset_offset() {
return OFFSET_OF(RawClass, type_arguments_field_offset_);
}
// The super type of this class, Object type if not explicitly specified.

View file

@ -435,7 +435,7 @@ class RawClass : public RawObject {
cpp_vtable handle_vtable_;
intptr_t instance_size_; // Size if fixed length or 0 if variable length.
intptr_t id_; // Class Id, also index in the class table.
intptr_t type_arguments_instance_field_offset_; // May be kNoTypeArguments.
intptr_t type_arguments_field_offset_; // Offset of the type arguments field.
intptr_t next_field_offset_; // Offset of the next instance field.
intptr_t num_native_fields_; // Number of native fields in class.
intptr_t token_pos_;

View file

@ -58,7 +58,7 @@ RawClass* Class::ReadFrom(SnapshotReader* reader,
// Set all non object fields.
cls.set_instance_size(reader->ReadIntptrValue());
cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue());
cls.set_type_arguments_field_offset(reader->ReadIntptrValue());
cls.set_next_field_offset(reader->ReadIntptrValue());
cls.set_num_native_fields(reader->ReadIntptrValue());
cls.set_token_pos(reader->ReadIntptrValue());
@ -97,7 +97,7 @@ void RawClass::WriteTo(SnapshotWriter* writer,
// NOTE: cpp_vtable_ is not written.
writer->WriteIntptrValue(ptr()->id_);
writer->WriteIntptrValue(ptr()->instance_size_);
writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_);
writer->WriteIntptrValue(ptr()->type_arguments_field_offset_);
writer->WriteIntptrValue(ptr()->next_field_offset_);
writer->WriteIntptrValue(ptr()->num_native_fields_);
writer->WriteIntptrValue(ptr()->token_pos_);

View file

@ -1114,7 +1114,7 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
Immediate(reinterpret_cast<intptr_t>(Object::null()));
// The generated code is different if the class is parameterized.
const bool is_cls_parameterized =
cls.type_arguments_instance_field_offset() != Class::kNoTypeArguments;
cls.type_arguments_field_offset() != Class::kNoTypeArguments;
// kInlineInstanceSize is a constant used as a threshold for determining
// when the object initialization should be done as a loop or as
// straight line code.
@ -1239,7 +1239,7 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
if (is_cls_parameterized) {
// EDI: new object type arguments.
// Set the type arguments in the new object.
__ movl(Address(EAX, cls.type_arguments_instance_field_offset()), EDI);
__ movl(Address(EAX, cls.type_arguments_field_offset()), EDI);
}
// Done allocating and initializing the instance.
// EAX: new object.
@ -1881,7 +1881,7 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
Label has_no_type_arguments;
__ movl(EBX, raw_null);
__ movl(EDI, FieldAddress(ECX,
Class::type_arguments_instance_field_offset_offset()));
Class::type_arguments_field_offset_offset()));
__ cmpl(EDI, Immediate(Class::kNoTypeArguments));
__ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump);
__ movl(EBX, FieldAddress(EAX, EDI, TIMES_1, 0));

View file

@ -1094,7 +1094,7 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
Immediate(reinterpret_cast<intptr_t>(Object::null()));
// The generated code is different if the class is parameterized.
const bool is_cls_parameterized =
cls.type_arguments_instance_field_offset() != Class::kNoTypeArguments;
cls.type_arguments_field_offset() != Class::kNoTypeArguments;
// kInlineInstanceSize is a constant used as a threshold for determining
// when the object initialization should be done as a loop or as
// straight line code.
@ -1222,7 +1222,7 @@ void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
if (is_cls_parameterized) {
// RDI: new object type arguments.
// Set the type arguments in the new object.
__ movq(Address(RAX, cls.type_arguments_instance_field_offset()), RDI);
__ movq(Address(RAX, cls.type_arguments_field_offset()), RDI);
}
// Done allocating and initializing the instance.
// RAX: new object.
@ -1845,7 +1845,7 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
Label has_no_type_arguments;
__ movq(R13, raw_null);
__ movq(RDI, FieldAddress(R10,
Class::type_arguments_instance_field_offset_offset()));
Class::type_arguments_field_offset_offset()));
__ cmpq(RDI, Immediate(Class::kNoTypeArguments));
__ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump);
__ movq(R13, FieldAddress(RAX, RDI, TIMES_1, 0));