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

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

Issue 18242003: Add a VM defined class MirrorReference as an opaque pointer for Dart code to VM internal objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 922
923 cls = Class::New<Double>(); 923 cls = Class::New<Double>();
924 object_store->set_double_class(cls); 924 object_store->set_double_class(cls);
925 RegisterPrivateClass(cls, Symbols::_Double(), core_lib); 925 RegisterPrivateClass(cls, Symbols::_Double(), core_lib);
926 pending_classes.Add(cls, Heap::kOld); 926 pending_classes.Add(cls, Heap::kOld);
927 927
928 cls = Class::New<WeakProperty>(); 928 cls = Class::New<WeakProperty>();
929 object_store->set_weak_property_class(cls); 929 object_store->set_weak_property_class(cls);
930 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); 930 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
931 931
932 cls = Class::New<VMReference>();
933 object_store->set_vm_reference_class(cls);
934 RegisterPrivateClass(cls, Symbols::_VMReference(), core_lib);
935
932 // Setup some default native field classes which can be extended for 936 // Setup some default native field classes which can be extended for
933 // specifying native fields in dart classes. 937 // specifying native fields in dart classes.
934 Library::InitNativeWrappersLibrary(isolate); 938 Library::InitNativeWrappersLibrary(isolate);
935 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); 939 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null());
936 940
937 // Pre-register the typed_data library so the native class implementations 941 // Pre-register the typed_data library so the native class implementations
938 // can be hooked up before compiling it. 942 // can be hooked up before compiling it.
939 lib = Library::LookupLibrary(Symbols::DartTypedData()); 943 lib = Library::LookupLibrary(Symbols::DartTypedData());
940 if (lib.IsNull()) { 944 if (lib.IsNull()) {
941 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); 945 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 object_store->set_jsregexp_class(cls); 1196 object_store->set_jsregexp_class(cls);
1193 1197
1194 // Some classes are not stored in the object store. Yet we still need to 1198 // Some classes are not stored in the object store. Yet we still need to
1195 // create their Class object so that they get put into the class_table 1199 // create their Class object so that they get put into the class_table
1196 // (as a side effect of Class::New()). 1200 // (as a side effect of Class::New()).
1197 cls = Class::New<DartFunction>(); 1201 cls = Class::New<DartFunction>();
1198 cls = Class::New<Number>(); 1202 cls = Class::New<Number>();
1199 1203
1200 cls = Class::New<WeakProperty>(); 1204 cls = Class::New<WeakProperty>();
1201 object_store->set_weak_property_class(cls); 1205 object_store->set_weak_property_class(cls);
1206
1207 cls = Class::New<VMReference>();
1208 object_store->set_vm_reference_class(cls);
1202 } 1209 }
1203 1210
1204 1211
1205 void Object::Print() const { 1212 void Object::Print() const {
1206 OS::Print("%s\n", ToCString()); 1213 OS::Print("%s\n", ToCString());
1207 } 1214 }
1208 1215
1209 1216
1210 RawString* Object::DictionaryName() const { 1217 RawString* Object::DictionaryName() const {
1211 return String::null(); 1218 return String::null();
(...skipping 12452 matching lines...) Expand 10 before | Expand all | Expand 10 after
13664 WeakProperty::InstanceSize(), 13671 WeakProperty::InstanceSize(),
13665 space); 13672 space);
13666 return reinterpret_cast<RawWeakProperty*>(raw); 13673 return reinterpret_cast<RawWeakProperty*>(raw);
13667 } 13674 }
13668 13675
13669 13676
13670 const char* WeakProperty::ToCString() const { 13677 const char* WeakProperty::ToCString() const {
13671 return "_WeakProperty"; 13678 return "_WeakProperty";
13672 } 13679 }
13673 13680
13681
13682 RawVMReference* VMReference::New(Heap::Space space) {
13683 ASSERT(Isolate::Current()->object_store()->vm_reference_class()
13684 != Class::null());
13685 RawObject* raw = Object::Allocate(VMReference::kClassId,
13686 VMReference::InstanceSize(),
13687 space);
13688 return reinterpret_cast<RawVMReference*>(raw);
13689 }
siva 2013/06/30 01:12:48 Need to add unit tests in object_test.cc creating
rmacnak 2013/07/01 18:35:49 Added
13690
13691
13692 const char* VMReference::ToCString() const {
13693 return "_VMReference";
13694 }
13695
13696
13674 } // namespace dart 13697 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698