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

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

Issue 12318031: Move json, uri, utf and crypto libraries into the VM. (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
« no previous file with comments | « runtime/vm/bootstrap.h ('k') | runtime/vm/bootstrap_nocorelib.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/bootstrap.h" 5 #include "vm/bootstrap.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/bootstrap_natives.h" 9 #include "vm/bootstrap_natives.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 50
51 RawScript* Bootstrap::LoadCollectionDevScript(bool patch) { 51 RawScript* Bootstrap::LoadCollectionDevScript(bool patch) {
52 const char* url = 52 const char* url =
53 patch ? "dart:_collection-dev-patch" : "dart:_collection-dev"; 53 patch ? "dart:_collection-dev-patch" : "dart:_collection-dev";
54 const char* source = patch ? collection_dev_source_ : collection_dev_source_; 54 const char* source = patch ? collection_dev_source_ : collection_dev_source_;
55 return LoadScript(url, source, patch); 55 return LoadScript(url, source, patch);
56 } 56 }
57 57
58 58
59 RawScript* Bootstrap::LoadMathScript(bool patch) { 59 RawScript* Bootstrap::LoadCryptoScript(bool patch) {
60 const char* url = patch ? "dart:math-patch" : "dart:math"; 60 const char* url = patch ? "dart:crypto-patch" : "dart:crypto";
61 const char* source = patch ? math_patch_ : math_source_; 61 const char* source = patch ? crypto_source_ : crypto_source_;
62 return LoadScript(url, source, patch); 62 return LoadScript(url, source, patch);
63 } 63 }
64 64
65 65
66 RawScript* Bootstrap::LoadIsolateScript(bool patch) { 66 RawScript* Bootstrap::LoadIsolateScript(bool patch) {
67 const char* url = patch ? "dart:isolate-patch" : "dart:isolate"; 67 const char* url = patch ? "dart:isolate-patch" : "dart:isolate";
68 const char* source = patch ? isolate_patch_ : isolate_source_; 68 const char* source = patch ? isolate_patch_ : isolate_source_;
69 return LoadScript(url, source, patch); 69 return LoadScript(url, source, patch);
70 } 70 }
71 71
72 72
73 RawScript* Bootstrap::LoadJsonScript(bool patch) {
74 const char* url = patch ? "dart:json-patch" : "dart:json";
75 const char* source = patch ? json_source_ : json_source_;
76 return LoadScript(url, source, patch);
77 }
78
79
80 RawScript* Bootstrap::LoadMathScript(bool patch) {
81 const char* url = patch ? "dart:math-patch" : "dart:math";
82 const char* source = patch ? math_patch_ : math_source_;
83 return LoadScript(url, source, patch);
84 }
85
86
73 RawScript* Bootstrap::LoadMirrorsScript(bool patch) { 87 RawScript* Bootstrap::LoadMirrorsScript(bool patch) {
74 const char* url = patch ? "dart:mirrors-patch" : "dart:mirrors"; 88 const char* url = patch ? "dart:mirrors-patch" : "dart:mirrors";
75 const char* source = patch ? mirrors_patch_ : mirrors_source_; 89 const char* source = patch ? mirrors_patch_ : mirrors_source_;
76 return LoadScript(url, source, patch); 90 return LoadScript(url, source, patch);
77 } 91 }
78 92
79 93
80 RawScript* Bootstrap::LoadScalarlistScript(bool patch) { 94 RawScript* Bootstrap::LoadScalarlistScript(bool patch) {
81 const char* url = patch ? "dart:scalarlist_patch" : "dart:scalarlist"; 95 const char* url = patch ? "dart:scalarlist_patch" : "dart:scalarlist";
82 const char* source = patch ? scalarlist_patch_ : scalarlist_source_; 96 const char* source = patch ? scalarlist_patch_ : scalarlist_source_;
83 return LoadScript(url, source, patch); 97 return LoadScript(url, source, patch);
84 } 98 }
85 99
86 100
101 RawScript* Bootstrap::LoadUriScript(bool patch) {
102 const char* url = patch ? "dart:uri-patch" : "dart:uri";
103 const char* source = patch ? uri_source_ : uri_source_;
104 return LoadScript(url, source, patch);
105 }
106
107
108 RawScript* Bootstrap::LoadUtfScript(bool patch) {
109 const char* url = patch ? "dart:utf-patch" : "dart:utf";
110 const char* source = patch ? utf_source_ : utf_source_;
111 return LoadScript(url, source, patch);
112 }
113
114
87 RawError* Bootstrap::Compile(const Library& library, const Script& script) { 115 RawError* Bootstrap::Compile(const Library& library, const Script& script) {
88 if (FLAG_print_bootstrap) { 116 if (FLAG_print_bootstrap) {
89 OS::Print("Bootstrap source '%s':\n%s\n", 117 OS::Print("Bootstrap source '%s':\n%s\n",
90 String::Handle(script.url()).ToCString(), 118 String::Handle(script.url()).ToCString(),
91 String::Handle(script.Source()).ToCString()); 119 String::Handle(script.Source()).ToCString());
92 } 120 }
93 library.SetLoadInProgress(); 121 library.SetLoadInProgress();
94 const Error& error = Error::Handle(Compiler::Compile(library, script)); 122 const Error& error = Error::Handle(Compiler::Compile(library, script));
95 if (error.IsNull()) { 123 if (error.IsNull()) {
96 library.SetLoaded(); 124 library.SetLoaded();
97 } else { 125 } else {
98 library.SetLoadError(); 126 library.SetLoadError();
99 } 127 }
100 return error.raw(); 128 return error.raw();
101 } 129 }
102 130
103 } // namespace dart 131 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap.h ('k') | runtime/vm/bootstrap_nocorelib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698