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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 10871005: Make ClassFinalizer indifferent on whether we are generating a snapshot or not. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Return error if isolate is in an inconsistent state. 82 // Return error if isolate is in an inconsistent state.
83 // Return NULL when no error condition exists. 83 // Return NULL when no error condition exists.
84 // 84 //
85 // TODO(turnidge): Make this function return an error handle directly 85 // TODO(turnidge): Make this function return an error handle directly
86 // rather than returning an error string. The current behavior can 86 // rather than returning an error string. The current behavior can
87 // cause compilation errors to appear to be api errors. 87 // cause compilation errors to appear to be api errors.
88 const char* CheckIsolateState(Isolate* isolate, bool generating_snapshot) { 88 const char* CheckIsolateState(Isolate* isolate, bool generating_snapshot) {
89 bool success = true; 89 bool success = true;
90 if (!ClassFinalizer::AllClassesFinalized()) { 90 if (!ClassFinalizer::AllClassesFinalized()) {
91 success = (generating_snapshot) ? 91 ClassFinalizer class_finalizer(generating_snapshot);
92 ClassFinalizer::FinalizePendingClassesForSnapshotCreation() : 92 success = class_finalizer.FinalizePendingClasses();
93 ClassFinalizer::FinalizePendingClasses();
94 } 93 }
95 if (success) { 94 if (success) {
96 success = isolate->object_store()->PreallocateObjects(); 95 success = isolate->object_store()->PreallocateObjects();
97 if (success) { 96 if (success) {
98 return NULL; 97 return NULL;
99 } 98 }
100 } 99 }
101 // Make a copy of the error message as the original message string 100 // Make a copy of the error message as the original message string
102 // may get deallocated when we return back from the Dart API call. 101 // may get deallocated when we return back from the Dart API call.
103 const Error& err = Error::Handle(isolate->object_store()->sticky_error()); 102 const Error& err = Error::Handle(isolate->object_store()->sticky_error());
(...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 RawScript::Kind kind, 3719 RawScript::Kind kind,
3721 Dart_Handle* result) { 3720 Dart_Handle* result) {
3722 bool update_lib_status = (kind == RawScript::kScriptTag || 3721 bool update_lib_status = (kind == RawScript::kScriptTag ||
3723 kind == RawScript::kLibraryTag); 3722 kind == RawScript::kLibraryTag);
3724 if (update_lib_status) { 3723 if (update_lib_status) {
3725 lib.SetLoadInProgress(); 3724 lib.SetLoadInProgress();
3726 } 3725 }
3727 const Script& script = 3726 const Script& script =
3728 Script::Handle(isolate, Script::New(url, source, kind)); 3727 Script::Handle(isolate, Script::New(url, source, kind));
3729 ASSERT(isolate != NULL); 3728 ASSERT(isolate != NULL);
3730 const Error& error = Error::Handle(isolate, Compiler::Compile(lib, script)); 3729 const Error& error = Error::Handle(isolate, Compiler::Compile(
3730 lib, script, ClassFinalizer::kNotGeneratingSnapshot));
3731 if (error.IsNull()) { 3731 if (error.IsNull()) {
3732 *result = Api::NewHandle(isolate, lib.raw()); 3732 *result = Api::NewHandle(isolate, lib.raw());
3733 if (update_lib_status) { 3733 if (update_lib_status) {
3734 lib.SetLoaded(); 3734 lib.SetLoaded();
3735 } 3735 }
3736 } else { 3736 } else {
3737 *result = Api::NewHandle(isolate, error.raw()); 3737 *result = Api::NewHandle(isolate, error.raw());
3738 if (update_lib_status) { 3738 if (update_lib_status) {
3739 lib.SetLoadError(); 3739 lib.SetLoadError();
3740 } 3740 }
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
4122 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { 4122 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) {
4123 Dart::set_perf_events_writer(function); 4123 Dart::set_perf_events_writer(function);
4124 } 4124 }
4125 4125
4126 4126
4127 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { 4127 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) {
4128 Dart::set_flow_graph_writer(function); 4128 Dart::set_flow_graph_writer(function);
4129 } 4129 }
4130 4130
4131 } // namespace dart 4131 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698