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 "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 profiler_data->Unblock(); | 1377 profiler_data->Unblock(); |
1378 } | 1378 } |
1379 | 1379 |
1380 | 1380 |
1381 DART_EXPORT void Dart_ExitIsolate() { | 1381 DART_EXPORT void Dart_ExitIsolate() { |
1382 CHECK_ISOLATE(Isolate::Current()); | 1382 CHECK_ISOLATE(Isolate::Current()); |
1383 Isolate::SetCurrent(NULL); | 1383 Isolate::SetCurrent(NULL); |
1384 } | 1384 } |
1385 | 1385 |
1386 | 1386 |
| 1387 DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value) { |
| 1388 CHECK_ISOLATE(Isolate::Current()); |
| 1389 Isolate* isolate = Isolate::Current(); |
| 1390 if (isolate->has_compiled()) { |
| 1391 return Api::NewError( |
| 1392 "%s expects that the isolate has not yet compiled code.", CURRENT_FUNC); |
| 1393 } |
| 1394 Isolate::Current()->set_strict_compilation(value); |
| 1395 return Api::Null(); |
| 1396 } |
| 1397 |
| 1398 |
1387 static uint8_t* ApiReallocate(uint8_t* ptr, | 1399 static uint8_t* ApiReallocate(uint8_t* ptr, |
1388 intptr_t old_size, | 1400 intptr_t old_size, |
1389 intptr_t new_size) { | 1401 intptr_t new_size) { |
1390 return Api::TopScope(Isolate::Current())->zone()->Realloc<uint8_t>( | 1402 return Api::TopScope(Isolate::Current())->zone()->Realloc<uint8_t>( |
1391 ptr, old_size, new_size); | 1403 ptr, old_size, new_size); |
1392 } | 1404 } |
1393 | 1405 |
1394 | 1406 |
1395 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, | 1407 DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer, |
1396 intptr_t* size) { | 1408 intptr_t* size) { |
(...skipping 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 Dart_Handle name, | 3867 Dart_Handle name, |
3856 int number_of_arguments, | 3868 int number_of_arguments, |
3857 Dart_Handle* arguments) { | 3869 Dart_Handle* arguments) { |
3858 Isolate* isolate = Isolate::Current(); | 3870 Isolate* isolate = Isolate::Current(); |
3859 DARTSCOPE(isolate); | 3871 DARTSCOPE(isolate); |
3860 CHECK_CALLBACK_STATE(isolate); | 3872 CHECK_CALLBACK_STATE(isolate); |
3861 // TODO(turnidge): This is a bit simplistic. It overcounts when | 3873 // TODO(turnidge): This is a bit simplistic. It overcounts when |
3862 // other operations (gc, compilation) are active. | 3874 // other operations (gc, compilation) are active. |
3863 TIMERSCOPE(isolate, time_dart_execution); | 3875 TIMERSCOPE(isolate, time_dart_execution); |
3864 | 3876 |
| 3877 isolate->set_has_compiled(true); |
| 3878 |
3865 const String& function_name = Api::UnwrapStringHandle(isolate, name); | 3879 const String& function_name = Api::UnwrapStringHandle(isolate, name); |
3866 if (function_name.IsNull()) { | 3880 if (function_name.IsNull()) { |
3867 RETURN_TYPE_ERROR(isolate, name, String); | 3881 RETURN_TYPE_ERROR(isolate, name, String); |
3868 } | 3882 } |
3869 if (number_of_arguments < 0) { | 3883 if (number_of_arguments < 0) { |
3870 return Api::NewError( | 3884 return Api::NewError( |
3871 "%s expects argument 'number_of_arguments' to be non-negative.", | 3885 "%s expects argument 'number_of_arguments' to be non-negative.", |
3872 CURRENT_FUNC); | 3886 CURRENT_FUNC); |
3873 } | 3887 } |
3874 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target)); | 3888 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target)); |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5429 | 5443 |
5430 | 5444 |
5431 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5445 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5432 const char* name, | 5446 const char* name, |
5433 Dart_ServiceRequestCallback callback, | 5447 Dart_ServiceRequestCallback callback, |
5434 void* user_data) { | 5448 void* user_data) { |
5435 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5449 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5436 } | 5450 } |
5437 | 5451 |
5438 } // namespace dart | 5452 } // namespace dart |
OLD | NEW |