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 5113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5124 API_TIMELINE_DURATION; | 5124 API_TIMELINE_DURATION; |
5125 DARTSCOPE(Thread::Current()); | 5125 DARTSCOPE(Thread::Current()); |
5126 Isolate* I = T->isolate(); | 5126 Isolate* I = T->isolate(); |
5127 StackZone zone(T); | 5127 StackZone zone(T); |
5128 if (buffer == NULL) { | 5128 if (buffer == NULL) { |
5129 RETURN_NULL_ERROR(buffer); | 5129 RETURN_NULL_ERROR(buffer); |
5130 } | 5130 } |
5131 NoHeapGrowthControlScope no_growth_control; | 5131 NoHeapGrowthControlScope no_growth_control; |
5132 | 5132 |
5133 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 5133 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 5134 if (snapshot == NULL) { |
| 5135 return Api::NewError("%s expects parameter 'buffer' to be a script type" |
| 5136 " snapshot with a valid length.", CURRENT_FUNC); |
| 5137 } |
5134 if (!snapshot->IsScriptSnapshot()) { | 5138 if (!snapshot->IsScriptSnapshot()) { |
5135 return Api::NewError("%s expects parameter 'buffer' to be a script type" | 5139 return Api::NewError("%s expects parameter 'buffer' to be a script type" |
5136 " snapshot.", CURRENT_FUNC); | 5140 " snapshot.", CURRENT_FUNC); |
5137 } | 5141 } |
5138 if (snapshot->length() != buffer_len) { | 5142 if (snapshot->length() != buffer_len) { |
5139 return Api::NewError("%s: 'buffer_len' of %" Pd " is not equal to %" Pd | 5143 return Api::NewError("%s: 'buffer_len' of %" Pd " is not equal to %" Pd |
5140 " which is the expected length in the snapshot.", | 5144 " which is the expected length in the snapshot.", |
5141 CURRENT_FUNC, buffer_len, snapshot->length()); | 5145 CURRENT_FUNC, buffer_len, snapshot->length()); |
5142 } | 5146 } |
5143 Library& library = Library::Handle(Z, I->object_store()->root_library()); | 5147 Library& library = Library::Handle(Z, I->object_store()->root_library()); |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6157 return Api::Success(); | 6161 return Api::Success(); |
6158 } | 6162 } |
6159 #endif // DART_PRECOMPILER | 6163 #endif // DART_PRECOMPILER |
6160 | 6164 |
6161 | 6165 |
6162 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6166 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
6163 return Dart::IsRunningPrecompiledCode(); | 6167 return Dart::IsRunningPrecompiledCode(); |
6164 } | 6168 } |
6165 | 6169 |
6166 } // namespace dart | 6170 } // namespace dart |
OLD | NEW |