| 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 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 4383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4394 | 4394 |
| 4395 | 4395 |
| 4396 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, | 4396 DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer, |
| 4397 intptr_t buffer_len) { | 4397 intptr_t buffer_len) { |
| 4398 Isolate* isolate = Isolate::Current(); | 4398 Isolate* isolate = Isolate::Current(); |
| 4399 DARTSCOPE(isolate); | 4399 DARTSCOPE(isolate); |
| 4400 TIMERSCOPE(time_script_loading); | 4400 TIMERSCOPE(time_script_loading); |
| 4401 if (buffer == NULL) { | 4401 if (buffer == NULL) { |
| 4402 RETURN_NULL_ERROR(buffer); | 4402 RETURN_NULL_ERROR(buffer); |
| 4403 } | 4403 } |
| 4404 NoHeapGrowthControlScope no_growth_control; |
| 4405 |
| 4404 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 4406 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 4405 if (!snapshot->IsScriptSnapshot()) { | 4407 if (!snapshot->IsScriptSnapshot()) { |
| 4406 return Api::NewError("%s expects parameter 'buffer' to be a script type" | 4408 return Api::NewError("%s expects parameter 'buffer' to be a script type" |
| 4407 " snapshot.", CURRENT_FUNC); | 4409 " snapshot.", CURRENT_FUNC); |
| 4408 } | 4410 } |
| 4409 if (snapshot->length() != buffer_len) { | 4411 if (snapshot->length() != buffer_len) { |
| 4410 return Api::NewError("%s: 'buffer_len' of %"Pd" is not equal to %d which" | 4412 return Api::NewError("%s: 'buffer_len' of %"Pd" is not equal to %d which" |
| 4411 " is the expected length in the snapshot.", | 4413 " is the expected length in the snapshot.", |
| 4412 CURRENT_FUNC, buffer_len, snapshot->length()); | 4414 CURRENT_FUNC, buffer_len, snapshot->length()); |
| 4413 } | 4415 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4781 } | 4783 } |
| 4782 { | 4784 { |
| 4783 NoGCScope no_gc; | 4785 NoGCScope no_gc; |
| 4784 RawObject* raw_obj = obj.raw(); | 4786 RawObject* raw_obj = obj.raw(); |
| 4785 isolate->heap()->SetPeer(raw_obj, peer); | 4787 isolate->heap()->SetPeer(raw_obj, peer); |
| 4786 } | 4788 } |
| 4787 return Api::Success(isolate); | 4789 return Api::Success(isolate); |
| 4788 } | 4790 } |
| 4789 | 4791 |
| 4790 } // namespace dart | 4792 } // namespace dart |
| OLD | NEW |