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

Unified Diff: vm/object.cc

Issue 10827209: Unify class ids and snapshot object ids list so that we don't have disparate and sometimes confusin… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « vm/object.h ('k') | vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.cc
===================================================================
--- vm/object.cc (revision 10409)
+++ vm/object.cc (working copy)
@@ -49,7 +49,7 @@
static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
cpp_vtable Object::handle_vtable_ = 0;
-cpp_vtable Object::builtin_vtables_[kNumPredefinedKinds] = { 0 };
+cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 };
cpp_vtable Smi::handle_vtable_ = 0;
// These are initialized to a value that will force a illegal memory access if
@@ -185,152 +185,43 @@
}
-int Object::GetSingletonClassIndex(const RawClass* raw_class) {
- ASSERT(raw_class->IsHeapObject());
- if (raw_class == class_class()) {
- return kClassClass;
- } else if (raw_class == null_class()) {
- return kNullClass;
- } else if (raw_class == dynamic_class()) {
- return kDynamicClass;
- } else if (raw_class == void_class()) {
- return kVoidClass;
- } else if (raw_class == unresolved_class_class()) {
- return kUnresolvedClassClass;
- } else if (raw_class == type_class()) {
- return kTypeClass;
- } else if (raw_class == type_parameter_class()) {
- return kTypeParameterClass;
- } else if (raw_class == type_arguments_class()) {
- return kTypeArgumentsClass;
- } else if (raw_class == instantiated_type_arguments_class()) {
- return kInstantiatedTypeArgumentsClass;
- } else if (raw_class == function_class()) {
- return kFunctionClass;
- } else if (raw_class == field_class()) {
- return kFieldClass;
- } else if (raw_class == literal_token_class()) {
- return kLiteralTokenClass;
- } else if (raw_class == token_stream_class()) {
- return kTokenStreamClass;
- } else if (raw_class == script_class()) {
- return kScriptClass;
- } else if (raw_class == library_class()) {
- return kLibraryClass;
- } else if (raw_class == library_prefix_class()) {
- return kLibraryPrefixClass;
- } else if (raw_class == code_class()) {
- return kCodeClass;
- } else if (raw_class == instructions_class()) {
- return kInstructionsClass;
- } else if (raw_class == pc_descriptors_class()) {
- return kPcDescriptorsClass;
- } else if (raw_class == stackmap_class()) {
- return kStackmapClass;
- } else if (raw_class == var_descriptors_class()) {
- return kLocalVarDescriptorsClass;
- } else if (raw_class == exception_handlers_class()) {
- return kExceptionHandlersClass;
- } else if (raw_class == deopt_info_class()) {
- return kDeoptInfoClass;
- } else if (raw_class == context_class()) {
- return kContextClass;
- } else if (raw_class == context_scope_class()) {
- return kContextScopeClass;
- } else if (raw_class == icdata_class()) {
- return kICDataClass;
- } else if (raw_class == subtypetestcache_class()) {
- return kSubtypeTestCacheClass;
- } else if (raw_class == api_error_class()) {
- return kApiErrorClass;
- } else if (raw_class == language_error_class()) {
- return kLanguageErrorClass;
- } else if (raw_class == unhandled_exception_class()) {
- return kUnhandledExceptionClass;
- } else if (raw_class == unwind_error_class()) {
- return kUnwindErrorClass;
- }
- return kInvalidIndex;
-}
-
-
-RawClass* Object::GetSingletonClass(int index) {
- switch (index) {
- case kClassClass: return class_class();
- case kNullClass: return null_class();
- case kDynamicClass: return dynamic_class();
- case kVoidClass: return void_class();
- case kUnresolvedClassClass: return unresolved_class_class();
- case kTypeClass: return type_class();
- case kTypeParameterClass: return type_parameter_class();
- case kTypeArgumentsClass: return type_arguments_class();
- case kInstantiatedTypeArgumentsClass:
- return instantiated_type_arguments_class();
- case kFunctionClass: return function_class();
- case kFieldClass: return field_class();
- case kLiteralTokenClass: return literal_token_class();
- case kTokenStreamClass: return token_stream_class();
- case kScriptClass: return script_class();
- case kLibraryClass: return library_class();
- case kLibraryPrefixClass: return library_prefix_class();
- case kCodeClass: return code_class();
- case kInstructionsClass: return instructions_class();
- case kPcDescriptorsClass: return pc_descriptors_class();
- case kStackmapClass: return stackmap_class();
- case kLocalVarDescriptorsClass: return var_descriptors_class();
- case kExceptionHandlersClass: return exception_handlers_class();
- case kDeoptInfoClass: return deopt_info_class();
- case kContextClass: return context_class();
- case kContextScopeClass: return context_scope_class();
- case kICDataClass: return icdata_class();
- case kSubtypeTestCacheClass: return subtypetestcache_class();
- case kApiErrorClass: return api_error_class();
- case kLanguageErrorClass: return language_error_class();
- case kUnhandledExceptionClass: return unhandled_exception_class();
- case kUnwindErrorClass: return unwind_error_class();
+// TODO(asiva): Get rid of this function once we have predefined names for
+// the shared classes and set that up in the name field.
+const char* Object::GetSingletonClassName(intptr_t class_id) {
+ switch (class_id) {
+ case kClassCid: return "Class";
+ case kNullCid: return "Null";
+ case kDynamicCid: return "Dynamic";
+ case kVoidCid: return "void";
+ case kUnresolvedClassCid: return "UnresolvedClass";
+ case kTypeCid: return "Type";
+ case kTypeParameterCid: return "TypeParameter";
+ case kTypeArgumentsCid: return "TypeArguments";
+ case kInstantiatedTypeArgumentsCid: return "InstantiatedTypeArguments";
+ case kFunctionCid: return "Function";
+ case kFieldCid: return "Field";
+ case kLiteralTokenCid: return "LiteralToken";
+ case kTokenStreamCid: return "TokenStream";
+ case kScriptCid: return "Script";
+ case kLibraryCid: return "Library";
+ case kLibraryPrefixCid: return "LibraryPrefix";
+ case kCodeCid: return "Code";
+ case kInstructionsCid: return "Instructions";
+ case kPcDescriptorsCid: return "PcDescriptors";
+ case kStackmapCid: return "Stackmap";
+ case kLocalVarDescriptorsCid: return "LocalVarDescriptors";
+ case kExceptionHandlersCid: return "ExceptionHandlers";
+ case kContextCid: return "Context";
+ case kContextScopeCid: return "ContextScope";
+ case kICDataCid: return "ICData";
+ case kSubtypeTestCacheCid: return "SubtypeTestCache";
+ case kApiErrorCid: return "ApiError";
+ case kLanguageErrorCid: return "LanguageError";
+ case kUnhandledExceptionCid: return "UnhandledException";
+ case kUnwindErrorCid: return "UnwindError";
default: break;
}
UNREACHABLE();
- return reinterpret_cast<RawClass*>(kHeapObjectTag); // return RAW_NULL.
-}
-
-
-const char* Object::GetSingletonClassName(int index) {
- switch (index) {
- case kClassClass: return "Class";
- case kNullClass: return "Null";
- case kDynamicClass: return "Dynamic";
- case kVoidClass: return "void";
- case kUnresolvedClassClass: return "UnresolvedClass";
- case kTypeClass: return "Type";
- case kTypeParameterClass: return "TypeParameter";
- case kTypeArgumentsClass: return "TypeArguments";
- case kInstantiatedTypeArgumentsClass: return "InstantiatedTypeArguments";
- case kFunctionClass: return "Function";
- case kFieldClass: return "Field";
- case kLiteralTokenClass: return "LiteralToken";
- case kTokenStreamClass: return "TokenStream";
- case kScriptClass: return "Script";
- case kLibraryClass: return "Library";
- case kLibraryPrefixClass: return "LibraryPrefix";
- case kCodeClass: return "Code";
- case kInstructionsClass: return "Instructions";
- case kPcDescriptorsClass: return "PcDescriptors";
- case kStackmapClass: return "Stackmap";
- case kLocalVarDescriptorsClass: return "LocalVarDescriptors";
- case kExceptionHandlersClass: return "ExceptionHandlers";
- case kDeoptInfoClass: return "DeoptInfo";
- case kContextClass: return "Context";
- case kContextScopeClass: return "ContextScope";
- case kICDataClass: return "ICData";
- case kSubtypeTestCacheClass: return "SubtypeTestCache";
- case kApiErrorClass: return "ApiError";
- case kLanguageErrorClass: return "LanguageError";
- case kUnhandledExceptionClass: return "UnhandledException";
- case kUnwindErrorClass: return "UnwindError";
- default: break;
- }
- UNREACHABLE();
return NULL;
}
@@ -355,7 +246,7 @@
uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld);
null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag);
// The call below is using 'null_' to initialize itself.
- InitializeObject(address, kNullClassId, Instance::InstanceSize());
+ InitializeObject(address, kNullCid, Instance::InstanceSize());
}
// Initialize object_store empty array to null_ in order to be able to check
@@ -369,7 +260,7 @@
intptr_t size = Class::InstanceSize();
uword address = heap->Allocate(size, Heap::kOld);
class_class_ = reinterpret_cast<RawClass*>(address + kHeapObjectTag);
- InitializeObject(address, Class::kInstanceKind, size);
+ InitializeObject(address, Class::kClassId, size);
Class fake;
// Initialization from Class::New<Class>.
@@ -379,8 +270,7 @@
cls.set_handle_vtable(fake.vtable());
cls.set_instance_size(Class::InstanceSize());
cls.set_next_field_offset(Class::InstanceSize());
- cls.set_instance_kind(Class::kInstanceKind);
- cls.set_id(Class::kInstanceKind);
+ cls.set_id(Class::kClassId);
cls.raw_ptr()->is_const_ = false;
cls.raw_ptr()->is_interface_ = false;
cls.set_is_finalized();
@@ -392,7 +282,7 @@
}
// Allocate and initialize the null class.
- cls = Class::New<Instance>(kNullClassId);
+ cls = Class::New<Instance>(kNullCid);
cls.set_is_finalized();
null_class_ = cls.raw();
@@ -404,24 +294,24 @@
{
Instance& sentinel = Instance::Handle();
sentinel ^=
- Object::Allocate(kNullClassId, Instance::InstanceSize(), Heap::kOld);
+ Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld);
sentinel_ = sentinel.raw();
Instance& transition_sentinel = Instance::Handle();
transition_sentinel ^=
- Object::Allocate(kNullClassId, Instance::InstanceSize(), Heap::kOld);
+ Object::Allocate(kNullCid, Instance::InstanceSize(), Heap::kOld);
transition_sentinel_ = transition_sentinel.raw();
}
// The interface "Dynamic" is not a VM internal class. It is the type class of
// the "unknown type". For efficiency, we allocate it in the VM isolate.
// Therefore, it cannot have a heap allocated name (the name is hard coded,
- // see GetSingletonClassIndex) and its array fields cannot be set to the empty
+ // see GetSingletonClassName) and its array fields cannot be set to the empty
// array, but remain null.
//
// TODO(turnidge): Once the empty array is allocated in the vm
// isolate, use it here.
- cls = Class::New<Instance>(kDynamicClassId);
+ cls = Class::New<Instance>(kDynamicCid);
cls.set_is_finalized();
cls.set_is_interface();
dynamic_class_ = cls.raw();
@@ -430,7 +320,7 @@
cls = Class::New<UnresolvedClass>();
unresolved_class_class_ = cls.raw();
- cls = Class::New<Instance>(kVoidClassId);
+ cls = Class::New<Instance>(kVoidCid);
cls.set_is_finalized();
void_class_ = cls.raw();
@@ -521,9 +411,6 @@
isolate->object_store()->set_array_class(cls);
cls = Class::New<OneByteString>();
isolate->object_store()->set_one_byte_string_class(cls);
-
- // TODO(asiva): Assign the names of shared classes instead of relying on the
- // lookup switch in Object::GetSingletonClassName.
}
@@ -1074,7 +961,7 @@
}
-void Object::InitializeObject(uword address, intptr_t index, intptr_t size) {
+void Object::InitializeObject(uword address, intptr_t class_id, intptr_t size) {
// TODO(iposva): Get a proper halt instruction from the assembler which
// would be needed here for code objects.
uword initial_value = reinterpret_cast<uword>(null_);
@@ -1085,8 +972,8 @@
cur += kWordSize;
}
uword tags = 0;
- ASSERT(index != kIllegalObjectKind);
- tags = RawObject::ClassIdTag::update(index, tags);
+ ASSERT(class_id != kIllegalCid);
+ tags = RawObject::ClassIdTag::update(class_id, tags);
tags = RawObject::SizeTag::update(size, tags);
reinterpret_cast<RawObject*>(address)->tags_ = tags;
}
@@ -1154,8 +1041,7 @@
return raw_ptr()->name_;
}
ASSERT(class_class() != Class::null()); // class_class_ should be set up.
- intptr_t index = GetSingletonClassIndex(raw());
- return Symbols::New(GetSingletonClassName(index));
+ return Symbols::New(GetSingletonClassName(raw_ptr()->id_));
}
@@ -1164,55 +1050,55 @@
return Name();
}
switch (id()) {
- case kInteger:
- case kSmi:
- case kMint:
- case kBigint:
+ case kIntegerCid:
+ case kSmiCid:
+ case kMintCid:
+ case kBigintCid:
return Symbols::New("int");
- case kDouble:
+ case kDoubleCid:
return Symbols::New("double");
- case kOneByteString:
- case kTwoByteString:
- case kFourByteString:
- case kExternalOneByteString:
- case kExternalTwoByteString:
- case kExternalFourByteString:
+ case kOneByteStringCid:
+ case kTwoByteStringCid:
+ case kFourByteStringCid:
+ case kExternalOneByteStringCid:
+ case kExternalTwoByteStringCid:
+ case kExternalFourByteStringCid:
return Symbols::New("String");
- case kBool:
+ case kBoolCid:
return Symbols::New("bool");
- case kArray:
- case kImmutableArray:
- case kGrowableObjectArray:
+ case kArrayCid:
+ case kImmutableArrayCid:
+ case kGrowableObjectArrayCid:
return Symbols::New("List");
- case kInt8Array:
- case kExternalInt8Array:
+ case kInt8ArrayCid:
+ case kExternalInt8ArrayCid:
return Symbols::New("Int8List");
- case kUint8Array:
- case kExternalUint8Array:
+ case kUint8ArrayCid:
+ case kExternalUint8ArrayCid:
return Symbols::New("Uint8List");
- case kInt16Array:
- case kExternalInt16Array:
+ case kInt16ArrayCid:
+ case kExternalInt16ArrayCid:
return Symbols::New("Int16List");
- case kUint16Array:
- case kExternalUint16Array:
+ case kUint16ArrayCid:
+ case kExternalUint16ArrayCid:
return Symbols::New("Uint16List");
- case kInt32Array:
- case kExternalInt32Array:
+ case kInt32ArrayCid:
+ case kExternalInt32ArrayCid:
return Symbols::New("Int32List");
- case kUint32Array:
- case kExternalUint32Array:
+ case kUint32ArrayCid:
+ case kExternalUint32ArrayCid:
return Symbols::New("Uint32List");
- case kInt64Array:
- case kExternalInt64Array:
+ case kInt64ArrayCid:
+ case kExternalInt64ArrayCid:
return Symbols::New("Int64List");
- case kUint64Array:
- case kExternalUint64Array:
+ case kUint64ArrayCid:
+ case kExternalUint64ArrayCid:
return Symbols::New("Uint64List");
- case kFloat32Array:
- case kExternalFloat32Array:
+ case kFloat32ArrayCid:
+ case kExternalFloat32ArrayCid:
return Symbols::New("Float32List");
- case kFloat64Array:
- case kExternalFloat64Array:
+ case kFloat64ArrayCid:
+ case kExternalFloat64ArrayCid:
return Symbols::New("Float64List");
default:
const String& name = String::Handle(Name());
@@ -1267,7 +1153,7 @@
ASSERT(Object::class_class() != Class::null());
Class& result = Class::Handle();
{
- RawObject* raw = Object::Allocate(Class::kInstanceKind,
+ RawObject* raw = Object::Allocate(Class::kClassId,
Class::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -1277,9 +1163,9 @@
result.set_handle_vtable(fake.vtable());
result.set_instance_size(FakeObject::InstanceSize());
result.set_next_field_offset(FakeObject::InstanceSize());
- result.set_instance_kind(FakeObject::kInstanceKind);
- result.set_id((FakeObject::kInstanceKind != kInstance) ?
- FakeObject::kInstanceKind : kIllegalObjectKind);
+ result.set_id((FakeObject::kClassId != kInstanceCid &&
+ FakeObject::kClassId != kClosureCid) ?
+ FakeObject::kClassId : kIllegalCid);
result.raw_ptr()->is_const_ = false;
result.raw_ptr()->is_interface_ = false;
// VM backed classes are almost ready: run checks and resolve class
@@ -1604,7 +1490,7 @@
ASSERT(Object::class_class() != Class::null());
Class& result = Class::Handle();
{
- RawObject* raw = Object::Allocate(Class::kInstanceKind,
+ RawObject* raw = Object::Allocate(Class::kClassId,
Class::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -1615,7 +1501,6 @@
result.set_handle_vtable(fake.vtable());
result.set_instance_size(FakeInstance::InstanceSize());
result.set_next_field_offset(FakeInstance::InstanceSize());
- result.set_instance_kind(FakeInstance::kInstanceKind);
result.set_id(index);
result.raw_ptr()->is_const_ = false;
result.raw_ptr()->is_interface_ = false;
@@ -1632,7 +1517,7 @@
RawClass* Class::New(const String& name,
const Script& script,
intptr_t token_pos) {
- Class& result = Class::Handle(New<FakeInstance>(kIllegalObjectKind));
+ Class& result = Class::Handle(New<FakeInstance>(kIllegalCid));
result.set_name(name);
result.set_script(script);
result.set_token_pos(token_pos);
@@ -1713,128 +1598,18 @@
}
-RawClass* Class::GetClass(ObjectKind kind) {
- ObjectStore* object_store = Isolate::Current()->object_store();
- switch (kind) {
- case kInteger:
- ASSERT(object_store->integer_implementation_class() != Class::null());
- return object_store->integer_implementation_class();
- case kSmi:
- ASSERT(object_store->smi_class() != Class::null());
- return object_store->smi_class();
- case kMint:
- ASSERT(object_store->mint_class() != Class::null());
- return object_store->mint_class();
- case kBigint:
- ASSERT(object_store->bigint_class() != Class::null());
- return object_store->bigint_class();
- case kDouble:
- ASSERT(object_store->double_class() != Class::null());
- return object_store->double_class();
- case kOneByteString:
- ASSERT(object_store->one_byte_string_class() != Class::null());
- return object_store->one_byte_string_class();
- case kTwoByteString:
- ASSERT(object_store->two_byte_string_class() != Class::null());
- return object_store->two_byte_string_class();
- case kFourByteString:
- ASSERT(object_store->four_byte_string_class() != Class::null());
- return object_store->four_byte_string_class();
- case kExternalOneByteString:
- ASSERT(object_store->external_one_byte_string_class() != Class::null());
- return object_store->external_one_byte_string_class();
- case kExternalTwoByteString:
- ASSERT(object_store->external_two_byte_string_class() != Class::null());
- return object_store->external_two_byte_string_class();
- case kExternalFourByteString:
- ASSERT(object_store->external_four_byte_string_class() != Class::null());
- return object_store->external_four_byte_string_class();
- case kBool:
- ASSERT(object_store->bool_class() != Class::null());
- return object_store->bool_class();
- case kArray:
- ASSERT(object_store->array_class() != Class::null());
- return object_store->array_class();
- case kImmutableArray:
- ASSERT(object_store->immutable_array_class() != Class::null());
- return object_store->immutable_array_class();
- case kGrowableObjectArray:
- ASSERT(object_store->growable_object_array_class() != Class::null());
- return object_store->growable_object_array_class();
- case kInt8Array:
- ASSERT(object_store->int8_array_class() != Class::null());
- return object_store->int8_array_class();
- case kUint8Array:
- ASSERT(object_store->uint8_array_class() != Class::null());
- return object_store->uint8_array_class();
- case kInt16Array:
- ASSERT(object_store->int16_array_class() != Class::null());
- return object_store->int16_array_class();
- case kUint16Array:
- ASSERT(object_store->uint16_array_class() != Class::null());
- return object_store->uint16_array_class();
- case kInt32Array:
- ASSERT(object_store->int32_array_class() != Class::null());
- return object_store->int32_array_class();
- case kUint32Array:
- ASSERT(object_store->uint32_array_class() != Class::null());
- return object_store->uint32_array_class();
- case kInt64Array:
- ASSERT(object_store->int64_array_class() != Class::null());
- return object_store->int64_array_class();
- case kUint64Array:
- ASSERT(object_store->uint64_array_class() != Class::null());
- return object_store->uint64_array_class();
- case kFloat32Array:
- ASSERT(object_store->float32_array_class() != Class::null());
- return object_store->float32_array_class();
- case kFloat64Array:
- ASSERT(object_store->float64_array_class() != Class::null());
- return object_store->float64_array_class();
- case kExternalInt8Array:
- ASSERT(object_store->external_int8_array_class() != Class::null());
- return object_store->external_int8_array_class();
- case kExternalUint8Array:
- ASSERT(object_store->external_uint8_array_class() != Class::null());
- return object_store->external_uint8_array_class();
- case kExternalInt16Array:
- ASSERT(object_store->external_int16_array_class() != Class::null());
- return object_store->external_int16_array_class();
- case kExternalUint16Array:
- ASSERT(object_store->external_uint16_array_class() != Class::null());
- return object_store->external_uint16_array_class();
- case kExternalInt32Array:
- ASSERT(object_store->external_int32_array_class() != Class::null());
- return object_store->external_int32_array_class();
- case kExternalUint32Array:
- ASSERT(object_store->external_uint32_array_class() != Class::null());
- return object_store->external_uint32_array_class();
- case kExternalInt64Array:
- ASSERT(object_store->external_int64_array_class() != Class::null());
- return object_store->external_int64_array_class();
- case kExternalUint64Array:
- ASSERT(object_store->external_uint64_array_class() != Class::null());
- return object_store->external_uint64_array_class();
- case kExternalFloat32Array:
- ASSERT(object_store->external_float32_array_class() != Class::null());
- return object_store->external_float32_array_class();
- case kExternalFloat64Array:
- ASSERT(object_store->external_float64_array_class() != Class::null());
- return object_store->external_float64_array_class();
- case kStacktrace:
- ASSERT(object_store->stacktrace_class() != Class::null());
- return object_store->stacktrace_class();
- case kJSRegExp:
- ASSERT(object_store->jsregexp_class() != Class::null());
- return object_store->jsregexp_class();
- case kClosure:
+RawClass* Class::GetClass(intptr_t class_id, bool is_signature_class) {
+ if (class_id >= kIntegerCid && class_id <= kJSRegExpCid) {
+ return Isolate::Current()->class_table()->At(class_id);
+ }
+ if (class_id >= kNumPredefinedCids) {
+ if (is_signature_class) {
return Class::New<Closure>();
- case kInstance:
- return Class::New<Instance>();
- default:
- OS::Print("Class::GetClass kind unknown: %d\n", kind);
- UNREACHABLE();
+ }
+ return Class::New<Instance>();
}
+ OS::Print("Class::GetClass id unknown: %d\n", class_id);
+ UNREACHABLE();
return Class::null();
}
@@ -2327,7 +2102,7 @@
RawUnresolvedClass* UnresolvedClass::New() {
ASSERT(Object::unresolved_class_class() != Class::null());
- RawObject* raw = Object::Allocate(UnresolvedClass::kInstanceKind,
+ RawObject* raw = Object::Allocate(UnresolvedClass::kClassId,
UnresolvedClass::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawUnresolvedClass*>(raw);
@@ -2976,7 +2751,7 @@
RawType* Type::New(Heap::Space space) {
ASSERT(Object::type_class() != Class::null());
- RawObject* raw = Object::Allocate(Type::kInstanceKind,
+ RawObject* raw = Object::Allocate(Type::kClassId,
Type::InstanceSize(),
space);
return reinterpret_cast<RawType*>(raw);
@@ -3135,7 +2910,7 @@
RawTypeParameter* TypeParameter::New() {
ASSERT(Object::type_parameter_class() != Class::null());
- RawObject* raw = Object::Allocate(TypeParameter::kInstanceKind,
+ RawObject* raw = Object::Allocate(TypeParameter::kClassId,
TypeParameter::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawTypeParameter*>(raw);
@@ -3558,7 +3333,7 @@
}
TypeArguments& result = TypeArguments::Handle();
{
- RawObject* raw = Object::Allocate(TypeArguments::kInstanceKind,
+ RawObject* raw = Object::Allocate(TypeArguments::kClassId,
TypeArguments::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -3678,7 +3453,7 @@
RawInstantiatedTypeArguments* InstantiatedTypeArguments::New() {
ASSERT(Object::instantiated_type_arguments_class() != Class::null());
- RawObject* raw = Object::Allocate(InstantiatedTypeArguments::kInstanceKind,
+ RawObject* raw = Object::Allocate(InstantiatedTypeArguments::kClassId,
InstantiatedTypeArguments::InstanceSize(),
Heap::kNew);
return reinterpret_cast<RawInstantiatedTypeArguments*>(raw);
@@ -4206,7 +3981,7 @@
RawFunction* Function::New() {
ASSERT(Object::function_class() != Class::null());
- RawObject* raw = Object::Allocate(Function::kInstanceKind,
+ RawObject* raw = Object::Allocate(Function::kClassId,
Function::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawFunction*>(raw);
@@ -4610,7 +4385,7 @@
RawField* Field::New() {
ASSERT(Object::field_class() != Class::null());
- RawObject* raw = Object::Allocate(Field::kInstanceKind,
+ RawObject* raw = Object::Allocate(Field::kClassId,
Field::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawField*>(raw);
@@ -4676,7 +4451,7 @@
RawLiteralToken* LiteralToken::New() {
ASSERT(Object::literal_token_class() != Class::null());
- RawObject* raw = Object::Allocate(LiteralToken::kInstanceKind,
+ RawObject* raw = Object::Allocate(LiteralToken::kClassId,
LiteralToken::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawLiteralToken*>(raw);
@@ -4862,7 +4637,7 @@
}
TokenStream& result = TokenStream::Handle();
{
- RawObject* raw = Object::Allocate(TokenStream::kInstanceKind,
+ RawObject* raw = Object::Allocate(TokenStream::kClassId,
TokenStream::InstanceSize(len),
Heap::kOld);
NoGCScope no_gc;
@@ -5359,7 +5134,7 @@
RawScript* Script::New() {
ASSERT(Object::script_class() != Class::null());
- RawObject* raw = Object::Allocate(Script::kInstanceKind,
+ RawObject* raw = Object::Allocate(Script::kClassId,
Script::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawScript*>(raw);
@@ -6184,7 +5959,7 @@
RawLibrary* Library::New() {
ASSERT(Object::library_class() != Class::null());
- RawObject* raw = Object::Allocate(Library::kInstanceKind,
+ RawObject* raw = Object::Allocate(Library::kClassId,
Library::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawLibrary*>(raw);
@@ -6511,7 +6286,7 @@
RawLibraryPrefix* LibraryPrefix::New() {
ASSERT(Object::library_prefix_class() != Class::null());
- RawObject* raw = Object::Allocate(LibraryPrefix::kInstanceKind,
+ RawObject* raw = Object::Allocate(LibraryPrefix::kClassId,
LibraryPrefix::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawLibraryPrefix*>(raw);
@@ -6643,7 +6418,7 @@
Instructions& result = Instructions::Handle();
{
uword aligned_size = Instructions::InstanceSize(size);
- RawObject* raw = Object::Allocate(Instructions::kInstanceKind,
+ RawObject* raw = Object::Allocate(Instructions::kClassId,
aligned_size,
Heap::kCode);
NoGCScope no_gc;
@@ -6740,7 +6515,7 @@
PcDescriptors& result = PcDescriptors::Handle();
{
uword size = PcDescriptors::InstanceSize(num_descriptors);
- RawObject* raw = Object::Allocate(PcDescriptors::kInstanceKind,
+ RawObject* raw = Object::Allocate(PcDescriptors::kClassId,
size,
Heap::kOld);
NoGCScope no_gc;
@@ -6875,7 +6650,7 @@
{
// Stackmap data objects are associated with a code object, allocate them
// in old generation.
- RawObject* raw = Object::Allocate(Stackmap::kInstanceKind,
+ RawObject* raw = Object::Allocate(Stackmap::kClassId,
Stackmap::InstanceSize(size),
Heap::kOld);
NoGCScope no_gc;
@@ -6970,7 +6745,7 @@
LocalVarDescriptors& result = LocalVarDescriptors::Handle();
{
uword size = LocalVarDescriptors::InstanceSize(num_variables);
- RawObject* raw = Object::Allocate(LocalVarDescriptors::kInstanceKind,
+ RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId,
size,
Heap::kOld);
NoGCScope no_gc;
@@ -7031,7 +6806,7 @@
ExceptionHandlers& result = ExceptionHandlers::Handle();
{
uword size = ExceptionHandlers::InstanceSize(num_handlers);
- RawObject* raw = Object::Allocate(ExceptionHandlers::kInstanceKind,
+ RawObject* raw = Object::Allocate(ExceptionHandlers::kClassId,
size,
Heap::kOld);
NoGCScope no_gc;
@@ -7115,7 +6890,7 @@
DeoptInfo& result = DeoptInfo::Handle();
{
uword size = DeoptInfo::InstanceSize(num_commands);
- RawObject* raw = Object::Allocate(DeoptInfo::kInstanceKind,
+ RawObject* raw = Object::Allocate(DeoptInfo::kClassId,
size,
Heap::kOld);
NoGCScope no_gc;
@@ -7228,7 +7003,7 @@
Code& result = Code::Handle();
{
uword size = Code::InstanceSize(pointer_offsets_length);
- RawObject* raw = Object::Allocate(Code::kInstanceKind, size, Heap::kOld);
+ RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.set_pointer_offsets_length(pointer_offsets_length);
@@ -7466,7 +7241,7 @@
}
Context& result = Context::Handle();
{
- RawObject* raw = Object::Allocate(Context::kInstanceKind,
+ RawObject* raw = Object::Allocate(Context::kClassId,
Context::InstanceSize(num_variables),
space);
NoGCScope no_gc;
@@ -7493,7 +7268,7 @@
intptr_t size = ContextScope::InstanceSize(num_variables);
ContextScope& result = ContextScope::Handle();
{
- RawObject* raw = Object::Allocate(ContextScope::kInstanceKind,
+ RawObject* raw = Object::Allocate(ContextScope::kClassId,
size,
Heap::kOld);
NoGCScope no_gc;
@@ -7620,7 +7395,7 @@
void ICData::WriteSentinel() const {
- const Smi& sentinel_value = Smi::Handle(Smi::New(kIllegalObjectKind));
+ const Smi& sentinel_value = Smi::Handle(Smi::New(kIllegalCid));
const Array& data = Array::Handle(ic_data());
for (intptr_t i = 1; i <= TestEntryLength(); i++) {
data.SetAt(data.Length() - i, sentinel_value);
@@ -7640,8 +7415,8 @@
WriteSentinel();
intptr_t data_pos = old_num * TestEntryLength();
for (intptr_t i = 0; i < class_ids.length(); i++) {
- // kIllegalObjectKind is used as terminating value, do not add it.
- ASSERT(class_ids[i] != kIllegalObjectKind);
+ // kIllegalCid is used as terminating value, do not add it.
+ ASSERT(class_ids[i] != kIllegalCid);
data.SetAt(data_pos++, Smi::Handle(Smi::New(class_ids[i])));
}
ASSERT(!target.IsNull());
@@ -7652,7 +7427,7 @@
void ICData::AddReceiverCheck(intptr_t receiver_class_id,
const Function& target) const {
ASSERT(num_args_tested() == 1); // Otherwise use 'AddCheck'.
- ASSERT(receiver_class_id != kIllegalObjectKind);
+ ASSERT(receiver_class_id != kIllegalCid);
ASSERT(!target.IsNull());
const intptr_t old_num = NumberOfChecks();
@@ -7662,10 +7437,10 @@
set_ic_data(data);
WriteSentinel();
intptr_t data_pos = old_num * TestEntryLength();
- if ((receiver_class_id == kSmi) && (data_pos > 0)) {
- // Instert kSmi in position 0.
+ if ((receiver_class_id == kSmiCid) && (data_pos > 0)) {
+ // Instert kSmiCid in position 0.
const intptr_t zero_class_id = GetReceiverClassIdAt(0);
- ASSERT(zero_class_id != kSmi); // Simple duplicate entry check.
+ ASSERT(zero_class_id != kSmiCid); // Simple duplicate entry check.
const Function& zero_target = Function::Handle(GetTargetAt(0));
data.SetAt(0, Smi::Handle(Smi::New(receiver_class_id)));
data.SetAt(1, target);
@@ -7778,7 +7553,7 @@
ICData& result = ICData::Handle();
{
// IC data objects are long living objects, allocate them in old generation.
- RawObject* raw = Object::Allocate(ICData::kInstanceKind,
+ RawObject* raw = Object::Allocate(ICData::kClassId,
ICData::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -7804,7 +7579,7 @@
{
// SubtypeTestCache objects are long living objects, allocate them in the
// old generation.
- RawObject* raw = Object::Allocate(SubtypeTestCache::kInstanceKind,
+ RawObject* raw = Object::Allocate(SubtypeTestCache::kClassId,
SubtypeTestCache::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -7887,7 +7662,7 @@
ASSERT(Object::api_error_class() != Class::null());
ApiError& result = ApiError::Handle();
{
- RawObject* raw = Object::Allocate(ApiError::kInstanceKind,
+ RawObject* raw = Object::Allocate(ApiError::kClassId,
ApiError::InstanceSize(),
space);
NoGCScope no_gc;
@@ -7918,7 +7693,7 @@
ASSERT(Object::language_error_class() != Class::null());
LanguageError& result = LanguageError::Handle();
{
- RawObject* raw = Object::Allocate(LanguageError::kInstanceKind,
+ RawObject* raw = Object::Allocate(LanguageError::kClassId,
LanguageError::InstanceSize(),
space);
NoGCScope no_gc;
@@ -7951,7 +7726,7 @@
ASSERT(Object::unhandled_exception_class() != Class::null());
UnhandledException& result = UnhandledException::Handle();
{
- RawObject* raw = Object::Allocate(UnhandledException::kInstanceKind,
+ RawObject* raw = Object::Allocate(UnhandledException::kClassId,
UnhandledException::InstanceSize(),
space);
NoGCScope no_gc;
@@ -8012,7 +7787,7 @@
ASSERT(Object::unwind_error_class() != Class::null());
UnwindError& result = UnwindError::Handle();
{
- RawObject* raw = Object::Allocate(UnwindError::kInstanceKind,
+ RawObject* raw = Object::Allocate(UnwindError::kClassId,
UnwindError::InstanceSize(),
space);
NoGCScope no_gc;
@@ -8427,7 +8202,7 @@
ASSERT(Isolate::Current()->object_store()->mint_class() != Class::null());
Mint& result = Mint::Handle();
{
- RawObject* raw = Object::Allocate(Mint::kInstanceKind,
+ RawObject* raw = Object::Allocate(Mint::kClassId,
Mint::InstanceSize(),
space);
NoGCScope no_gc;
@@ -8554,7 +8329,7 @@
ASSERT(Isolate::Current()->object_store()->double_class() != Class::null());
Double& result = Double::Handle();
{
- RawObject* raw = Object::Allocate(Double::kInstanceKind,
+ RawObject* raw = Object::Allocate(Double::kClassId,
Double::InstanceSize(),
space);
NoGCScope no_gc;
@@ -8717,7 +8492,7 @@
ASSERT(Isolate::Current()->object_store()->bigint_class() != Class::null());
Bigint& result = Bigint::Handle();
{
- RawObject* raw = Object::Allocate(Bigint::kInstanceKind,
+ RawObject* raw = Object::Allocate(Bigint::kClassId,
Bigint::InstanceSize(length),
space);
NoGCScope no_gc;
@@ -9480,7 +9255,7 @@
}
OneByteString& result = OneByteString::Handle();
{
- RawObject* raw = Object::Allocate(OneByteString::kInstanceKind,
+ RawObject* raw = Object::Allocate(OneByteString::kClassId,
OneByteString::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9622,7 +9397,7 @@
}
TwoByteString& result = TwoByteString::Handle();
{
- RawObject* raw = Object::Allocate(TwoByteString::kInstanceKind,
+ RawObject* raw = Object::Allocate(TwoByteString::kClassId,
TwoByteString::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9755,7 +9530,7 @@
}
FourByteString& result = FourByteString::Handle();
{
- RawObject* raw = Object::Allocate(FourByteString::kInstanceKind,
+ RawObject* raw = Object::Allocate(FourByteString::kClassId,
FourByteString::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9868,7 +9643,7 @@
ExternalStringData<uint8_t>* external_data =
new ExternalStringData<uint8_t>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(ExternalOneByteString::kInstanceKind,
+ RawObject* raw = Object::Allocate(ExternalOneByteString::kClassId,
ExternalOneByteString::InstanceSize(),
space);
NoGCScope no_gc;
@@ -9919,7 +9694,7 @@
ExternalStringData<uint16_t>* external_data =
new ExternalStringData<uint16_t>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(ExternalTwoByteString::kInstanceKind,
+ RawObject* raw = Object::Allocate(ExternalTwoByteString::kClassId,
ExternalTwoByteString::InstanceSize(),
space);
NoGCScope no_gc;
@@ -9961,7 +9736,7 @@
ExternalStringData<uint32_t>* external_data =
new ExternalStringData<uint32_t>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(ExternalFourByteString::kInstanceKind,
+ RawObject* raw = Object::Allocate(ExternalFourByteString::kClassId,
ExternalFourByteString::InstanceSize(),
space);
NoGCScope no_gc;
@@ -10002,7 +9777,7 @@
{
// Since the two boolean instances are singletons we allocate them straight
// in the old generation.
- RawObject* raw = Object::Allocate(Bool::kInstanceKind,
+ RawObject* raw = Object::Allocate(Bool::kClassId,
Bool::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -10131,7 +9906,7 @@
// Update the size in the header field and length of the array object.
uword tags = array.raw_ptr()->tags_;
- ASSERT(kArray == RawObject::ClassIdTag::decode(tags));
+ ASSERT(kArrayCid == RawObject::ClassIdTag::decode(tags));
tags = RawObject::SizeTag::update(used_size, tags);
array.raw_ptr()->tags_ = tags;
array.SetLength(used_len);
@@ -10288,7 +10063,7 @@
!= Class::null());
GrowableObjectArray& result = GrowableObjectArray::Handle();
{
- RawObject* raw = Object::Allocate(GrowableObjectArray::kInstanceKind,
+ RawObject* raw = Object::Allocate(GrowableObjectArray::kClassId,
GrowableObjectArray::InstanceSize(),
space);
NoGCScope no_gc;
@@ -10990,7 +10765,7 @@
Class::null());
Stacktrace& result = Stacktrace::Handle();
{
- RawObject* raw = Object::Allocate(Stacktrace::kInstanceKind,
+ RawObject* raw = Object::Allocate(Stacktrace::kClassId,
Stacktrace::InstanceSize(),
space);
NoGCScope no_gc;
@@ -11115,7 +10890,7 @@
}
JSRegExp& result = JSRegExp::Handle();
{
- RawObject* raw = Object::Allocate(JSRegExp::kInstanceKind,
+ RawObject* raw = Object::Allocate(JSRegExp::kClassId,
JSRegExp::InstanceSize(len),
space);
NoGCScope no_gc;
« no previous file with comments | « vm/object.h ('k') | vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698