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

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

Issue 10861041: Provide an Expando implementation for the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: make WeakProperty private 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/symbols.h » ('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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 const Class& cls = Class::Handle( 437 const Class& cls = Class::Handle(
438 Class::NewInterface(name, script, Scanner::kDummyTokenIndex)); 438 Class::NewInterface(name, script, Scanner::kDummyTokenIndex));
439 lib.AddClass(cls); 439 lib.AddClass(cls);
440 return cls.raw(); 440 return cls.raw();
441 } 441 }
442 442
443 443
444 void Object::RegisterClass(const Class& cls, 444 void Object::RegisterClass(const Class& cls,
445 const String& name, 445 const String& name,
446 const Library& lib) { 446 const Library& lib) {
447 ASSERT(name.Length() > 0);
448 ASSERT(name.CharAt(0) != '_');
447 cls.set_name(name); 449 cls.set_name(name);
448 lib.AddClass(cls); 450 lib.AddClass(cls);
449 } 451 }
450 452
451 453
452 void Object::RegisterPrivateClass(const Class& cls, 454 void Object::RegisterPrivateClass(const Class& cls,
453 const String& public_class_name, 455 const String& public_class_name,
454 const Library& lib) { 456 const Library& lib) {
457 ASSERT(public_class_name.Length() > 0);
458 ASSERT(public_class_name.CharAt(0) == '_');
455 String& str = String::Handle(); 459 String& str = String::Handle();
456 str = lib.PrivateName(public_class_name); 460 str = lib.PrivateName(public_class_name);
457 cls.set_name(str); 461 cls.set_name(str);
458 lib.AddClass(cls); 462 lib.AddClass(cls);
459 } 463 }
460 464
461 465
462 RawError* Object::Init(Isolate* isolate) { 466 RawError* Object::Init(Isolate* isolate) {
463 TIMERSCOPE(time_bootstrap); 467 TIMERSCOPE(time_bootstrap);
464 ObjectStore* object_store = isolate->object_store(); 468 ObjectStore* object_store = isolate->object_store();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 RegisterClass(cls, name, core_impl_lib); 621 RegisterClass(cls, name, core_impl_lib);
618 pending_classes.Add(cls, Heap::kOld); 622 pending_classes.Add(cls, Heap::kOld);
619 // Super type set below, after Object is allocated. 623 // Super type set below, after Object is allocated.
620 624
621 cls = Class::New<JSRegExp>(); 625 cls = Class::New<JSRegExp>();
622 object_store->set_jsregexp_class(cls); 626 object_store->set_jsregexp_class(cls);
623 name = Symbols::JSSyntaxRegExp(); 627 name = Symbols::JSSyntaxRegExp();
624 RegisterClass(cls, name, core_impl_lib); 628 RegisterClass(cls, name, core_impl_lib);
625 pending_classes.Add(cls, Heap::kOld); 629 pending_classes.Add(cls, Heap::kOld);
626 630
627 cls = Class::New<WeakProperty>();
628 object_store->set_weak_property_class(cls);
629 name = Symbols::WeakProperty();
630 RegisterClass(cls, name, core_impl_lib);
631 pending_classes.Add(cls, Heap::kOld);
632
633 // Initialize the base interfaces used by the core VM classes. 631 // Initialize the base interfaces used by the core VM classes.
634 const Script& script = Script::Handle(Bootstrap::LoadCoreScript(false)); 632 const Script& script = Script::Handle(Bootstrap::LoadCoreScript(false));
635 633
636 // Allocate and initialize the Object class and type. The Object 634 // Allocate and initialize the Object class and type. The Object
637 // class and ByteArray subclasses are the only pre-allocated, 635 // class and ByteArray subclasses are the only pre-allocated,
638 // non-interface classes in the core library. 636 // non-interface classes in the core library.
639 cls = Class::New<Instance>(); 637 cls = Class::New<Instance>();
640 object_store->set_object_class(cls); 638 object_store->set_object_class(cls);
641 name = Symbols::Object(); 639 name = Symbols::Object();
642 cls.set_name(name); 640 cls.set_name(name);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 cls = Class::New<ExternalFloat32Array>(); 738 cls = Class::New<ExternalFloat32Array>();
741 object_store->set_external_float32_array_class(cls); 739 object_store->set_external_float32_array_class(cls);
742 name = Symbols::_ExternalFloat32Array(); 740 name = Symbols::_ExternalFloat32Array();
743 RegisterPrivateClass(cls, name, core_lib); 741 RegisterPrivateClass(cls, name, core_lib);
744 742
745 cls = Class::New<ExternalFloat64Array>(); 743 cls = Class::New<ExternalFloat64Array>();
746 object_store->set_external_float64_array_class(cls); 744 object_store->set_external_float64_array_class(cls);
747 name = Symbols::_ExternalFloat64Array(); 745 name = Symbols::_ExternalFloat64Array();
748 RegisterPrivateClass(cls, name, core_lib); 746 RegisterPrivateClass(cls, name, core_lib);
749 747
748 cls = Class::New<WeakProperty>();
749 object_store->set_weak_property_class(cls);
750 name = Symbols::_WeakProperty();
751 RegisterPrivateClass(cls, name, core_lib);
752
750 // Set the super type of class Stacktrace to Object type so that the 753 // Set the super type of class Stacktrace to Object type so that the
751 // 'toString' method is implemented. 754 // 'toString' method is implemented.
752 cls = object_store->stacktrace_class(); 755 cls = object_store->stacktrace_class();
753 cls.set_super_type(type); 756 cls.set_super_type(type);
754 757
755 cls = CreateAndRegisterInterface("Function", script, core_lib); 758 cls = CreateAndRegisterInterface("Function", script, core_lib);
756 pending_classes.Add(cls, Heap::kOld); 759 pending_classes.Add(cls, Heap::kOld);
757 type = Type::NewNonParameterizedType(cls); 760 type = Type::NewNonParameterizedType(cls);
758 object_store->set_function_interface(type); 761 object_store->set_function_interface(type);
759 762
(...skipping 10377 matching lines...) Expand 10 before | Expand all | Expand 10 after
11137 WeakProperty::InstanceSize(), 11140 WeakProperty::InstanceSize(),
11138 space); 11141 space);
11139 NoGCScope no_gc; 11142 NoGCScope no_gc;
11140 result ^= raw; 11143 result ^= raw;
11141 } 11144 }
11142 return result.raw(); 11145 return result.raw();
11143 } 11146 }
11144 11147
11145 11148
11146 const char* WeakProperty::ToCString() const { 11149 const char* WeakProperty::ToCString() const {
11147 return "WeakProperty"; 11150 return "_WeakProperty";
11148 } 11151 }
11149 11152
11150 } // namespace dart 11153 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698