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

Unified Diff: runtime/vm/object.cc

Issue 16163010: More cleanup based on profile information. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « runtime/vm/object.h ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 23312)
+++ runtime/vm/object.cc (working copy)
@@ -321,14 +321,14 @@
Heap* heap = isolate->heap();
// Allocate the read only object handles here.
- empty_array_ = Array::ReadOnlyHandle(isolate);
- sentinel_ = Instance::ReadOnlyHandle(isolate);
- transition_sentinel_ = Instance::ReadOnlyHandle(isolate);
- unknown_constant_ = Instance::ReadOnlyHandle(isolate);
- non_constant_ = Instance::ReadOnlyHandle(isolate);
- bool_true_ = Bool::ReadOnlyHandle(isolate);
- bool_false_ = Bool::ReadOnlyHandle(isolate);
- snapshot_writer_error_ = LanguageError::ReadOnlyHandle(isolate);
+ empty_array_ = Array::ReadOnlyHandle();
+ sentinel_ = Instance::ReadOnlyHandle();
+ transition_sentinel_ = Instance::ReadOnlyHandle();
+ unknown_constant_ = Instance::ReadOnlyHandle();
+ non_constant_ = Instance::ReadOnlyHandle();
+ bool_true_ = Bool::ReadOnlyHandle();
+ bool_false_ = Bool::ReadOnlyHandle();
+ snapshot_writer_error_ = LanguageError::ReadOnlyHandle();
// Allocate and initialize the null instance.
// 'null_' must be the first object allocated as it is used in allocation to
@@ -1577,19 +1577,24 @@
// To work properly, this call requires the super class of this class to be
// resolved, which is checked by the SuperClass() call.
Class& cls = Class::Handle(raw());
- if (IsSignatureClass()) {
- const Function& signature_fun = Function::Handle(signature_function());
- if (!signature_fun.is_static() &&
- !signature_fun.HasInstantiatedSignature()) {
- cls = signature_fun.Owner();
+ intptr_t num_type_args = 0;
+
+ do {
+ if (cls.IsSignatureClass()) {
+ const Function& signature_fun =
+ Function::Handle(cls.signature_function());
+ if (!signature_fun.is_static() &&
+ !signature_fun.HasInstantiatedSignature()) {
+ cls = signature_fun.Owner();
+ }
}
- }
- intptr_t num_type_args = NumTypeParameters();
- cls = cls.SuperClass();
- // Object is its own super class during bootstrap.
- if (!cls.IsNull() && (cls.raw() != raw())) {
- num_type_args += cls.NumTypeArguments();
- }
+ num_type_args += cls.NumTypeParameters();
+ // Object is its own super class during bootstrap.
+ if (cls.SuperClass() == Class::null() || cls.SuperClass() == cls.raw()) {
+ break;
+ }
+ cls = cls.SuperClass();
+ } while (true);
return num_type_args;
}
@@ -5290,15 +5295,10 @@
RawTokenStream* TokenStream::New() {
ASSERT(Object::token_stream_class() != Class::null());
- TokenStream& result = TokenStream::Handle();
- {
- RawObject* raw = Object::Allocate(TokenStream::kClassId,
- TokenStream::InstanceSize(),
- Heap::kOld);
- NoGCScope no_gc;
- result ^= raw;
- }
- return result.raw();
+ RawObject* raw = Object::Allocate(TokenStream::kClassId,
+ TokenStream::InstanceSize(),
+ Heap::kOld);
+ return reinterpret_cast<RawTokenStream*>(raw);
}
@@ -9229,15 +9229,10 @@
if (cls.EnsureIsFinalized(isolate) != Error::null()) {
return Instance::null();
}
- Instance& result = Instance::Handle(isolate);
- {
- intptr_t instance_size = cls.instance_size();
- ASSERT(instance_size > 0);
- RawObject* raw = Object::Allocate(cls.id(), instance_size, space);
- NoGCScope no_gc;
- result ^= raw;
- }
- return result.raw();
+ intptr_t instance_size = cls.instance_size();
+ ASSERT(instance_size > 0);
+ RawObject* raw = Object::Allocate(cls.id(), instance_size, space);
+ return reinterpret_cast<RawInstance*>(raw);
}
@@ -13315,15 +13310,10 @@
RawWeakProperty* WeakProperty::New(Heap::Space space) {
ASSERT(Isolate::Current()->object_store()->weak_property_class()
!= Class::null());
- WeakProperty& result = WeakProperty::Handle();
- {
- RawObject* raw = Object::Allocate(WeakProperty::kClassId,
- WeakProperty::InstanceSize(),
- space);
- NoGCScope no_gc;
- result ^= raw;
- }
- return result.raw();
+ RawObject* raw = Object::Allocate(WeakProperty::kClassId,
+ WeakProperty::InstanceSize(),
+ space);
+ return reinterpret_cast<RawWeakProperty*>(raw);
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698