OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
(...skipping 5398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5409 | 5409 |
5410 // NOTE: Now the VM owns the [kernel_program] memory! Currently we do not | 5410 // NOTE: Now the VM owns the [kernel_program] memory! Currently we do not |
5411 // free it because (similar to the token stream) it will be used to repeatedly | 5411 // free it because (similar to the token stream) it will be used to repeatedly |
5412 // run the `kernel::FlowGraphBuilder()`. | 5412 // run the `kernel::FlowGraphBuilder()`. |
5413 kernel::KernelReader reader( | 5413 kernel::KernelReader reader( |
5414 reinterpret_cast<kernel::Program*>(kernel_program)); | 5414 reinterpret_cast<kernel::Program*>(kernel_program)); |
5415 const Object& tmp = reader.ReadProgram(); | 5415 const Object& tmp = reader.ReadProgram(); |
5416 if (tmp.IsError()) { | 5416 if (tmp.IsError()) { |
5417 return Api::NewHandle(T, tmp.raw()); | 5417 return Api::NewHandle(T, tmp.raw()); |
5418 } | 5418 } |
| 5419 if (tmp.IsNull()) { |
| 5420 return Api::NewError("%s: The binary program does not contain 'main'.", |
| 5421 CURRENT_FUNC); |
| 5422 } |
5419 library ^= tmp.raw(); | 5423 library ^= tmp.raw(); |
5420 I->object_store()->set_root_library(library); | 5424 I->object_store()->set_root_library(library); |
5421 return Api::NewHandle(T, library.raw()); | 5425 return Api::NewHandle(T, library.raw()); |
5422 #endif | 5426 #endif |
5423 } | 5427 } |
5424 | 5428 |
5425 | 5429 |
5426 DART_EXPORT Dart_Handle Dart_RootLibrary() { | 5430 DART_EXPORT Dart_Handle Dart_RootLibrary() { |
5427 Thread* thread = Thread::Current(); | 5431 Thread* thread = Thread::Current(); |
5428 Isolate* isolate = thread->isolate(); | 5432 Isolate* isolate = thread->isolate(); |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6842 } | 6846 } |
6843 | 6847 |
6844 | 6848 |
6845 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6849 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
6846 #ifndef PRODUCT | 6850 #ifndef PRODUCT |
6847 Profiler::DumpStackTrace(context); | 6851 Profiler::DumpStackTrace(context); |
6848 #endif | 6852 #endif |
6849 } | 6853 } |
6850 | 6854 |
6851 } // namespace dart | 6855 } // namespace dart |
OLD | NEW |