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

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: 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
Index: runtime/vm/precompiler.cc
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index 1e89986ca2f5191884732b36f76269da4f62ed27..8fee122547a0eb3ce0f737f0b1501220550469ab 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),
@@ -445,6 +447,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) {

Powered by Google App Engine
This is Rietveld 408576698