Index: runtime/bin/dartutils.h |
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h |
index b9fe476e0acf9dac2f1c2604fa7aac61e1b8f44c..8815a1cf165a3ea82ea512ec553ac1df3908ed8a 100644 |
--- a/runtime/bin/dartutils.h |
+++ b/runtime/bin/dartutils.h |
@@ -33,6 +33,15 @@ static inline Dart_Handle ThrowIfError(Dart_Handle handle) { |
return handle; |
} |
+// Tries to read [script_uri] as a Kernel IR file. If successful this function |
+// returns `true` and sets [dil_file] and [dil_length] to be the memory |
+// contents. |
+// |
+// The caller is responsible for free()ing [dil_file] if `true` was returned. |
+bool TryReadKernel(const char* script_uri, |
rmacnak
2016/10/13 00:56:39
General question: Why does the embedder code call
Kevin Millikin (Google)
2016/10/13 04:29:40
It mostly historical. We called it DIL (Dart Inte
Vyacheslav Egorov (Google)
2016/10/13 14:37:57
Renamed all DIL to Kernel.
|
+ const uint8_t** dil_file, |
+ intptr_t* dil_length); |
+ |
class CommandLineOptions { |
public: |
explicit CommandLineOptions(int max_count) |
@@ -200,14 +209,21 @@ class DartUtils { |
static Dart_Handle ResolveUriInWorkingDirectory(Dart_Handle script_uri); |
static Dart_Handle ResolveScript(Dart_Handle url); |
+ enum MagicNumber { |
+ kSnapshotMagicNumber, |
+ kKernelMagicNumber, |
+ kUnknownMagicNumber |
+ }; |
+ |
+ // static const uint8_t* GetMagicNumber(MagicNumber number); |
+ |
// Sniffs the specified text_buffer to see if it contains the magic number |
// representing a script snapshot. If the text_buffer is a script snapshot |
// the return value is an updated pointer to the text_buffer pointing past |
// the magic number value. The 'buffer_len' parameter is also appropriately |
// adjusted. |
- static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer, |
- intptr_t* buffer_len, |
- bool* is_snapshot); |
+ static MagicNumber SniffForMagicNumber(const uint8_t** text_buffer, |
+ intptr_t* buffer_len); |
// Write a magic number to indicate a script snapshot file. |
static void WriteMagicNumber(File* file); |
@@ -231,8 +247,6 @@ class DartUtils { |
static const char* const kHttpScheme; |
static const char* const kVMServiceLibURL; |
- static const uint8_t magic_number[]; |
- |
static Dart_Handle LibraryFilePath(Dart_Handle library_uri); |
private: |