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

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

Issue 12313088: First step towards implementing dart:typeddata library. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 ASSERT(!scalarlist_lib.IsNull()); 1087 ASSERT(!scalarlist_lib.IsNull());
1088 error = Bootstrap::Compile(scalarlist_lib, scalarlist_script); 1088 error = Bootstrap::Compile(scalarlist_lib, scalarlist_script);
1089 if (!error.IsNull()) { 1089 if (!error.IsNull()) {
1090 return error.raw(); 1090 return error.raw();
1091 } 1091 }
1092 patch_script = Bootstrap::LoadScalarlistScript(true); 1092 patch_script = Bootstrap::LoadScalarlistScript(true);
1093 error = scalarlist_lib.Patch(patch_script); 1093 error = scalarlist_lib.Patch(patch_script);
1094 if (!error.IsNull()) { 1094 if (!error.IsNull()) {
1095 return error.raw(); 1095 return error.raw();
1096 } 1096 }
1097
1098 Library::InitTypedDataLibrary(isolate);
1099 Library& typeddata_lib = Library::Handle(Library::TypedDataLibrary());
1100 ASSERT(!typeddata_lib.IsNull());
1101 const Script& typeddata_script = Script::Handle(
1102 Bootstrap::LoadTypedDataScript(false));
1103 error = Bootstrap::Compile(typeddata_lib, typeddata_script);
1104 if (!error.IsNull()) {
1105 return error.raw();
1106 }
1107 patch_script = Bootstrap::LoadTypedDataScript(true);
1108 error = typeddata_lib.Patch(patch_script);
1109 if (!error.IsNull()) {
1110 return error.raw();
1111 }
1112
1097 Library& lib = Library::Handle(); 1113 Library& lib = Library::Handle();
1098 INIT_LIBRARY(Crypto, 1114 INIT_LIBRARY(Crypto,
1099 Bootstrap::LoadCryptoScript(false), 1115 Bootstrap::LoadCryptoScript(false),
1100 Library::CryptoLibrary()); 1116 Library::CryptoLibrary());
1101 INIT_LIBRARY(Json, 1117 INIT_LIBRARY(Json,
1102 Bootstrap::LoadJsonScript(false), 1118 Bootstrap::LoadJsonScript(false),
1103 Library::JsonLibrary()); 1119 Library::JsonLibrary());
1104 patch_script = Bootstrap::LoadJsonScript(true); 1120 patch_script = Bootstrap::LoadJsonScript(true);
1105 error = lib.Patch(patch_script); 1121 error = lib.Patch(patch_script);
1106 if (!error.IsNull()) { 1122 if (!error.IsNull()) {
(...skipping 5396 matching lines...) Expand 10 before | Expand all | Expand 10 after
6503 lib.Register(); 6519 lib.Register();
6504 const Library& collection_lib = 6520 const Library& collection_lib =
6505 Library::Handle(Library::CollectionLibrary()); 6521 Library::Handle(Library::CollectionLibrary());
6506 const Namespace& collection_ns = Namespace::Handle( 6522 const Namespace& collection_ns = Namespace::Handle(
6507 Namespace::New(collection_lib, Array::Handle(), Array::Handle())); 6523 Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
6508 lib.AddImport(collection_ns); 6524 lib.AddImport(collection_ns);
6509 isolate->object_store()->set_scalarlist_library(lib); 6525 isolate->object_store()->set_scalarlist_library(lib);
6510 } 6526 }
6511 6527
6512 6528
6529 void Library::InitTypedDataLibrary(Isolate* isolate) {
6530 const Array& null_array = Array::Handle();
6531 Library& import_lib = Library::Handle();
6532 Namespace& import_ns = Namespace::Handle();
6533 const String& url = Symbols::DartTypedData();
6534 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6535 lib.Register();
6536
6537 import_lib = Library::CollectionLibrary();
6538 import_ns = Namespace::New(import_lib, null_array, null_array);
6539 lib.AddImport(import_ns);
6540
6541 const String& import_prefix = String::Handle(Symbols::New("sl"));
6542 import_lib = Library::ScalarlistLibrary();
6543 import_ns = Namespace::New(import_lib, null_array, null_array);
6544 const LibraryPrefix& library_prefix = LibraryPrefix::Handle(
6545 LibraryPrefix::New(import_prefix, import_ns));
6546 lib.AddObject(library_prefix, import_prefix);
6547 isolate->object_store()->set_typeddata_library(lib);
6548 }
6549
6550
6513 void Library::InitUriLibrary(Isolate* isolate) { 6551 void Library::InitUriLibrary(Isolate* isolate) {
6514 const String& url = Symbols::DartUri(); 6552 const String& url = Symbols::DartUri();
6515 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6553 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6516 lib.Register(); 6554 lib.Register();
6517 const Library& math_lib = Library::Handle(Library::MathLibrary()); 6555 const Library& math_lib = Library::Handle(Library::MathLibrary());
6518 const Namespace& math_ns = Namespace::Handle( 6556 const Namespace& math_ns = Namespace::Handle(
6519 Namespace::New(math_lib, Array::Handle(), Array::Handle())); 6557 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6520 const Library& utf_lib = Library::Handle(Library::UtfLibrary()); 6558 const Library& utf_lib = Library::Handle(Library::UtfLibrary());
6521 const Namespace& utf_ns = Namespace::Handle( 6559 const Namespace& utf_ns = Namespace::Handle(
6522 Namespace::New(utf_lib, Array::Handle(), Array::Handle())); 6560 Namespace::New(utf_lib, Array::Handle(), Array::Handle()));
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
6679 RawLibrary* Library::NativeWrappersLibrary() { 6717 RawLibrary* Library::NativeWrappersLibrary() {
6680 return Isolate::Current()->object_store()->native_wrappers_library(); 6718 return Isolate::Current()->object_store()->native_wrappers_library();
6681 } 6719 }
6682 6720
6683 6721
6684 RawLibrary* Library::ScalarlistLibrary() { 6722 RawLibrary* Library::ScalarlistLibrary() {
6685 return Isolate::Current()->object_store()->scalarlist_library(); 6723 return Isolate::Current()->object_store()->scalarlist_library();
6686 } 6724 }
6687 6725
6688 6726
6727 RawLibrary* Library::TypedDataLibrary() {
6728 return Isolate::Current()->object_store()->typeddata_library();
6729 }
6730
6731
6689 RawLibrary* Library::UriLibrary() { 6732 RawLibrary* Library::UriLibrary() {
6690 return Isolate::Current()->object_store()->uri_library(); 6733 return Isolate::Current()->object_store()->uri_library();
6691 } 6734 }
6692 6735
6693 6736
6694 RawLibrary* Library::UtfLibrary() { 6737 RawLibrary* Library::UtfLibrary() {
6695 return Isolate::Current()->object_store()->utf_library(); 6738 return Isolate::Current()->object_store()->utf_library();
6696 } 6739 }
6697 6740
6698 6741
(...skipping 6321 matching lines...) Expand 10 before | Expand all | Expand 10 after
13020 } 13063 }
13021 return result.raw(); 13064 return result.raw();
13022 } 13065 }
13023 13066
13024 13067
13025 const char* WeakProperty::ToCString() const { 13068 const char* WeakProperty::ToCString() const {
13026 return "_WeakProperty"; 13069 return "_WeakProperty";
13027 } 13070 }
13028 13071
13029 } // namespace dart 13072 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698