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 #ifndef RUNTIME_BIN_DFE_H_ | 5 #ifndef RUNTIME_BIN_DFE_H_ |
6 #define RUNTIME_BIN_DFE_H_ | 6 #define RUNTIME_BIN_DFE_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 bool UseDartFrontend() const { return frontend_filename_ != NULL; } | 23 bool UseDartFrontend() const { return frontend_filename_ != NULL; } |
24 | 24 |
25 const char* platform_binary_filename() const { | 25 const char* platform_binary_filename() const { |
26 return platform_binary_filename_; | 26 return platform_binary_filename_; |
27 } | 27 } |
28 void set_platform_binary_filename(const char* name) { | 28 void set_platform_binary_filename(const char* name) { |
29 platform_binary_filename_ = name; | 29 platform_binary_filename_ = name; |
30 } | 30 } |
31 bool UsePlatformBinary() const { return platform_binary_filename_ != NULL; } | 31 bool UsePlatformBinary() const { return platform_binary_filename_ != NULL; } |
32 | 32 |
| 33 void* kernel_platform() const { return kernel_platform_; } |
| 34 |
33 // Method to reload a script into a running a isolate. | 35 // Method to reload a script into a running a isolate. |
34 // If the specified script [url] is not a kernel IR, compile it first using | 36 // If the specified script [url] is not a kernel IR, compile it first using |
35 // DFE and then reload the resulting kernel IR into the isolate. | 37 // DFE and then reload the resulting kernel IR into the isolate. |
36 // Returns Dart_Null if successful, otherwise an error object is returned. | 38 // Returns Dart_Null if successful, otherwise an error object is returned. |
37 Dart_Handle ReloadScript(Dart_Isolate isolate, Dart_Handle url); | 39 Dart_Handle ReloadScript(Dart_Isolate isolate, const char* url_string); |
38 | 40 |
| 41 // Compiles a script and reads the resulting kernel file. |
| 42 // If the compilation is successful, returns a valid in memory kernel |
| 43 // representation of the script, NULL otherwise |
| 44 // 'error' and 'exit_code' have the error values in case of errors. |
| 45 void* CompileAndReadScript(const char* script_uri, |
| 46 char** error, |
| 47 int* exit_code); |
| 48 |
| 49 // Reads the platform kernel file. |
| 50 // Returns an in memory kernel representation of the platform kernel file. |
| 51 void* ReadPlatform(); |
| 52 |
| 53 // Reads the script kernel file if specified 'script_uri' is a kernel file. |
| 54 // Returns an in memory kernel representation of the specified script is a |
| 55 // valid kernel file, false otherwise. |
| 56 void* ReadScript(const char* script_uri); |
| 57 |
| 58 private: |
39 // Tries to read [script_uri] as a Kernel IR file. | 59 // Tries to read [script_uri] as a Kernel IR file. |
40 // Returns `true` if successful and sets [kernel_file] and [kernel_length] | 60 // Returns `true` if successful and sets [kernel_file] and [kernel_length] |
41 // to be the kernel IR contents. | 61 // to be the kernel IR contents. |
42 // The caller is responsible for free()ing [kernel_file] if `true` | 62 // The caller is responsible for free()ing [kernel_file] if `true` |
43 // was returned. | 63 // was returned. |
44 bool TryReadKernelFile(const char* script_uri, | 64 bool TryReadKernelFile(const char* script_uri, |
45 const uint8_t** kernel_ir, | 65 const uint8_t** kernel_ir, |
46 intptr_t* kernel_ir_size); | 66 intptr_t* kernel_ir_size); |
47 | 67 |
48 private: | |
49 const char* frontend_filename_; | 68 const char* frontend_filename_; |
50 const char* platform_binary_filename_; | 69 const char* platform_binary_filename_; |
| 70 void* kernel_platform_; |
51 | 71 |
52 DISALLOW_COPY_AND_ASSIGN(DFE); | 72 DISALLOW_COPY_AND_ASSIGN(DFE); |
53 }; | 73 }; |
54 | 74 |
55 } // namespace bin | 75 } // namespace bin |
56 } // namespace dart | 76 } // namespace dart |
57 | 77 |
58 #endif // RUNTIME_BIN_DFE_H_ | 78 #endif // RUNTIME_BIN_DFE_H_ |
OLD | NEW |