OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef RUNTIME_BIN_DFE_H_ |
| 6 #define RUNTIME_BIN_DFE_H_ |
| 7 |
| 8 #include "include/dart_api.h" |
| 9 #include "include/dart_native_api.h" |
| 10 #include "platform/assert.h" |
| 11 #include "platform/globals.h" |
| 12 |
| 13 namespace dart { |
| 14 namespace bin { |
| 15 |
| 16 class DFE { |
| 17 public: |
| 18 DFE(); |
| 19 ~DFE(); |
| 20 |
| 21 const char* frontend_filename() const { return frontend_filename_; } |
| 22 void set_frontend_filename(const char* name) { frontend_filename_ = name; } |
| 23 bool UseDartFrontend() const { return frontend_filename_ != NULL; } |
| 24 |
| 25 const char* platform_binary_filename() const { |
| 26 return platform_binary_filename_; |
| 27 } |
| 28 void set_platform_binary_filename(const char* name) { |
| 29 platform_binary_filename_ = name; |
| 30 } |
| 31 bool UsePlatformBinary() const { return platform_binary_filename_ != NULL; } |
| 32 |
| 33 // 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 |
| 35 // DFE and then reload the resulting kernel IR into the isolate. |
| 36 // Returns Dart_Null if successful, otherwise an error object is returned. |
| 37 Dart_Handle ReloadScript(Dart_Isolate isolate, Dart_Handle url); |
| 38 |
| 39 // Tries to read [script_uri] as a Kernel IR file. |
| 40 // Returns `true` if successful and sets [kernel_file] and [kernel_length] |
| 41 // to be the kernel IR contents. |
| 42 // The caller is responsible for free()ing [kernel_file] if `true` |
| 43 // was returned. |
| 44 bool TryReadKernelFile(const char* script_uri, |
| 45 const uint8_t** kernel_ir, |
| 46 intptr_t* kernel_ir_size); |
| 47 |
| 48 private: |
| 49 const char* frontend_filename_; |
| 50 const char* platform_binary_filename_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(DFE); |
| 53 }; |
| 54 |
| 55 } // namespace bin |
| 56 } // namespace dart |
| 57 |
| 58 #endif // RUNTIME_BIN_DFE_H_ |
OLD | NEW |