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

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

Issue 3010543002: Rename the class "KernelReader" to "KernelLoader". (Closed)
Patch Set: Fix alphabetical order in vm_sources.gni. Created 3 years, 3 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
« no previous file with comments | « runtime/vm/bootstrap_nocore.cc ('k') | runtime/vm/debugger.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "lib/stacktrace.h" 9 #include "lib/stacktrace.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
11 #include "vm/class_finalizer.h" 11 #include "vm/class_finalizer.h"
12 #include "vm/clustered_snapshot.h" 12 #include "vm/clustered_snapshot.h"
13 #include "vm/compilation_trace.h" 13 #include "vm/compilation_trace.h"
14 #include "vm/compiler.h" 14 #include "vm/compiler.h"
15 #include "vm/dart.h" 15 #include "vm/dart.h"
16 #include "vm/dart_api_impl.h" 16 #include "vm/dart_api_impl.h"
17 #include "vm/dart_api_message.h" 17 #include "vm/dart_api_message.h"
18 #include "vm/dart_api_state.h" 18 #include "vm/dart_api_state.h"
19 #include "vm/dart_entry.h" 19 #include "vm/dart_entry.h"
20 #include "vm/debugger.h" 20 #include "vm/debugger.h"
21 #if !defined(DART_PRECOMPILED_RUNTIME) 21 #if !defined(DART_PRECOMPILED_RUNTIME)
22 #include "vm/kernel_reader.h" 22 #include "vm/kernel_loader.h"
23 #endif 23 #endif
24 #include "vm/exceptions.h" 24 #include "vm/exceptions.h"
25 #include "vm/flags.h" 25 #include "vm/flags.h"
26 #include "vm/growable_array.h" 26 #include "vm/growable_array.h"
27 #include "vm/isolate_reload.h" 27 #include "vm/isolate_reload.h"
28 #include "vm/kernel_isolate.h" 28 #include "vm/kernel_isolate.h"
29 #include "vm/lockers.h" 29 #include "vm/lockers.h"
30 #include "vm/message.h" 30 #include "vm/message.h"
31 #include "vm/message_handler.h" 31 #include "vm/message_handler.h"
32 #include "vm/native_entry.h" 32 #include "vm/native_entry.h"
(...skipping 4937 matching lines...) Expand 10 before | Expand all | Expand 10 after
4970 } 4970 }
4971 } 4971 }
4972 4972
4973 #if !defined(DART_PRECOMPILED_RUNTIME) 4973 #if !defined(DART_PRECOMPILED_RUNTIME)
4974 static Dart_Handle LoadKernelProgram(Thread* T, 4974 static Dart_Handle LoadKernelProgram(Thread* T,
4975 const String& url, 4975 const String& url,
4976 void* kernel) { 4976 void* kernel) {
4977 // NOTE: Now the VM owns the [kernel_program] memory! 4977 // NOTE: Now the VM owns the [kernel_program] memory!
4978 // We will promptly delete it when done. 4978 // We will promptly delete it when done.
4979 kernel::Program* program = reinterpret_cast<kernel::Program*>(kernel); 4979 kernel::Program* program = reinterpret_cast<kernel::Program*>(kernel);
4980 kernel::KernelReader reader(program); 4980 kernel::KernelLoader loader(program);
4981 const Object& tmp = reader.ReadProgram(); 4981 const Object& tmp = loader.LoadProgram();
4982 delete program; 4982 delete program;
4983 return Api::NewHandle(T, tmp.raw()); 4983 return Api::NewHandle(T, tmp.raw());
4984 } 4984 }
4985 #endif 4985 #endif
4986 4986
4987 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, 4987 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
4988 Dart_Handle resolved_url, 4988 Dart_Handle resolved_url,
4989 Dart_Handle source, 4989 Dart_Handle source,
4990 intptr_t line_offset, 4990 intptr_t line_offset,
4991 intptr_t column_offset) { 4991 intptr_t column_offset) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5027 RETURN_NULL_ERROR(source); 5027 RETURN_NULL_ERROR(source);
5028 } 5028 }
5029 void* kernel_pgm = reinterpret_cast<void*>(source); 5029 void* kernel_pgm = reinterpret_cast<void*>(source);
5030 result = LoadKernelProgram(T, resolved_url_str, kernel_pgm); 5030 result = LoadKernelProgram(T, resolved_url_str, kernel_pgm);
5031 if (::Dart_IsError(result)) { 5031 if (::Dart_IsError(result)) {
5032 return result; 5032 return result;
5033 } 5033 }
5034 library ^= Library::LookupLibrary(T, resolved_url_str); 5034 library ^= Library::LookupLibrary(T, resolved_url_str);
5035 if (library.IsNull()) { 5035 if (library.IsNull()) {
5036 // If the URL string does not match, use the library object 5036 // If the URL string does not match, use the library object
5037 // returned by the kernel reader. 5037 // returned by the kernel loader.
5038 library ^= Api::UnwrapHandle(result); 5038 library ^= Api::UnwrapHandle(result);
5039 } 5039 }
5040 if (library.IsNull()) { 5040 if (library.IsNull()) {
5041 return Api::NewError("%s: Unable to load script '%s' correctly.", 5041 return Api::NewError("%s: Unable to load script '%s' correctly.",
5042 CURRENT_FUNC, resolved_url_str.ToCString()); 5042 CURRENT_FUNC, resolved_url_str.ToCString());
5043 } 5043 }
5044 I->object_store()->set_root_library(library); 5044 I->object_store()->set_root_library(library);
5045 return Api::NewHandle(T, library.raw()); 5045 return Api::NewHandle(T, library.raw());
5046 } 5046 }
5047 #endif 5047 #endif
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
5155 const String& library_url = String::Handle(Z, library.url()); 5155 const String& library_url = String::Handle(Z, library.url());
5156 return Api::NewError("%s: A script has already been loaded from '%s'.", 5156 return Api::NewError("%s: A script has already been loaded from '%s'.",
5157 CURRENT_FUNC, library_url.ToCString()); 5157 CURRENT_FUNC, library_url.ToCString());
5158 } 5158 }
5159 CHECK_CALLBACK_STATE(T); 5159 CHECK_CALLBACK_STATE(T);
5160 CHECK_COMPILATION_ALLOWED(I); 5160 CHECK_COMPILATION_ALLOWED(I);
5161 5161
5162 // NOTE: Now the VM owns the [kernel_program] memory! 5162 // NOTE: Now the VM owns the [kernel_program] memory!
5163 // We will promptly delete it when done. 5163 // We will promptly delete it when done.
5164 kernel::Program* program = reinterpret_cast<kernel::Program*>(kernel_program); 5164 kernel::Program* program = reinterpret_cast<kernel::Program*>(kernel_program);
5165 kernel::KernelReader reader(program); 5165 kernel::KernelLoader loader(program);
5166 const Object& tmp = reader.ReadProgram(); 5166 const Object& tmp = loader.LoadProgram();
5167 delete program; 5167 delete program;
5168 5168
5169 if (tmp.IsError()) { 5169 if (tmp.IsError()) {
5170 return Api::NewHandle(T, tmp.raw()); 5170 return Api::NewHandle(T, tmp.raw());
5171 } 5171 }
5172 // TODO(kernel): Setting root library based on whether it has 'main' or not 5172 // TODO(kernel): Setting root library based on whether it has 'main' or not
5173 // is not correct because main can be in the exported namespace of a library 5173 // is not correct because main can be in the exported namespace of a library
5174 // or it could be a getter. 5174 // or it could be a getter.
5175 if (tmp.IsNull()) { 5175 if (tmp.IsNull()) {
5176 return Api::NewError("%s: The binary program does not contain 'main'.", 5176 return Api::NewError("%s: The binary program does not contain 'main'.",
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
6749 #endif 6749 #endif
6750 } 6750 }
6751 6751
6752 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6752 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6753 #ifndef PRODUCT 6753 #ifndef PRODUCT
6754 Profiler::DumpStackTrace(context); 6754 Profiler::DumpStackTrace(context);
6755 #endif 6755 #endif
6756 } 6756 }
6757 6757
6758 } // namespace dart 6758 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_nocore.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698