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

Unified Diff: runtime/vm/compiler.cc

Issue 16888013: Revert "Initial implementation of on-stack replacement (OSR)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 0fba07c66b5cb81eb4f34cc270d03a5b62a02fd0..a0f53062a73984de5993f39e2991a2985da81256 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -12,6 +12,7 @@
#include "vm/dart_entry.h"
#include "vm/debugger.h"
#include "vm/deopt_instructions.h"
+#include "vm/disassembler.h"
#include "vm/exceptions.h"
#include "vm/flags.h"
#include "vm/flow_graph.h"
@@ -240,8 +241,7 @@ static void InstallUnoptimizedCode(const Function& function) {
// Return false if bailed out.
static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function,
- bool optimized,
- intptr_t osr_id) {
+ bool optimized) {
const Function& function = parsed_function->function();
if (optimized && !function.is_optimizable()) {
return false;
@@ -281,18 +281,13 @@ static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function,
// Build the flow graph.
FlowGraphBuilder builder(parsed_function,
ic_data_array,
- NULL, // NULL = not inlining.
- osr_id);
+ NULL); // NULL = not inlining.
flow_graph = builder.BuildGraph();
}
if (FLAG_print_flow_graph ||
(optimized && FLAG_print_flow_graph_optimized)) {
- if (osr_id == Isolate::kNoDeoptId) {
- FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
- } else {
- FlowGraphPrinter::PrintGraph("For OSR", flow_graph);
- }
+ FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
}
if (optimized) {
@@ -513,14 +508,12 @@ static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function,
graph_compiler.FinalizeStaticCallTargetsTable(code);
if (optimized) {
- if (osr_id == Isolate::kNoDeoptId) {
- CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
- if (FLAG_trace_compiler) {
- OS::Print("--> patching entry %#"Px"\n",
- Code::Handle(function.unoptimized_code()).EntryPoint());
- }
- }
+ CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
function.SetCode(code);
+ if (FLAG_trace_compiler) {
+ OS::Print("--> patching entry %#"Px"\n",
+ Code::Handle(function.unoptimized_code()).EntryPoint());
+ }
for (intptr_t i = 0; i < guarded_fields.length(); i++) {
const Field& field = *guarded_fields[i];
@@ -558,7 +551,12 @@ static void DisassembleCode(const Function& function, bool optimized) {
optimized ? "optimized " : "",
function_fullname);
const Code& code = Code::Handle(function.CurrentCode());
- code.Disassemble();
+ const Instructions& instructions =
+ Instructions::Handle(code.instructions());
+ uword start = instructions.EntryPoint();
+ Disassembler::Disassemble(start,
+ start + instructions.size(),
+ code.comments());
OS::Print("}\n");
OS::Print("Pointer offsets for function: {\n");
@@ -578,7 +576,6 @@ static void DisassembleCode(const Function& function, bool optimized) {
PcDescriptors::Handle(code.pc_descriptors());
OS::Print("%s}\n", descriptors.ToCString());
- uword start = Instructions::Handle(code.instructions()).EntryPoint();
const Array& deopt_table = Array::Handle(code.deopt_info_array());
intptr_t deopt_table_length = DeoptTable::GetLength(deopt_table);
if (deopt_table_length > 0) {
@@ -678,8 +675,7 @@ static void DisassembleCode(const Function& function, bool optimized) {
static RawError* CompileFunctionHelper(const Function& function,
- bool optimized,
- intptr_t osr_id) {
+ bool optimized) {
Isolate* isolate = Isolate::Current();
StackZone zone(isolate);
LongJump* base = isolate->long_jump_base();
@@ -698,8 +694,7 @@ static RawError* CompileFunctionHelper(const Function& function,
ParsedFunction* parsed_function = new ParsedFunction(
Function::ZoneHandle(function.raw()));
if (FLAG_trace_compiler) {
- OS::Print("Compiling %s%sfunction: '%s' @ token %"Pd", size %"Pd"\n",
- (osr_id == Isolate::kNoDeoptId ? "" : "osr "),
+ OS::Print("Compiling %sfunction: '%s' @ token %"Pd", size %"Pd"\n",
(optimized ? "optimized " : ""),
function.ToFullyQualifiedCString(),
function.token_pos(),
@@ -712,7 +707,7 @@ static RawError* CompileFunctionHelper(const Function& function,
}
const bool success =
- CompileParsedFunctionHelper(parsed_function, optimized, osr_id);
+ CompileParsedFunctionHelper(parsed_function, optimized);
if (optimized && !success) {
// Optimizer bailed out. Disable optimizations and to never try again.
if (FLAG_trace_compiler) {
@@ -764,13 +759,12 @@ static RawError* CompileFunctionHelper(const Function& function,
RawError* Compiler::CompileFunction(const Function& function) {
- return CompileFunctionHelper(function, false, Isolate::kNoDeoptId);
+ return CompileFunctionHelper(function, false); // Non-optimized.
}
-RawError* Compiler::CompileOptimizedFunction(const Function& function,
- intptr_t osr_id) {
- return CompileFunctionHelper(function, true, osr_id);
+RawError* Compiler::CompileOptimizedFunction(const Function& function) {
+ return CompileFunctionHelper(function, true); // Optimized.
}
@@ -782,7 +776,7 @@ RawError* Compiler::CompileParsedFunction(
isolate->set_long_jump_base(&jump);
if (setjmp(*jump.Set()) == 0) {
// Non-optimized code generator.
- CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId);
+ CompileParsedFunctionHelper(parsed_function, false);
if (FLAG_disassemble) {
DisassembleCode(parsed_function->function(), false);
}
@@ -869,7 +863,7 @@ RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
parsed_function->AllocateVariables();
// Non-optimized code generator.
- CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId);
+ CompileParsedFunctionHelper(parsed_function, false);
const Object& result = Object::Handle(
DartEntry::InvokeFunction(func, Object::empty_array()));
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698