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

Unified Diff: vm/object.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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/parser.cc » ('j') | vm/symbols.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.cc
===================================================================
--- vm/object.cc (revision 9729)
+++ vm/object.cc (working copy)
@@ -27,6 +27,7 @@
#include "vm/runtime_entry.h"
#include "vm/scopes.h"
#include "vm/stack_frame.h"
+#include "vm/symbols.h"
#include "vm/timer.h"
#include "vm/unicode.h"
@@ -308,12 +309,13 @@
{
cls = null_class_;
Instance& sentinel = Instance::Handle();
- sentinel ^= Object::Allocate(cls, Instance::InstanceSize(), Heap::kOld);
+ sentinel ^=
+ Object::Allocate(cls.id(), Instance::InstanceSize(), Heap::kOld);
sentinel_ = sentinel.raw();
Instance& transition_sentinel = Instance::Handle();
transition_sentinel ^=
- Object::Allocate(cls, Instance::InstanceSize(), Heap::kOld);
+ Object::Allocate(cls.id(), Instance::InstanceSize(), Heap::kOld);
transition_sentinel_ = transition_sentinel.raw();
}
@@ -979,7 +981,7 @@
}
-RawObject* Object::Allocate(const Class& cls,
+RawObject* Object::Allocate(intptr_t cls_id,
intptr_t size,
Heap::Space space) {
ASSERT(Utils::IsAligned(size, kObjectAlignment));
@@ -996,9 +998,9 @@
UNREACHABLE();
}
NoGCScope no_gc;
- InitializeObject(address, cls.id(), size);
+ InitializeObject(address, cls_id, size);
RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
- ASSERT(cls.id() == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_));
+ ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_));
return raw_obj;
}
@@ -1025,7 +1027,7 @@
RawObject* Object::Clone(const Object& src, Heap::Space space) {
const Class& cls = Class::Handle(src.clazz());
intptr_t size = src.raw()->Size();
- RawObject* raw_obj = Object::Allocate(cls, size, space);
+ RawObject* raw_obj = Object::Allocate(cls.id(), size, space);
NoGCScope no_gc;
memmove(raw_obj->ptr(), src.raw()->ptr(), size);
if (space == Heap::kOld) {
@@ -1085,10 +1087,10 @@
template <class FakeObject>
RawClass* Class::New() {
- Class& class_class = Class::Handle(Object::class_class());
+ ASSERT(Object::class_class() != Class::null());
Class& result = Class::Handle();
{
- RawObject* raw = Object::Allocate(class_class,
+ RawObject* raw = Object::Allocate(Class::kInstanceKind,
Class::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -1420,10 +1422,10 @@
template <class FakeInstance>
RawClass* Class::New(intptr_t index) {
- Class& class_class = Class::Handle(Object::class_class());
+ ASSERT(Object::class_class() != Class::null());
Class& result = Class::Handle();
{
- RawObject* raw = Object::Allocate(class_class,
+ RawObject* raw = Object::Allocate(Class::kInstanceKind,
Class::InstanceSize(),
Heap::kOld);
NoGCScope no_gc;
@@ -2144,9 +2146,8 @@
RawUnresolvedClass* UnresolvedClass::New() {
- const Class& unresolved_class_class =
- Class::Handle(Object::unresolved_class_class());
- RawObject* raw = Object::Allocate(unresolved_class_class,
+ ASSERT(Object::unresolved_class_class() != Class::null());
+ RawObject* raw = Object::Allocate(UnresolvedClass::kInstanceKind,
UnresolvedClass::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawUnresolvedClass*>(raw);
@@ -2181,7 +2182,7 @@
String& name = String::Handle();
String& str = String::Handle();
name = lib_prefix.name(); // Qualifier.
- str = String::New(".");
+ str = Symbols::Dot();
name = String::Concat(name, str);
str = ident();
name = String::Concat(name, str);
@@ -2784,8 +2785,8 @@
RawType* Type::New(Heap::Space space) {
- const Class& type_class = Class::Handle(Object::type_class());
- RawObject* raw = Object::Allocate(type_class,
+ ASSERT(Object::type_class() != Class::null());
+ RawObject* raw = Object::Allocate(Type::kInstanceKind,
Type::InstanceSize(),
space);
return reinterpret_cast<RawType*>(raw);
@@ -2945,9 +2946,8 @@
RawTypeParameter* TypeParameter::New() {
- const Class& type_parameter_class =
- Class::Handle(Object::type_parameter_class());
- RawObject* raw = Object::Allocate(type_parameter_class,
+ ASSERT(Object::type_parameter_class() != Class::null());
+ RawObject* raw = Object::Allocate(TypeParameter::kInstanceKind,
TypeParameter::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawTypeParameter*>(raw);
@@ -3368,11 +3368,9 @@
return null();
}
- const Class& type_arguments_class =
- Class::Handle(Object::type_arguments_class());
TypeArguments& result = TypeArguments::Handle();
{
- RawObject* raw = Object::Allocate(type_arguments_class,
+ RawObject* raw = Object::Allocate(TypeArguments::kInstanceKind,
TypeArguments::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -3492,9 +3490,8 @@
RawInstantiatedTypeArguments* InstantiatedTypeArguments::New() {
- const Class& instantiated_type_arguments_class =
- Class::Handle(Object::instantiated_type_arguments_class());
- RawObject* raw = Object::Allocate(instantiated_type_arguments_class,
+ ASSERT(Object::instantiated_type_arguments_class() != Class::null());
+ RawObject* raw = Object::Allocate(InstantiatedTypeArguments::kInstanceKind,
InstantiatedTypeArguments::InstanceSize(),
Heap::kNew);
return reinterpret_cast<RawInstantiatedTypeArguments*>(raw);
@@ -3996,8 +3993,8 @@
RawFunction* Function::New() {
- const Class& function_class = Class::Handle(Object::function_class());
- RawObject* raw = Object::Allocate(function_class,
+ ASSERT(Object::function_class() != Class::null());
+ RawObject* raw = Object::Allocate(Function::kInstanceKind,
Function::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawFunction*>(raw);
@@ -4356,8 +4353,8 @@
RawField* Field::New() {
- const Class& field_class = Class::Handle(Object::field_class());
- RawObject* raw = Object::Allocate(field_class,
+ ASSERT(Object::field_class() != Class::null());
+ RawObject* raw = Object::Allocate(Field::kInstanceKind,
Field::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawField*>(raw);
@@ -4411,8 +4408,8 @@
RawLiteralToken* LiteralToken::New() {
- const Class& cls = Class::Handle(Object::literal_token_class());
- RawObject* raw = Object::Allocate(cls,
+ ASSERT(Object::literal_token_class() != Class::null());
+ RawObject* raw = Object::Allocate(LiteralToken::kInstanceKind,
LiteralToken::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawLiteralToken*>(raw);
@@ -4531,10 +4528,10 @@
RawTokenStream* TokenStream::New(intptr_t len) {
- const Class& token_stream_class = Class::Handle(Object::token_stream_class());
+ ASSERT(Object::token_stream_class() != Class::null());
TokenStream& result = TokenStream::Handle();
{
- RawObject* raw = Object::Allocate(token_stream_class,
+ RawObject* raw = Object::Allocate(TokenStream::kInstanceKind,
TokenStream::InstanceSize(len),
Heap::kOld);
NoGCScope no_gc;
@@ -5028,8 +5025,8 @@
RawScript* Script::New() {
- const Class& script_class = Class::Handle(Object::script_class());
- RawObject* raw = Object::Allocate(script_class,
+ ASSERT(Object::script_class() != Class::null());
+ RawObject* raw = Object::Allocate(Script::kInstanceKind,
Script::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawScript*>(raw);
@@ -5836,8 +5833,8 @@
RawLibrary* Library::New() {
- const Class& library_class = Class::Handle(Object::library_class());
- RawObject* raw = Object::Allocate(library_class,
+ ASSERT(Object::library_class() != Class::null());
+ RawObject* raw = Object::Allocate(Library::kInstanceKind,
Library::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawLibrary*>(raw);
@@ -6151,9 +6148,8 @@
RawLibraryPrefix* LibraryPrefix::New() {
- const Class& library_prefix_class =
- Class::Handle(Object::library_prefix_class());
- RawObject* raw = Object::Allocate(library_prefix_class,
+ ASSERT(Object::library_prefix_class() != Class::null());
+ RawObject* raw = Object::Allocate(LibraryPrefix::kInstanceKind,
LibraryPrefix::InstanceSize(),
Heap::kOld);
return reinterpret_cast<RawLibraryPrefix*>(raw);
@@ -6278,11 +6274,11 @@
RawInstructions* Instructions::New(intptr_t size) {
- const Class& instructions_class = Class::Handle(Object::instructions_class());
+ ASSERT(Object::instructions_class() != Class::null());
Instructions& result = Instructions::Handle();
{
uword aligned_size = Instructions::InstanceSize(size);
- RawObject* raw = Object::Allocate(instructions_class,
+ RawObject* raw = Object::Allocate(Instructions::kInstanceKind,
aligned_size,
Heap::kCode);
NoGCScope no_gc;
@@ -6363,11 +6359,13 @@
RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors) {
- const Class& cls = Class::Handle(Object::pc_descriptors_class());
+ ASSERT(Object::pc_descriptors_class() != Class::null());
PcDescriptors& result = PcDescriptors::Handle();
{
uword size = PcDescriptors::InstanceSize(num_descriptors);
- RawObject* raw = Object::Allocate(cls, size, Heap::kOld);
+ RawObject* raw = Object::Allocate(PcDescriptors::kInstanceKind,
+ size,
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.SetLength(num_descriptors);
@@ -6484,16 +6482,16 @@
RawStackmap* Stackmap::New(uword pc_offset, BitmapBuilder* bmap) {
- const Class& cls = Class::Handle(Object::stackmap_class());
- ASSERT(!cls.IsNull());
+ ASSERT(Object::stackmap_class() != Class::null());
ASSERT(bmap != NULL);
Stackmap& result = Stackmap::Handle();
intptr_t size = bmap->SizeInBytes();
{
// Stackmap data objects are associated with a code object, allocate them
// in old generation.
- RawObject* raw =
- Object::Allocate(cls, Stackmap::InstanceSize(size), Heap::kOld);
+ RawObject* raw = Object::Allocate(Stackmap::kInstanceKind,
+ Stackmap::InstanceSize(size),
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.set_bitmap_size_in_bytes(size);
@@ -6573,11 +6571,13 @@
RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) {
- const Class& cls = Class::Handle(Object::var_descriptors_class());
+ ASSERT(Object::var_descriptors_class() != Class::null());
LocalVarDescriptors& result = LocalVarDescriptors::Handle();
{
uword size = LocalVarDescriptors::InstanceSize(num_variables);
- RawObject* raw = Object::Allocate(cls, size, Heap::kOld);
+ RawObject* raw = Object::Allocate(LocalVarDescriptors::kInstanceKind,
+ size,
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.raw_ptr()->length_ = num_variables;
@@ -6627,11 +6627,13 @@
RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) {
- const Class& cls = Class::Handle(Object::exception_handlers_class());
+ ASSERT(Object::exception_handlers_class() != Class::null());
ExceptionHandlers& result = ExceptionHandlers::Handle();
{
uword size = ExceptionHandlers::InstanceSize(num_handlers);
- RawObject* raw = Object::Allocate(cls, size, Heap::kOld);
+ RawObject* raw = Object::Allocate(ExceptionHandlers::kInstanceKind,
+ size,
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.SetLength(num_handlers);
@@ -6730,11 +6732,11 @@
RawCode* Code::New(int pointer_offsets_length) {
- const Class& cls = Class::Handle(Object::code_class());
+ ASSERT(Object::code_class() != Class::null());
Code& result = Code::Handle();
{
uword size = Code::InstanceSize(pointer_offsets_length);
- RawObject* raw = Object::Allocate(cls, size, Heap::kOld);
+ RawObject* raw = Object::Allocate(Code::kInstanceKind, size, Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.set_pointer_offsets_length(pointer_offsets_length);
@@ -6959,10 +6961,9 @@
RawContext* Context::New(intptr_t num_variables, Heap::Space space) {
ASSERT(num_variables >= 0);
- const Class& context_class = Class::Handle(Object::context_class());
Context& result = Context::Handle();
{
- RawObject* raw = Object::Allocate(context_class,
+ RawObject* raw = Object::Allocate(Context::kInstanceKind,
Context::InstanceSize(num_variables),
space);
NoGCScope no_gc;
@@ -6980,12 +6981,13 @@
RawContextScope* ContextScope::New(intptr_t num_variables) {
- const Class& context_scope_class =
- Class::Handle(Object::context_scope_class());
+ ASSERT(Object::context_scope_class() != Class::null());
intptr_t size = ContextScope::InstanceSize(num_variables);
ContextScope& result = ContextScope::Handle();
{
- RawObject* raw = Object::Allocate(context_scope_class, size, Heap::kOld);
+ RawObject* raw = Object::Allocate(ContextScope::kInstanceKind,
+ size,
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
result.set_num_variables(num_variables);
@@ -7256,13 +7258,14 @@
const String& target_name,
intptr_t id,
intptr_t num_args_tested) {
+ ASSERT(Object::icdata_class() != Class::null());
ASSERT(num_args_tested > 0);
- const Class& cls = Class::Handle(Object::icdata_class());
- ASSERT(!cls.IsNull());
ICData& result = ICData::Handle();
{
// IC data objects are long living objects, allocate them in old generation.
- RawObject* raw = Object::Allocate(cls, ICData::InstanceSize(), Heap::kOld);
+ RawObject* raw = Object::Allocate(ICData::kInstanceKind,
+ ICData::InstanceSize(),
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
}
@@ -7280,14 +7283,14 @@
RawSubtypeTestCache* SubtypeTestCache::New() {
- const Class& cls = Class::Handle(Object::subtypetestcache_class());
- ASSERT(!cls.IsNull());
+ ASSERT(Object::subtypetestcache_class() != Class::null());
SubtypeTestCache& result = SubtypeTestCache::Handle();
{
// SubtypeTestCache objects are long living objects, allocate them in the
// old generation.
- RawObject* raw =
- Object::Allocate(cls, SubtypeTestCache::InstanceSize(), Heap::kOld);
+ RawObject* raw = Object::Allocate(SubtypeTestCache::kInstanceKind,
+ SubtypeTestCache::InstanceSize(),
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
}
@@ -7365,10 +7368,10 @@
RawApiError* ApiError::New(const String& message, Heap::Space space) {
- const Class& cls = Class::Handle(Object::api_error_class());
+ ASSERT(Object::api_error_class() != Class::null());
ApiError& result = ApiError::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(ApiError::kInstanceKind,
ApiError::InstanceSize(),
space);
NoGCScope no_gc;
@@ -7396,10 +7399,10 @@
RawLanguageError* LanguageError::New(const String& message, Heap::Space space) {
- const Class& cls = Class::Handle(Object::language_error_class());
+ ASSERT(Object::language_error_class() != Class::null());
LanguageError& result = LanguageError::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(LanguageError::kInstanceKind,
LanguageError::InstanceSize(),
space);
NoGCScope no_gc;
@@ -7429,10 +7432,10 @@
RawUnhandledException* UnhandledException::New(const Instance& exception,
const Instance& stacktrace,
Heap::Space space) {
- const Class& cls = Class::Handle(Object::unhandled_exception_class());
+ ASSERT(Object::unhandled_exception_class() != Class::null());
UnhandledException& result = UnhandledException::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(UnhandledException::kInstanceKind,
UnhandledException::InstanceSize(),
space);
NoGCScope no_gc;
@@ -7490,10 +7493,10 @@
RawUnwindError* UnwindError::New(const String& message, Heap::Space space) {
- const Class& cls = Class::Handle(Object::unwind_error_class());
+ ASSERT(Object::unwind_error_class() != Class::null());
UnwindError& result = UnwindError::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(UnwindError::kInstanceKind,
UnwindError::InstanceSize(),
space);
NoGCScope no_gc;
@@ -7717,7 +7720,7 @@
{
intptr_t instance_size = cls.instance_size();
ASSERT(instance_size > 0);
- RawObject* raw = Object::Allocate(cls, instance_size, space);
+ RawObject* raw = Object::Allocate(cls.id(), instance_size, space);
NoGCScope no_gc;
result ^= raw;
uword addr = reinterpret_cast<uword>(result.raw_ptr());
@@ -7907,12 +7910,12 @@
RawMint* Mint::New(int64_t val, Heap::Space space) {
// Do not allocate a Mint if Smi would do.
ASSERT(!Smi::IsValid64(val));
- Isolate* isolate = Isolate::Current();
- const Class& cls =
- Class::Handle(isolate->object_store()->mint_class());
+ ASSERT(Isolate::Current()->object_store()->mint_class() != Class::null());
Mint& result = Mint::Handle();
{
- RawObject* raw = Object::Allocate(cls, Mint::InstanceSize(), space);
+ RawObject* raw = Object::Allocate(Mint::kInstanceKind,
+ Mint::InstanceSize(),
+ space);
NoGCScope no_gc;
result ^= raw;
}
@@ -8035,12 +8038,12 @@
RawDouble* Double::New(double d, Heap::Space space) {
- Isolate* isolate = Isolate::Current();
- const Class& cls =
- Class::Handle(isolate->object_store()->double_class());
+ ASSERT(Isolate::Current()->object_store()->double_class() != Class::null());
Double& result = Double::Handle();
{
- RawObject* raw = Object::Allocate(cls, Double::InstanceSize(), space);
+ RawObject* raw = Object::Allocate(Double::kInstanceKind,
+ Double::InstanceSize(),
+ space);
NoGCScope no_gc;
result ^= raw;
}
@@ -8196,11 +8199,12 @@
RawBigint* Bigint::Allocate(intptr_t length, Heap::Space space) {
ASSERT(length >= 0);
- Isolate* isolate = Isolate::Current();
- const Class& cls = Class::Handle(isolate->object_store()->bigint_class());
+ ASSERT(Isolate::Current()->object_store()->bigint_class() != Class::null());
Bigint& result = Bigint::Handle();
{
- RawObject* raw = Object::Allocate(cls, Bigint::InstanceSize(length), space);
+ RawObject* raw = Object::Allocate(Bigint::kInstanceKind,
+ Bigint::InstanceSize(length),
+ space);
NoGCScope no_gc;
result ^= raw;
result.raw_ptr()->allocated_length_ = length; // Chunk length allocated.
@@ -9108,13 +9112,12 @@
RawOneByteString* OneByteString::New(intptr_t len,
Heap::Space space) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls =
- Class::Handle(isolate->object_store()->one_byte_string_class());
+ ASSERT(Isolate::Current() == Dart::vm_isolate() ||
+ Isolate::Current()->object_store()->one_byte_string_class() !=
+ Class::null());
OneByteString& result = OneByteString::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(OneByteString::kInstanceKind,
OneByteString::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9249,13 +9252,10 @@
RawTwoByteString* TwoByteString::New(intptr_t len,
Heap::Space space) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls =
- Class::Handle(isolate->object_store()->two_byte_string_class());
+ ASSERT(Isolate::Current()->object_store()->two_byte_string_class());
TwoByteString& result = TwoByteString::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(TwoByteString::kInstanceKind,
TwoByteString::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9380,13 +9380,11 @@
RawFourByteString* FourByteString::New(intptr_t len,
Heap::Space space) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls =
- Class::Handle(isolate->object_store()->four_byte_string_class());
+ ASSERT(Isolate::Current()->object_store()->four_byte_string_class() !=
+ Class::null());
FourByteString& result = FourByteString::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(FourByteString::kInstanceKind,
FourByteString::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9489,15 +9487,13 @@
void* peer,
Dart_PeerFinalizer callback,
Heap::Space space) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls =
- Class::Handle(isolate->object_store()->external_one_byte_string_class());
+ ASSERT(Isolate::Current()->object_store()->external_one_byte_string_class() !=
+ Class::null());
ExternalOneByteString& result = ExternalOneByteString::Handle();
ExternalStringData<uint8_t>* external_data =
new ExternalStringData<uint8_t>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(ExternalOneByteString::kInstanceKind,
ExternalOneByteString::InstanceSize(),
space);
NoGCScope no_gc;
@@ -9538,15 +9534,13 @@
void* peer,
Dart_PeerFinalizer callback,
Heap::Space space) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls =
- Class::Handle(isolate->object_store()->external_two_byte_string_class());
+ ASSERT(Isolate::Current()->object_store()->external_two_byte_string_class() !=
+ Class::null());
ExternalTwoByteString& result = ExternalTwoByteString::Handle();
ExternalStringData<uint16_t>* external_data =
new ExternalStringData<uint16_t>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(ExternalTwoByteString::kInstanceKind,
ExternalTwoByteString::InstanceSize(),
space);
NoGCScope no_gc;
@@ -9577,15 +9571,13 @@
void* peer,
Dart_PeerFinalizer callback,
Heap::Space space) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls =
- Class::Handle(isolate->object_store()->external_four_byte_string_class());
+ ASSERT(Isolate::Current()->object_store()->
+ external_four_byte_string_class() != Class::null());
ExternalFourByteString& result = ExternalFourByteString::Handle();
ExternalStringData<uint32_t>* external_data =
new ExternalStringData<uint32_t>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(ExternalFourByteString::kInstanceKind,
ExternalFourByteString::InstanceSize(),
space);
NoGCScope no_gc;
@@ -9621,14 +9613,14 @@
RawBool* Bool::New(bool value) {
- Isolate* isolate = Isolate::Current();
-
- const Class& cls = Class::Handle(isolate->object_store()->bool_class());
+ ASSERT(Isolate::Current()->object_store()->bool_class() != Class::null());
Bool& result = Bool::Handle();
{
// Since the two boolean instances are singletons we allocate them straight
// in the old generation.
- RawObject* raw = Object::Allocate(cls, Bool::InstanceSize(), Heap::kOld);
+ RawObject* raw = Object::Allocate(Bool::kInstanceKind,
+ Bool::InstanceSize(),
+ Heap::kOld);
NoGCScope no_gc;
result ^= raw;
}
@@ -9691,7 +9683,7 @@
}
Array& result = Array::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(cls.id(),
Array::InstanceSize(len),
space);
NoGCScope no_gc;
@@ -9908,11 +9900,11 @@
RawGrowableObjectArray* GrowableObjectArray::New(const Array& array,
Heap::Space space) {
- ObjectStore* object_store = Isolate::Current()->object_store();
- Class& cls = Class::Handle(object_store->growable_object_array_class());
+ ASSERT(Isolate::Current()->object_store()->growable_object_array_class()
+ != Class::null());
GrowableObjectArray& result = GrowableObjectArray::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(GrowableObjectArray::kInstanceKind,
GrowableObjectArray::InstanceSize(),
space);
NoGCScope no_gc;
@@ -9991,7 +9983,7 @@
ExternalByteArrayData<ElementT>* external_data =
new ExternalByteArrayData<ElementT>(data, peer, callback);
{
- RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(), space);
+ RawObject* raw = Object::Allocate(cls.id(), HandleT::InstanceSize(), space);
NoGCScope no_gc;
result ^= raw;
result.SetLength(len);
@@ -10027,7 +10019,9 @@
RawT* ByteArray::NewImpl(const Class& cls, intptr_t len, Heap::Space space) {
HandleT& result = HandleT::Handle();
{
- RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(len), space);
+ RawObject* raw = Object::Allocate(cls.id(),
+ HandleT::InstanceSize(len),
+ space);
NoGCScope no_gc;
result ^= raw;
result.SetLength(len);
@@ -10046,7 +10040,9 @@
Heap::Space space) {
HandleT& result = HandleT::Handle();
{
- RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(len), space);
+ RawObject* raw = Object::Allocate(cls.id(),
+ HandleT::InstanceSize(len),
+ space);
NoGCScope no_gc;
result ^= raw;
result.SetLength(len);
@@ -10478,7 +10474,7 @@
const Class& cls = Class::Handle(function.signature_class());
Closure& result = Closure::Handle();
{
- RawObject* raw = Object::Allocate(cls, Closure::InstanceSize(), space);
+ RawObject* raw = Object::Allocate(cls.id(), Closure::InstanceSize(), space);
NoGCScope no_gc;
result ^= raw;
}
@@ -10576,11 +10572,11 @@
RawStacktrace* Stacktrace::New(const GrowableArray<uword>& stack_frame_pcs,
Heap::Space space) {
- const Class& cls = Class::Handle(
- Isolate::Current()->object_store()->stacktrace_class());
+ ASSERT(Isolate::Current()->object_store()->stacktrace_class() !=
+ Class::null());
Stacktrace& result = Stacktrace::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(Stacktrace::kInstanceKind,
Stacktrace::InstanceSize(),
space);
NoGCScope no_gc;
@@ -10703,11 +10699,11 @@
RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) {
- const Class& cls = Class::Handle(
- Isolate::Current()->object_store()->jsregexp_class());
+ ASSERT(Isolate::Current()->object_store()->jsregexp_class() !=
+ Class::null());
JSRegExp& result = JSRegExp::Handle();
{
- RawObject* raw = Object::Allocate(cls,
+ RawObject* raw = Object::Allocate(JSRegExp::kInstanceKind,
JSRegExp::InstanceSize(len),
space);
NoGCScope no_gc;
« no previous file with comments | « vm/object.h ('k') | vm/parser.cc » ('j') | vm/symbols.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698