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

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

Issue 10830045: - Add the ability to protect VirtualMemory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 type = Type::NewNonParameterizedType(cls); 773 type = Type::NewNonParameterizedType(cls);
774 object_store->set_void_type(type); 774 object_store->set_void_type(type);
775 775
776 // The class 'Dynamic' is registered in the class dictionary because its name 776 // The class 'Dynamic' is registered in the class dictionary because its name
777 // is a built-in identifier, rather than a reserved keyword. Its name is not 777 // is a built-in identifier, rather than a reserved keyword. Its name is not
778 // heap allocated, because the class resides in the VM isolate. 778 // heap allocated, because the class resides in the VM isolate.
779 // The corresponding type, the "unknown type", is stored in the object store. 779 // The corresponding type, the "unknown type", is stored in the object store.
780 cls = dynamic_class_; 780 cls = dynamic_class_;
781 type = Type::NewNonParameterizedType(cls); 781 type = Type::NewNonParameterizedType(cls);
782 object_store->set_dynamic_type(type); 782 object_store->set_dynamic_type(type);
783 core_lib.AddClass(cls);
784 783
785 // Allocate pre-initialized values. 784 // Allocate pre-initialized values.
786 Bool& bool_value = Bool::Handle(); 785 Bool& bool_value = Bool::Handle();
787 bool_value = Bool::New(true); 786 bool_value = Bool::New(true);
788 object_store->set_true_value(bool_value); 787 object_store->set_true_value(bool_value);
789 bool_value = Bool::New(false); 788 bool_value = Bool::New(false);
790 object_store->set_false_value(bool_value); 789 object_store->set_false_value(bool_value);
791 790
792 // Setup some default native field classes which can be extended for 791 // Setup some default native field classes which can be extended for
793 // specifying native fields in dart classes. 792 // specifying native fields in dart classes.
(...skipping 5250 matching lines...) Expand 10 before | Expand all | Expand 10 after
6044 isolate->object_store()->set_core_library(core_lib); 6043 isolate->object_store()->set_core_library(core_lib);
6045 const String& core_impl_lib_url = 6044 const String& core_impl_lib_url =
6046 String::Handle(Symbols::New("dart:coreimpl")); 6045 String::Handle(Symbols::New("dart:coreimpl"));
6047 const Library& core_impl_lib = 6046 const Library& core_impl_lib =
6048 Library::Handle(Library::NewLibraryHelper(core_impl_lib_url, false)); 6047 Library::Handle(Library::NewLibraryHelper(core_impl_lib_url, false));
6049 isolate->object_store()->set_core_impl_library(core_impl_lib); 6048 isolate->object_store()->set_core_impl_library(core_impl_lib);
6050 core_impl_lib.Register(); 6049 core_impl_lib.Register();
6051 core_lib.AddImport(core_impl_lib); 6050 core_lib.AddImport(core_impl_lib);
6052 core_impl_lib.AddImport(core_lib); 6051 core_impl_lib.AddImport(core_lib);
6053 isolate->object_store()->set_root_library(Library::Handle()); 6052 isolate->object_store()->set_root_library(Library::Handle());
6053
6054 // Hook up predefined classes without setting their library pointers.
siva 2012/07/27 01:55:00 The comment on top seems more meaningful i.e. //
Ivan Posva 2012/07/27 18:02:56 Added a better comment. The name should actually b
6055 const Class& cls = Class::Handle(Object::dynamic_class());
6056 core_lib.AddObject(cls, String::Handle(cls.Name()));
6054 } 6057 }
6055 6058
6056 6059
6057 void Library::InitMathLibrary(Isolate* isolate) { 6060 void Library::InitMathLibrary(Isolate* isolate) {
6058 const String& url = String::Handle(Symbols::New("dart:math")); 6061 const String& url = String::Handle(Symbols::New("dart:math"));
6059 const Library& lib = Library::Handle(Library::New(url)); 6062 const Library& lib = Library::Handle(Library::New(url));
6060 lib.Register(); 6063 lib.Register();
6061 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); 6064 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
6062 lib.AddImport(core_impl_lib); 6065 lib.AddImport(core_impl_lib);
6063 isolate->object_store()->set_math_library(lib); 6066 isolate->object_store()->set_math_library(lib);
(...skipping 4782 matching lines...) Expand 10 before | Expand all | Expand 10 after
10846 const String& str = String::Handle(pattern()); 10849 const String& str = String::Handle(pattern());
10847 const char* format = "JSRegExp: pattern=%s flags=%s"; 10850 const char* format = "JSRegExp: pattern=%s flags=%s";
10848 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10851 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10849 char* chars = reinterpret_cast<char*>( 10852 char* chars = reinterpret_cast<char*>(
10850 Isolate::Current()->current_zone()->Allocate(len + 1)); 10853 Isolate::Current()->current_zone()->Allocate(len + 1));
10851 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10854 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10852 return chars; 10855 return chars;
10853 } 10856 }
10854 10857
10855 } // namespace dart 10858 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698