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

Unified Diff: runtime/vm/precompiler.cc

Issue 1373873004: Make --noopt behave like an in-place precompilation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync + enable checked mode Created 5 years, 3 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
« no previous file with comments | « runtime/vm/precompiler.h ('k') | tests/standalone/noopt_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/precompiler.cc
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index b40f5faf5b7900b025d81628e7586c1fd9d2a8db..d6a654060cd7262eaa7b23923a0ea80014caf57b 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -29,10 +29,11 @@ static void Jump(const Error& error) {
RawError* Precompiler::CompileAll(
- Dart_QualifiedFunctionName embedder_entry_points[]) {
+ Dart_QualifiedFunctionName embedder_entry_points[],
+ bool reset_fields) {
LongJumpScope jump;
if (setjmp(*jump.Set()) == 0) {
- Precompiler precompiler(Thread::Current());
+ Precompiler precompiler(Thread::Current(), reset_fields);
precompiler.DoCompileAll(embedder_entry_points);
return Error::null();
} else {
@@ -44,10 +45,11 @@ RawError* Precompiler::CompileAll(
}
-Precompiler::Precompiler(Thread* thread) :
+Precompiler::Precompiler(Thread* thread, bool reset_fields) :
thread_(thread),
zone_(thread->zone()),
isolate_(thread->isolate()),
+ reset_fields_(reset_fields),
changed_(false),
function_count_(0),
class_count_(0),
@@ -443,6 +445,12 @@ void Precompiler::AddField(const Field& field) {
AddClass(cls);
if (field.has_initializer()) {
+ // Should not be in the middle of initialization while precompiling.
+ ASSERT(value.raw() != Object::transition_sentinel().raw());
+
+ const bool is_initialized = value.raw() != Object::sentinel().raw();
+ if (is_initialized && !reset_fields_) return;
+
if (field.HasPrecompiledInitializer()) return;
if (FLAG_trace_precompiler) {
« no previous file with comments | « runtime/vm/precompiler.h ('k') | tests/standalone/noopt_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698