Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1162033005: Fix http://dartbug.com/23578: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update to ToT. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index f4295b2574a72cfabe7c5f8eea3fead17e2f860e..bc36704424b32c1b9ab8117fa09ca7ccdb760420 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1287,12 +1287,21 @@ static char* BuildIsolateName(const char* script_uri,
DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
const char* main,
const uint8_t* snapshot,
+ Dart_IsolateFlags* flags,
void* callback_data,
char** error) {
CHECK_NO_ISOLATE(Isolate::Current());
char* isolate_name = BuildIsolateName(script_uri, main);
Thread::EnsureInit();
- Isolate* isolate = Dart::CreateIsolate(isolate_name);
+
+ // Setup default flags in case none were passed.
+ Dart_IsolateFlags api_flags;
+ if (flags == NULL) {
+ Isolate::Flags vm_flags;
+ vm_flags.CopyTo(&api_flags);
+ flags = &api_flags;
+ }
+ Isolate* isolate = Dart::CreateIsolate(isolate_name, *flags);
free(isolate_name);
StackZone zone(isolate);
HANDLESCOPE(isolate);
@@ -1405,6 +1414,7 @@ DART_EXPORT void Dart_ExitIsolate() {
}
+// TODO(iposva): Remove this API and instead expose the underlying flags.
DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value) {
CHECK_ISOLATE(Isolate::Current());
Isolate* isolate = Isolate::Current();
@@ -1412,7 +1422,11 @@ DART_EXPORT Dart_Handle Dart_IsolateSetStrictCompilation(bool value) {
return Api::NewError(
"%s expects that the isolate has not yet compiled code.", CURRENT_FUNC);
}
- Isolate::Current()->set_strict_compilation(value);
+ if (!value) {
+ return Api::NewError(
+ "%s expects that the value is set to true only.", CURRENT_FUNC);
+ }
+ Isolate::Current()->set_strict_compilation();
return Api::Null();
}
@@ -3999,8 +4013,6 @@ DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target,
// other operations (gc, compilation) are active.
TIMERSCOPE(isolate, time_dart_execution);
- isolate->set_has_compiled(true);
-
const String& function_name = Api::UnwrapStringHandle(isolate, name);
if (function_name.IsNull()) {
RETURN_TYPE_ERROR(isolate, name, String);

Powered by Google App Engine
This is Rietveld 408576698