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

Unified Diff: runtime/vm/object.cc

Issue 1289813005: Use Object::null_instance and Object::null_function and do not create Handles everytime. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 4d643122d6564aa4e34fcfccc5ec4b737f273981..cc937270bd5fb7d3024de71bbba4ad4b651dbe55 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -94,6 +94,7 @@ Object* Object::null_object_ = NULL;
Array* Object::null_array_ = NULL;
String* Object::null_string_ = NULL;
Instance* Object::null_instance_ = NULL;
+Function* Object::null_function_ = NULL;
TypeArguments* Object::null_type_arguments_ = NULL;
Array* Object::empty_array_ = NULL;
Array* Object::zero_array_ = NULL;
@@ -423,6 +424,7 @@ void Object::InitOnce(Isolate* isolate) {
null_array_ = Array::ReadOnlyHandle();
null_string_ = String::ReadOnlyHandle();
null_instance_ = Instance::ReadOnlyHandle();
+ null_function_ = Function::ReadOnlyHandle();
null_type_arguments_ = TypeArguments::ReadOnlyHandle();
empty_array_ = Array::ReadOnlyHandle();
zero_array_ = Array::ReadOnlyHandle();
@@ -447,6 +449,7 @@ void Object::InitOnce(Isolate* isolate) {
*null_array_ = Array::null();
*null_string_ = String::null();
*null_instance_ = Instance::null();
+ *null_function_ = Function::null();
*null_type_arguments_ = TypeArguments::null();
// Initialize the empty and zero array handles to null_ in order to be able to
@@ -769,6 +772,8 @@ void Object::InitOnce(Isolate* isolate) {
ASSERT(null_string_->IsString());
ASSERT(!null_instance_->IsSmi());
ASSERT(null_instance_->IsInstance());
+ ASSERT(!null_function_->IsSmi());
+ ASSERT(null_function_->IsFunction());
ASSERT(!null_type_arguments_->IsSmi());
ASSERT(null_type_arguments_->IsTypeArguments());
ASSERT(!empty_array_->IsSmi());
@@ -7249,7 +7254,7 @@ RawField* Field::New(const String& name,
result.set_owner(owner);
result.set_token_pos(token_pos);
result.set_has_initializer(false);
- result.set_initializer(Function::Handle());
+ result.set_initializer(Object::null_function());
srdjan 2015/08/13 15:49:01 Is this necessary at all, since all data is initia
siva 2015/08/13 16:52:02 That is a good point, not sure why it was there in
result.set_is_unboxing_candidate(true);
result.set_guarded_cid(FLAG_use_field_guards ? kIllegalCid : kDynamicCid);
result.set_is_nullable(FLAG_use_field_guards ? false : true);
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698