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

Side by Side Diff: runtime/bin/builtin.cc

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done Created 4 years, 1 month 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
« no previous file with comments | « no previous file | runtime/bin/gen_snapshot.cc » ('j') | runtime/bin/gen_snapshot.cc » ('J')
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 strlen(source)); 103 strlen(source));
104 } 104 }
105 return src; 105 return src;
106 } 106 }
107 } 107 }
108 return Dart_Null(); // Uri does not exist in path mapping information. 108 return Dart_Null(); // Uri does not exist in path mapping information.
109 } 109 }
110 110
111 111
112 void Builtin::SetNativeResolver(BuiltinLibraryId id) { 112 void Builtin::SetNativeResolver(BuiltinLibraryId id) {
113 UNREACHABLE(); 113 ASSERT(static_cast<int>(id) >= 0);
114 ASSERT(static_cast<int>(id) < num_libs_);
115
116 if (builtin_libraries_[id].has_natives_) {
117 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
118 Dart_Handle library = Dart_LookupLibrary(url);
119 ASSERT(!Dart_IsError(library));
120 // Setup the native resolver for built in library functions.
121 DART_CHECK_VALID(
122 Dart_SetNativeResolver(library, NativeLookup, NativeSymbol));
123 }
114 } 124 }
115 125
116 126
117 Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) { 127 Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) {
118 ASSERT(static_cast<int>(id) >= 0); 128 ASSERT(static_cast<int>(id) >= 0);
119 ASSERT(static_cast<int>(id) < num_libs_); 129 ASSERT(static_cast<int>(id) < num_libs_);
120 130
121 Dart_Handle library = Dart_LoadLibrary(url, Dart_Null(), Source(id), 0, 0); 131 Dart_Handle library = Dart_LoadLibrary(url, Dart_Null(), Source(id), 0, 0);
122 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) { 132 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) {
123 // Setup the native resolver for built in library functions. 133 // Setup the native resolver for built in library functions.
(...skipping 30 matching lines...) Expand all
154 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_); 164 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
155 Dart_Handle library = Dart_LookupLibrary(url); 165 Dart_Handle library = Dart_LookupLibrary(url);
156 if (Dart_IsError(library)) { 166 if (Dart_IsError(library)) {
157 library = LoadLibrary(url, id); 167 library = LoadLibrary(url, id);
158 } 168 }
159 return library; 169 return library;
160 } 170 }
161 171
162 } // namespace bin 172 } // namespace bin
163 } // namespace dart 173 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/gen_snapshot.cc » ('j') | runtime/bin/gen_snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698