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

Unified Diff: runtime/vm/compiler.cc

Issue 463103002: Fix bug with CHA dependencies by recording a set of classes for registering code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: address remaining comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
===================================================================
--- runtime/vm/compiler.cc (revision 39070)
+++ runtime/vm/compiler.cc (working copy)
@@ -8,6 +8,7 @@
#include "vm/ast_printer.h"
#include "vm/block_scheduler.h"
+#include "vm/cha.h"
#include "vm/code_generator.h"
#include "vm/code_patcher.h"
#include "vm/dart_entry.h"
@@ -252,7 +253,6 @@
bool is_compiled = false;
Isolate* isolate = Isolate::Current();
HANDLESCOPE(isolate);
- isolate->set_cha_used(false);
// We may reattempt compilation if the function needs to be assembled using
// far branches on ARM and MIPS. In the else branch of the setjmp call,
@@ -269,6 +269,11 @@
LongJumpScope jump;
if (setjmp(*jump.Set()) == 0) {
FlowGraph* flow_graph = NULL;
+
+ // Class hierarchy analysis is registered with the isolate in the
+ // constructor and unregisters itself upon destruction.
+ CHA cha(isolate);
+
// TimerScope needs an isolate to be properly terminated in case of a
// LongJump.
{
@@ -545,12 +550,6 @@
const Code& code = Code::Handle(
Code::FinalizeCode(function, &assembler, optimized));
code.set_is_optimized(optimized);
- // CHA should not be used for unoptimized code.
- ASSERT(optimized || !isolate->cha_used());
- if (isolate->cha_used()) {
- Class::Handle(function.Owner()).RegisterCHACode(code);
- isolate->set_cha_used(false);
- }
graph_compiler.FinalizePcDescriptors(code);
graph_compiler.FinalizeDeoptInfo(code);
graph_compiler.FinalizeStackmaps(code);
@@ -572,7 +571,14 @@
}
function.AttachCode(code);
+ // Register code with the classes it depends on because of CHA.
for (intptr_t i = 0;
+ i < isolate->cha()->leaf_classes().length();
+ ++i) {
+ isolate->cha()->leaf_classes()[i]->RegisterCHACode(code);
+ }
+
+ for (intptr_t i = 0;
i < flow_graph->guarded_fields()->length();
i++) {
const Field* field = (*flow_graph->guarded_fields())[i];
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698