OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 "bin/dfe.h" | 5 #include "bin/dfe.h" |
6 #include "bin/dartutils.h" | 6 #include "bin/dartutils.h" |
7 #include "bin/error_exit.h" | 7 #include "bin/error_exit.h" |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include "vm/kernel.h" | 10 #include "vm/kernel.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // recompile the script. | 70 // recompile the script. |
71 Dart_KernelCompilationResult kresult = Dart_CompileToKernel(url_string); | 71 Dart_KernelCompilationResult kresult = Dart_CompileToKernel(url_string); |
72 if (kresult.status != Dart_KernelCompilationStatus_Ok) { | 72 if (kresult.status != Dart_KernelCompilationStatus_Ok) { |
73 return Dart_NewApiError(kresult.error); | 73 return Dart_NewApiError(kresult.error); |
74 } | 74 } |
75 kernel_ir = kresult.kernel; | 75 kernel_ir = kresult.kernel; |
76 kernel_ir_size = kresult.kernel_size; | 76 kernel_ir_size = kresult.kernel_size; |
77 } | 77 } |
78 void* kernel_program = Dart_ReadKernelBinary(kernel_ir, kernel_ir_size); | 78 void* kernel_program = Dart_ReadKernelBinary(kernel_ir, kernel_ir_size); |
79 ASSERT(kernel_program != NULL); | 79 ASSERT(kernel_program != NULL); |
80 Dart_Handle result = Dart_LoadKernel(kernel_program); | 80 Dart_Handle url = Dart_NewStringFromCString(url_string); |
| 81 Dart_Handle result = Dart_LoadScript( |
| 82 url, Dart_Null(), reinterpret_cast<Dart_Handle>(kernel_program), 0, 0); |
81 if (Dart_IsError(result)) { | 83 if (Dart_IsError(result)) { |
82 return result; | 84 return result; |
83 } | 85 } |
84 // Finalize loading. This will complete any futures for completed deferred | 86 // Finalize loading. This will complete any futures for completed deferred |
85 // loads. | 87 // loads. |
86 result = Dart_FinalizeLoading(true); | 88 result = Dart_FinalizeLoading(true); |
87 if (Dart_IsError(result)) { | 89 if (Dart_IsError(result)) { |
88 return result; | 90 return result; |
89 } | 91 } |
90 return Dart_Null(); | 92 return Dart_Null(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 *kernel_ir = buffer; | 161 *kernel_ir = buffer; |
160 return true; | 162 return true; |
161 } | 163 } |
162 } | 164 } |
163 } | 165 } |
164 return false; | 166 return false; |
165 } | 167 } |
166 | 168 |
167 } // namespace bin | 169 } // namespace bin |
168 } // namespace dart | 170 } // namespace dart |
OLD | NEW |