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

Side by Side Diff: runtime/vm/object.cc

Issue 16336021: Create specific null read only handles for the frequently used types (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; 64 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 };
65 cpp_vtable Smi::handle_vtable_ = 0; 65 cpp_vtable Smi::handle_vtable_ = 0;
66 66
67 // These are initialized to a value that will force a illegal memory access if 67 // These are initialized to a value that will force a illegal memory access if
68 // they are being used. 68 // they are being used.
69 #if defined(RAW_NULL) 69 #if defined(RAW_NULL)
70 #error RAW_NULL should not be defined. 70 #error RAW_NULL should not be defined.
71 #endif 71 #endif
72 #define RAW_NULL kHeapObjectTag 72 #define RAW_NULL kHeapObjectTag
73 Object* Object::null_object_ = NULL; 73 Object* Object::null_object_ = NULL;
74 Array* Object::null_array_ = NULL;
75 String* Object::null_string_ = NULL;
76 Instance* Object::null_instance_ = NULL;
77 AbstractTypeArguments* Object::null_abstract_type_arguments_ = NULL;
74 Array* Object::empty_array_ = NULL; 78 Array* Object::empty_array_ = NULL;
75 Instance* Object::sentinel_ = NULL; 79 Instance* Object::sentinel_ = NULL;
76 Instance* Object::transition_sentinel_ = NULL; 80 Instance* Object::transition_sentinel_ = NULL;
77 Instance* Object::unknown_constant_ = NULL; 81 Instance* Object::unknown_constant_ = NULL;
78 Instance* Object::non_constant_ = NULL; 82 Instance* Object::non_constant_ = NULL;
79 Bool* Object::bool_true_ = NULL; 83 Bool* Object::bool_true_ = NULL;
80 Bool* Object::bool_false_ = NULL; 84 Bool* Object::bool_false_ = NULL;
81 Smi* Object::smi_illegal_cid_ = NULL; 85 Smi* Object::smi_illegal_cid_ = NULL;
82 LanguageError* Object::snapshot_writer_error_ = NULL; 86 LanguageError* Object::snapshot_writer_error_ = NULL;
83 87
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 Object fake_object; 321 Object fake_object;
318 Smi fake_smi; 322 Smi fake_smi;
319 Object::handle_vtable_ = fake_object.vtable(); 323 Object::handle_vtable_ = fake_object.vtable();
320 Smi::handle_vtable_ = fake_smi.vtable(); 324 Smi::handle_vtable_ = fake_smi.vtable();
321 } 325 }
322 326
323 Isolate* isolate = Isolate::Current(); 327 Isolate* isolate = Isolate::Current();
324 Heap* heap = isolate->heap(); 328 Heap* heap = isolate->heap();
325 329
326 // Allocate the read only object handles here. 330 // Allocate the read only object handles here.
327 null_object_ = Array::ReadOnlyHandle(); 331 null_object_ = Object::ReadOnlyHandle();
332 null_array_ = Array::ReadOnlyHandle();
333 null_string_ = String::ReadOnlyHandle();
334 null_instance_ = Instance::ReadOnlyHandle();
335 null_abstract_type_arguments_ = AbstractTypeArguments::ReadOnlyHandle();
328 empty_array_ = Array::ReadOnlyHandle(); 336 empty_array_ = Array::ReadOnlyHandle();
329 sentinel_ = Instance::ReadOnlyHandle(); 337 sentinel_ = Instance::ReadOnlyHandle();
330 transition_sentinel_ = Instance::ReadOnlyHandle(); 338 transition_sentinel_ = Instance::ReadOnlyHandle();
331 unknown_constant_ = Instance::ReadOnlyHandle(); 339 unknown_constant_ = Instance::ReadOnlyHandle();
332 non_constant_ = Instance::ReadOnlyHandle(); 340 non_constant_ = Instance::ReadOnlyHandle();
333 bool_true_ = Bool::ReadOnlyHandle(); 341 bool_true_ = Bool::ReadOnlyHandle();
334 bool_false_ = Bool::ReadOnlyHandle(); 342 bool_false_ = Bool::ReadOnlyHandle();
335 smi_illegal_cid_ = Smi::ReadOnlyHandle(); 343 smi_illegal_cid_ = Smi::ReadOnlyHandle();
336 snapshot_writer_error_ = LanguageError::ReadOnlyHandle(); 344 snapshot_writer_error_ = LanguageError::ReadOnlyHandle();
337 345
338 // Allocate and initialize the null instance. 346 // Allocate and initialize the null instance.
339 // 'null_' must be the first object allocated as it is used in allocation to 347 // 'null_' must be the first object allocated as it is used in allocation to
340 // clear the object. 348 // clear the object.
341 { 349 {
342 uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld); 350 uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld);
343 null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag); 351 null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag);
344 // The call below is using 'null_' to initialize itself. 352 // The call below is using 'null_' to initialize itself.
345 InitializeObject(address, kNullCid, Instance::InstanceSize()); 353 InitializeObject(address, kNullCid, Instance::InstanceSize());
346 } 354 }
347 355
348 *null_object_ = null_; 356 *null_object_ = null_;
357 *null_array_ ^= null_;
358 *null_string_ ^= null_;
359 *null_instance_ ^= null_;
360 *null_abstract_type_arguments_ ^= null_;
349 361
350 // Initialize the empty array handle to null_ in order to be able to check 362 // Initialize the empty array handle to null_ in order to be able to check
351 // if the empty array was allocated (RAW_NULL is not available). 363 // if the empty array was allocated (RAW_NULL is not available).
352 *empty_array_ = Array::null(); 364 *empty_array_ = Array::null();
353 365
354 Class& cls = Class::Handle(); 366 Class& cls = Class::Handle();
355 367
356 // Allocate and initialize the class class. 368 // Allocate and initialize the class class.
357 { 369 {
358 intptr_t size = Class::InstanceSize(); 370 intptr_t size = Class::InstanceSize();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 cls = Class::New<Bool>(); 550 cls = Class::New<Bool>();
539 isolate->object_store()->set_bool_class(cls); 551 isolate->object_store()->set_bool_class(cls);
540 *bool_true_ = Bool::New(true); 552 *bool_true_ = Bool::New(true);
541 *bool_false_ = Bool::New(false); 553 *bool_false_ = Bool::New(false);
542 554
543 *smi_illegal_cid_ = Smi::New(kIllegalCid); 555 *smi_illegal_cid_ = Smi::New(kIllegalCid);
544 *snapshot_writer_error_ = 556 *snapshot_writer_error_ =
545 LanguageError::New(String::Handle(String::New("SnapshotWriter Error"))); 557 LanguageError::New(String::Handle(String::New("SnapshotWriter Error")));
546 558
547 ASSERT(!null_object_->IsSmi()); 559 ASSERT(!null_object_->IsSmi());
560 ASSERT(!null_array_->IsSmi());
561 ASSERT(null_array_->IsArray());
562 ASSERT(!null_string_->IsSmi());
563 ASSERT(null_string_->IsString());
564 ASSERT(!null_instance_->IsSmi());
565 ASSERT(null_instance_->IsInstance());
566 ASSERT(!null_abstract_type_arguments_->IsSmi());
567 ASSERT(null_abstract_type_arguments_->IsAbstractTypeArguments());
548 ASSERT(!empty_array_->IsSmi()); 568 ASSERT(!empty_array_->IsSmi());
549 ASSERT(empty_array_->IsArray()); 569 ASSERT(empty_array_->IsArray());
550 ASSERT(!sentinel_->IsSmi()); 570 ASSERT(!sentinel_->IsSmi());
551 ASSERT(sentinel_->IsInstance()); 571 ASSERT(sentinel_->IsInstance());
552 ASSERT(!transition_sentinel_->IsSmi()); 572 ASSERT(!transition_sentinel_->IsSmi());
553 ASSERT(transition_sentinel_->IsInstance()); 573 ASSERT(transition_sentinel_->IsInstance());
554 ASSERT(!unknown_constant_->IsSmi()); 574 ASSERT(!unknown_constant_->IsSmi());
555 ASSERT(unknown_constant_->IsInstance()); 575 ASSERT(unknown_constant_->IsInstance());
556 ASSERT(!non_constant_->IsSmi()); 576 ASSERT(!non_constant_->IsSmi());
557 ASSERT(non_constant_->IsInstance()); 577 ASSERT(non_constant_->IsInstance());
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 // Finish the initialization by compiling the bootstrap scripts containing the 1077 // Finish the initialization by compiling the bootstrap scripts containing the
1058 // base interfaces and the implementation of the internal classes. 1078 // base interfaces and the implementation of the internal classes.
1059 const Error& error = Error::Handle(Bootstrap::LoadandCompileScripts()); 1079 const Error& error = Error::Handle(Bootstrap::LoadandCompileScripts());
1060 if (!error.IsNull()) { 1080 if (!error.IsNull()) {
1061 return error.raw(); 1081 return error.raw();
1062 } 1082 }
1063 1083
1064 // Remove the Object superclass cycle by setting the super type to null (not 1084 // Remove the Object superclass cycle by setting the super type to null (not
1065 // to the type of null). 1085 // to the type of null).
1066 cls = object_store->object_class(); 1086 cls = object_store->object_class();
1067 cls.set_super_type(Type::null_object()); 1087 cls.set_super_type(AbstractType::Handle());
1068 1088
1069 ClassFinalizer::VerifyBootstrapClasses(); 1089 ClassFinalizer::VerifyBootstrapClasses();
1070 MarkInvisibleFunctions(); 1090 MarkInvisibleFunctions();
1071 1091
1072 // Set up the intrinsic state of all functions (core, math and scalar list). 1092 // Set up the intrinsic state of all functions (core, math and scalar list).
1073 Intrinsifier::InitializeState(); 1093 Intrinsifier::InitializeState();
1074 1094
1075 return Error::null(); 1095 return Error::null();
1076 } 1096 }
1077 1097
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 if (cls.IsSignatureClass()) { 1615 if (cls.IsSignatureClass()) {
1596 const Function& signature_fun = 1616 const Function& signature_fun =
1597 Function::Handle(isolate, cls.signature_function()); 1617 Function::Handle(isolate, cls.signature_function());
1598 if (!signature_fun.is_static() && 1618 if (!signature_fun.is_static() &&
1599 !signature_fun.HasInstantiatedSignature()) { 1619 !signature_fun.HasInstantiatedSignature()) {
1600 cls = signature_fun.Owner(); 1620 cls = signature_fun.Owner();
1601 } 1621 }
1602 } 1622 }
1603 num_type_args += cls.NumTypeParameters(); 1623 num_type_args += cls.NumTypeParameters();
1604 // Object is its own super class during bootstrap. 1624 // Object is its own super class during bootstrap.
1605 if (cls.super_type() == Type::null() || 1625 if (cls.super_type() == AbstractType::null() ||
1606 cls.super_type() == isolate->object_store()->object_type()) { 1626 cls.super_type() == isolate->object_store()->object_type()) {
1607 break; 1627 break;
1608 } 1628 }
1609 cls = cls.SuperClass(); 1629 cls = cls.SuperClass();
1610 } while (true); 1630 } while (true);
1611 return num_type_args; 1631 return num_type_args;
1612 } 1632 }
1613 1633
1614 1634
1615 bool Class::HasTypeArguments() const { 1635 bool Class::HasTypeArguments() const {
1616 if (!IsSignatureClass() && (is_type_finalized() || is_prefinalized())) { 1636 if (!IsSignatureClass() && (is_type_finalized() || is_prefinalized())) {
1617 // More efficient than calling NumTypeArguments(). 1637 // More efficient than calling NumTypeArguments().
1618 return type_arguments_field_offset() != kNoTypeArguments; 1638 return type_arguments_field_offset() != kNoTypeArguments;
1619 } else { 1639 } else {
1620 // No need to check NumTypeArguments() if class has type parameters. 1640 // No need to check NumTypeArguments() if class has type parameters.
1621 return (NumTypeParameters() > 0) || (NumTypeArguments() > 0); 1641 return (NumTypeParameters() > 0) || (NumTypeArguments() > 0);
1622 } 1642 }
1623 } 1643 }
1624 1644
1625 1645
1626 RawClass* Class::SuperClass() const { 1646 RawClass* Class::SuperClass() const {
1627 if (super_type() == Type::null()) { 1647 if (super_type() == AbstractType::null()) {
1628 return Class::null(); 1648 return Class::null();
1629 } 1649 }
1630 const AbstractType& sup_type = AbstractType::Handle(super_type()); 1650 const AbstractType& sup_type = AbstractType::Handle(super_type());
1631 return sup_type.type_class(); 1651 return sup_type.type_class();
1632 } 1652 }
1633 1653
1634 1654
1635 void Class::set_super_type(const AbstractType& value) const { 1655 void Class::set_super_type(const AbstractType& value) const {
1636 ASSERT(value.IsNull() || 1656 ASSERT(value.IsNull() ||
1637 value.IsType() || 1657 value.IsType() ||
(...skipping 3235 matching lines...) Expand 10 before | Expand all | Expand 10 after
4873 bool is_static, 4893 bool is_static,
4874 bool is_final, 4894 bool is_final,
4875 bool is_const, 4895 bool is_const,
4876 const Class& owner, 4896 const Class& owner,
4877 intptr_t token_pos) { 4897 intptr_t token_pos) {
4878 ASSERT(!owner.IsNull()); 4898 ASSERT(!owner.IsNull());
4879 const Field& result = Field::Handle(Field::New()); 4899 const Field& result = Field::Handle(Field::New());
4880 result.set_name(name); 4900 result.set_name(name);
4881 result.set_is_static(is_static); 4901 result.set_is_static(is_static);
4882 if (is_static) { 4902 if (is_static) {
4883 result.set_value(Instance::null_object()); 4903 result.set_value(Object::null_instance());
4884 } else { 4904 } else {
4885 result.SetOffset(0); 4905 result.SetOffset(0);
4886 } 4906 }
4887 result.set_is_final(is_final); 4907 result.set_is_final(is_final);
4888 result.set_is_const(is_const); 4908 result.set_is_const(is_const);
4889 result.set_owner(owner); 4909 result.set_owner(owner);
4890 result.set_token_pos(token_pos); 4910 result.set_token_pos(token_pos);
4891 result.set_has_initializer(false); 4911 result.set_has_initializer(false);
4892 result.set_guarded_cid(kIllegalCid); 4912 result.set_guarded_cid(kIllegalCid);
4893 result.set_is_nullable(false); 4913 result.set_is_nullable(false);
4894 result.set_dependent_code(Array::null_object()); 4914 result.set_dependent_code(Object::null_array());
4895 return result.raw(); 4915 return result.raw();
4896 } 4916 }
4897 4917
4898 4918
4899 4919
4900 RawField* Field::Clone(const Class& new_owner) const { 4920 RawField* Field::Clone(const Class& new_owner) const {
4901 Field& clone = Field::Handle(); 4921 Field& clone = Field::Handle();
4902 clone ^= Object::Clone(*this, Heap::kOld); 4922 clone ^= Object::Clone(*this, Heap::kOld);
4903 const Class& owner = Class::Handle(this->owner()); 4923 const Class& owner = Class::Handle(this->owner());
4904 const PatchClass& clone_owner = 4924 const PatchClass& clone_owner =
4905 PatchClass::Handle(PatchClass::New(new_owner, owner)); 4925 PatchClass::Handle(PatchClass::New(new_owner, owner));
4906 clone.set_owner(clone_owner); 4926 clone.set_owner(clone_owner);
4907 clone.set_dependent_code(Array::null_object()); 4927 clone.set_dependent_code(Object::null_array());
4908 if (!clone.is_static()) { 4928 if (!clone.is_static()) {
4909 clone.SetOffset(0); 4929 clone.SetOffset(0);
4910 } 4930 }
4911 return clone.raw(); 4931 return clone.raw();
4912 } 4932 }
4913 4933
4914 4934
4915 RawString* Field::UserVisibleName() const { 4935 RawString* Field::UserVisibleName() const {
4916 const String& str = String::Handle(name()); 4936 const String& str = String::Handle(name());
4917 return IdentifierPrettyName(str); 4937 return IdentifierPrettyName(str);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 return false; 5011 return false;
4992 } 5012 }
4993 5013
4994 5014
4995 void Field::DeoptimizeDependentCode() const { 5015 void Field::DeoptimizeDependentCode() const {
4996 const Array& code_objects = Array::Handle(dependent_code()); 5016 const Array& code_objects = Array::Handle(dependent_code());
4997 5017
4998 if (code_objects.IsNull()) { 5018 if (code_objects.IsNull()) {
4999 return; 5019 return;
5000 } 5020 }
5001 set_dependent_code(Array::null_object()); 5021 set_dependent_code(Object::null_array());
5002 5022
5003 // Deoptimize all dependent code on the stack. 5023 // Deoptimize all dependent code on the stack.
5004 Code& code = Code::Handle(); 5024 Code& code = Code::Handle();
5005 { 5025 {
5006 DartFrameIterator iterator; 5026 DartFrameIterator iterator;
5007 StackFrame* frame = iterator.NextFrame(); 5027 StackFrame* frame = iterator.NextFrame();
5008 while (frame != NULL) { 5028 while (frame != NULL) {
5009 code = frame->LookupDartCode(); 5029 code = frame->LookupDartCode();
5010 if (IsDependentCode(code_objects, code)) { 5030 if (IsDependentCode(code_objects, code)) {
5011 DeoptimizeAt(code, frame->pc()); 5031 DeoptimizeAt(code, frame->pc());
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
5636 } else if (obj.IsSmi()) { 5656 } else if (obj.IsSmi()) {
5637 Token::Kind kind = static_cast<Token::Kind>( 5657 Token::Kind kind = static_cast<Token::Kind>(
5638 Smi::Value(reinterpret_cast<RawSmi*>(obj.raw()))); 5658 Smi::Value(reinterpret_cast<RawSmi*>(obj.raw())));
5639 ASSERT(kind < Token::kNumTokens); 5659 ASSERT(kind < Token::kNumTokens);
5640 if (Token::IsPseudoKeyword(kind) || Token::IsKeyword(kind)) { 5660 if (Token::IsPseudoKeyword(kind) || Token::IsKeyword(kind)) {
5641 Isolate* isolate = Isolate::Current(); 5661 Isolate* isolate = Isolate::Current();
5642 ObjectStore* object_store = isolate->object_store(); 5662 ObjectStore* object_store = isolate->object_store();
5643 const Array& symbols = Array::Handle(isolate, 5663 const Array& symbols = Array::Handle(isolate,
5644 object_store->keyword_symbols()); 5664 object_store->keyword_symbols());
5645 ASSERT(!symbols.IsNull()); 5665 ASSERT(!symbols.IsNull());
5646 ASSERT(symbols.At(kind - Token::kFirstKeyword) != String::null()); 5666 ASSERT(symbols.At(kind - Token::kFirstKeyword) != Object::null());
5647 return String::RawCast(symbols.At(kind - Token::kFirstKeyword)); 5667 return String::RawCast(symbols.At(kind - Token::kFirstKeyword));
5648 } 5668 }
5649 return Symbols::New(Token::Str(kind)); 5669 return Symbols::New(Token::Str(kind));
5650 } else { 5670 } else {
5651 ASSERT(obj.IsLiteralToken()); // Must be a literal token. 5671 ASSERT(obj.IsLiteralToken()); // Must be a literal token.
5652 const LiteralToken& literal_token = LiteralToken::Cast(obj); 5672 const LiteralToken& literal_token = LiteralToken::Cast(obj);
5653 return literal_token.literal(); 5673 return literal_token.literal();
5654 } 5674 }
5655 } 5675 }
5656 5676
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
6521 result.raw_ptr()->corelib_imported_ = true; 6541 result.raw_ptr()->corelib_imported_ = true;
6522 result.set_debuggable(false); 6542 result.set_debuggable(false);
6523 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; 6543 result.raw_ptr()->load_state_ = RawLibrary::kAllocated;
6524 result.raw_ptr()->index_ = -1; 6544 result.raw_ptr()->index_ = -1;
6525 result.InitClassDictionary(); 6545 result.InitClassDictionary();
6526 result.InitImportList(); 6546 result.InitImportList();
6527 if (import_core_lib) { 6547 if (import_core_lib) {
6528 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 6548 const Library& core_lib = Library::Handle(Library::CoreLibrary());
6529 ASSERT(!core_lib.IsNull()); 6549 ASSERT(!core_lib.IsNull());
6530 const Namespace& ns = Namespace::Handle( 6550 const Namespace& ns = Namespace::Handle(
6531 Namespace::New(core_lib, Array::null_object(), Array::null_object())); 6551 Namespace::New(core_lib, Object::null_array(), Object::null_array()));
6532 result.AddImport(ns); 6552 result.AddImport(ns);
6533 } 6553 }
6534 return result.raw(); 6554 return result.raw();
6535 } 6555 }
6536 6556
6537 6557
6538 RawLibrary* Library::New(const String& url) { 6558 RawLibrary* Library::New(const String& url) {
6539 return NewLibraryHelper(url, false); 6559 return NewLibraryHelper(url, false);
6540 } 6560 }
6541 6561
6542 6562
6543 void Library::InitCoreLibrary(Isolate* isolate) { 6563 void Library::InitCoreLibrary(Isolate* isolate) {
6544 const String& core_lib_url = Symbols::DartCore(); 6564 const String& core_lib_url = Symbols::DartCore();
6545 const Library& core_lib = 6565 const Library& core_lib =
6546 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); 6566 Library::Handle(Library::NewLibraryHelper(core_lib_url, false));
6547 core_lib.Register(); 6567 core_lib.Register();
6548 isolate->object_store()->set_bootstrap_library(ObjectStore::kCore, core_lib); 6568 isolate->object_store()->set_bootstrap_library(ObjectStore::kCore, core_lib);
6549 isolate->object_store()->set_root_library(Library::null_object()); 6569 isolate->object_store()->set_root_library(Library::Handle());
6550 6570
6551 // Hook up predefined classes without setting their library pointers. These 6571 // Hook up predefined classes without setting their library pointers. These
6552 // classes are coming from the VM isolate, and are shared between multiple 6572 // classes are coming from the VM isolate, and are shared between multiple
6553 // isolates so setting their library pointers would be wrong. 6573 // isolates so setting their library pointers would be wrong.
6554 const Class& cls = Class::Handle(Object::dynamic_class()); 6574 const Class& cls = Class::Handle(Object::dynamic_class());
6555 core_lib.AddObject(cls, String::Handle(cls.Name())); 6575 core_lib.AddObject(cls, String::Handle(cls.Name()));
6556 } 6576 }
6557 6577
6558 6578
6559 void Library::InitNativeWrappersLibrary(Isolate* isolate) { 6579 void Library::InitNativeWrappersLibrary(Isolate* isolate) {
(...skipping 6003 matching lines...) Expand 10 before | Expand all | Expand 10 after
12563 StorePointer(&(raw_ptr()->data_), new_contents.raw()); 12583 StorePointer(&(raw_ptr()->data_), new_contents.raw());
12564 } 12584 }
12565 12585
12566 12586
12567 RawObject* GrowableObjectArray::RemoveLast() const { 12587 RawObject* GrowableObjectArray::RemoveLast() const {
12568 ASSERT(!IsNull()); 12588 ASSERT(!IsNull());
12569 ASSERT(Length() > 0); 12589 ASSERT(Length() > 0);
12570 intptr_t index = Length() - 1; 12590 intptr_t index = Length() - 1;
12571 const Array& contents = Array::Handle(data()); 12591 const Array& contents = Array::Handle(data());
12572 const Object& obj = Object::Handle(contents.At(index)); 12592 const Object& obj = Object::Handle(contents.At(index));
12573 contents.SetAt(index, null_object()); 12593 contents.SetAt(index, Object::null_object());
12574 SetLength(index); 12594 SetLength(index);
12575 return obj.raw(); 12595 return obj.raw();
12576 } 12596 }
12577 12597
12578 12598
12579 bool GrowableObjectArray::Equals(const Instance& other) const { 12599 bool GrowableObjectArray::Equals(const Instance& other) const {
12580 // If both handles point to the same raw instance they are equal. 12600 // If both handles point to the same raw instance they are equal.
12581 if (this->raw() == other.raw()) { 12601 if (this->raw() == other.raw()) {
12582 return true; 12602 return true;
12583 } 12603 }
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
13305 space); 13325 space);
13306 return reinterpret_cast<RawWeakProperty*>(raw); 13326 return reinterpret_cast<RawWeakProperty*>(raw);
13307 } 13327 }
13308 13328
13309 13329
13310 const char* WeakProperty::ToCString() const { 13330 const char* WeakProperty::ToCString() const {
13311 return "_WeakProperty"; 13331 return "_WeakProperty";
13312 } 13332 }
13313 13333
13314 } // namespace dart 13334 } // namespace dart
OLDNEW
« 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