OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_DARTUTILS_H_ | 5 #ifndef RUNTIME_BIN_DARTUTILS_H_ |
6 #define RUNTIME_BIN_DARTUTILS_H_ | 6 #define RUNTIME_BIN_DARTUTILS_H_ |
7 | 7 |
8 #include "bin/isolate_data.h" | 8 #include "bin/isolate_data.h" |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_native_api.h" | 10 #include "include/dart_native_api.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 * functions can also be nested without this error check, since all | 26 * functions can also be nested without this error check, since all |
27 * API functions return any error handles passed in as arguments, unchanged. | 27 * API functions return any error handles passed in as arguments, unchanged. |
28 */ | 28 */ |
29 static inline Dart_Handle ThrowIfError(Dart_Handle handle) { | 29 static inline Dart_Handle ThrowIfError(Dart_Handle handle) { |
30 if (Dart_IsError(handle)) { | 30 if (Dart_IsError(handle)) { |
31 Dart_PropagateError(handle); | 31 Dart_PropagateError(handle); |
32 } | 32 } |
33 return handle; | 33 return handle; |
34 } | 34 } |
35 | 35 |
36 // Tries to read [script_uri] as a Kernel IR file. If successful this function | |
37 // returns `true` and sets [kernel_file] and [kernel_length] to be the memory | |
38 // contents. | |
39 // | |
40 // The caller is responsible for free()ing [kernel_file] if `true` was returned. | |
41 bool TryReadKernel(const char* script_uri, | |
42 const uint8_t** kernel_file, | |
43 intptr_t* kernel_length); | |
44 | 36 |
45 class CommandLineOptions { | 37 class CommandLineOptions { |
46 public: | 38 public: |
47 explicit CommandLineOptions(int max_count) | 39 explicit CommandLineOptions(int max_count) |
48 : count_(0), max_count_(max_count), arguments_(NULL) { | 40 : count_(0), max_count_(max_count), arguments_(NULL) { |
49 static const int kWordSize = sizeof(intptr_t); | 41 static const int kWordSize = sizeof(intptr_t); |
50 arguments_ = reinterpret_cast<const char**>(malloc(max_count * kWordSize)); | 42 arguments_ = reinterpret_cast<const char**>(malloc(max_count * kWordSize)); |
51 if (arguments_ == NULL) { | 43 if (arguments_ == NULL) { |
52 max_count_ = 0; | 44 max_count_ = 0; |
53 } | 45 } |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 bool is_typed_data_; | 665 bool is_typed_data_; |
674 | 666 |
675 DISALLOW_ALLOCATION(); | 667 DISALLOW_ALLOCATION(); |
676 DISALLOW_COPY_AND_ASSIGN(ScopedMemBuffer); | 668 DISALLOW_COPY_AND_ASSIGN(ScopedMemBuffer); |
677 }; | 669 }; |
678 | 670 |
679 } // namespace bin | 671 } // namespace bin |
680 } // namespace dart | 672 } // namespace dart |
681 | 673 |
682 #endif // RUNTIME_BIN_DARTUTILS_H_ | 674 #endif // RUNTIME_BIN_DARTUTILS_H_ |
OLD | NEW |