Refactor generating lazy deoptimization descriptors.
Instead of having special handling for closure calls, pass the number of input operands down so that the correct lazy deoptimization environment is generated at calls. There is no functional change here - this is to simplify having calls with pushed arguments and input operands (like closure calls). Runtime calls still do not have a correct lazy deoptimization environment the environment should only be used for creating stack traces from optimized code. Fix a bug with --trace-deoptimization-verbose printing: We cannot call ToCString on objects when the slots have not been filled in yet. (e.g. Closures) R=vegorov@google.com Review URL: https://codereview.chromium.org//575443002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40306 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -14,9 +14,6 @@ import "package:expect/expect.dart";
|
||||
// method in the invocation chain. The test is run during warmup to ensure
|
||||
// unoptimized code produces the correct result and is then run
|
||||
// in a loop to ensure optimization kicks in and some inlining is done.
|
||||
// Note: it appears that functions which have a throw are not inlined (func4)
|
||||
// and functions that have try/catch in them are not optimized (func1).
|
||||
// func2 is not inlined as func1 has not been optimized.
|
||||
|
||||
class Test {
|
||||
String func1(var k) {
|
||||
|
||||
@@ -88,9 +88,11 @@ void DeferredObjectRef::Materialize(DeoptContext* deopt_context) {
|
||||
DeferredObject* obj = deopt_context->GetDeferredObject(index());
|
||||
*slot() = obj->object();
|
||||
if (FLAG_trace_deoptimization_verbose) {
|
||||
OS::PrintErr("writing instance ref at %" Px ": %s\n",
|
||||
reinterpret_cast<uword>(slot()),
|
||||
Instance::Handle(obj->object()).ToCString());
|
||||
const Class& cls = Class::Handle(Isolate::Current()->class_table()->At(
|
||||
Object::Handle(obj->object()).GetClassId()));
|
||||
OS::PrintErr("writing instance of class %s ref at %" Px ".\n",
|
||||
cls.ToCString(),
|
||||
reinterpret_cast<uword>(slot()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -766,16 +766,6 @@ void FlowGraph::AttachEnvironment(Instruction* instr,
|
||||
*env,
|
||||
num_non_copied_params_,
|
||||
&parsed_function_);
|
||||
// TODO(fschneider): Add predicates CanEagerlyDeoptimize and
|
||||
// CanLazilyDeoptimize to instructions to generally deal with instructions
|
||||
// that have pushed arguments and input operands.
|
||||
// Right now, closure calls are the only instructions that have both. They
|
||||
// also don't have an eager deoptimziation point, so the environment attached
|
||||
// here is only used for after the call.
|
||||
if (instr->IsClosureCall()) {
|
||||
deopt_env = deopt_env->DeepCopy(isolate(),
|
||||
deopt_env->Length() - instr->InputCount());
|
||||
}
|
||||
instr->SetEnvironment(deopt_env);
|
||||
for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) {
|
||||
Value* use = it.CurrentValue();
|
||||
|
||||
@@ -299,7 +299,8 @@ void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) {
|
||||
// optimizations need deoptimization info for non-deoptable instructions,
|
||||
// eg, LICM on GOTOs.
|
||||
if (instr->env() != NULL) {
|
||||
call_->env()->DeepCopyToOuter(callee_graph->isolate(), instr);
|
||||
call_->env()->DeepCopyToOuter(
|
||||
callee_graph->isolate(), instr, call_->InputCount());
|
||||
}
|
||||
}
|
||||
if (instr->IsGoto()) {
|
||||
|
||||
@@ -541,13 +541,16 @@ void FlowGraphCompiler::AddStaticCallTarget(const Function& func) {
|
||||
|
||||
|
||||
void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id,
|
||||
intptr_t token_pos) {
|
||||
intptr_t token_pos,
|
||||
intptr_t input_count) {
|
||||
ASSERT(is_optimizing());
|
||||
ASSERT(!intrinsic_mode());
|
||||
Environment* env = pending_deoptimization_env_->DeepCopy(
|
||||
isolate(), pending_deoptimization_env_->Length() - input_count);
|
||||
CompilerDeoptInfo* info =
|
||||
new CompilerDeoptInfo(deopt_id,
|
||||
ICData::kDeoptAtCall,
|
||||
pending_deoptimization_env_);
|
||||
env);
|
||||
info->set_pc_offset(assembler()->CodeSize());
|
||||
deopt_infos_.Add(info);
|
||||
}
|
||||
@@ -872,6 +875,29 @@ void FlowGraphCompiler::TryIntrinsify() {
|
||||
}
|
||||
|
||||
|
||||
// Record safe point and deoptimization info if applicable.
|
||||
void FlowGraphCompiler::RecordCallInfo(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
intptr_t deopt_id,
|
||||
LocationSummary* locs,
|
||||
intptr_t input_count_adjustment) {
|
||||
AddCurrentDescriptor(kind, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos, input_count_adjustment);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FlowGraphCompiler::GenerateInstanceCall(
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
|
||||
@@ -320,6 +320,12 @@ class FlowGraphCompiler : public ValueObject {
|
||||
|
||||
void TryIntrinsify();
|
||||
|
||||
void RecordCallInfo(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
intptr_t deopt_id,
|
||||
LocationSummary* locs,
|
||||
intptr_t input_count_adjustment);
|
||||
|
||||
void GenerateRuntimeCall(intptr_t token_pos,
|
||||
intptr_t deopt_id,
|
||||
const RuntimeEntry& entry,
|
||||
@@ -445,12 +451,8 @@ class FlowGraphCompiler : public ValueObject {
|
||||
intptr_t deopt_id,
|
||||
intptr_t token_pos);
|
||||
|
||||
void RecordSafepoint(LocationSummary* locs);
|
||||
|
||||
Label* AddDeoptStub(intptr_t deopt_id, ICData::DeoptReasonId reason);
|
||||
|
||||
void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos);
|
||||
|
||||
void AddSlowPathCode(SlowPathCode* slow_path);
|
||||
|
||||
void FinalizeExceptionHandlers(const Code& code);
|
||||
@@ -506,8 +508,14 @@ class FlowGraphCompiler : public ValueObject {
|
||||
|
||||
void EmitFrameEntry();
|
||||
|
||||
void RecordSafepoint(LocationSummary* locs);
|
||||
|
||||
void AddStaticCallTarget(const Function& function);
|
||||
|
||||
void AddDeoptIndexAtCall(intptr_t deopt_id,
|
||||
intptr_t token_pos,
|
||||
intptr_t input_count);
|
||||
|
||||
void GenerateDeferredCode();
|
||||
|
||||
void EmitInstructionPrologue(Instruction* instr);
|
||||
|
||||
@@ -1103,8 +1103,7 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ BranchLinkPatchable(label);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1114,19 +1113,7 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ BranchLinkPatchable(label);
|
||||
AddCurrentDescriptor(kind, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after, token_pos);
|
||||
}
|
||||
RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count());
|
||||
}
|
||||
|
||||
|
||||
@@ -1136,22 +1123,7 @@ void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
|
||||
intptr_t argument_count,
|
||||
LocationSummary* locs) {
|
||||
__ CallRuntime(entry, argument_count);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos);
|
||||
}
|
||||
}
|
||||
RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1271,10 +1243,8 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ LoadObject(R4, arguments_descriptor);
|
||||
__ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag);
|
||||
__ blx(R1);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther,
|
||||
Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
|
||||
RecordCallInfo(
|
||||
token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1113,8 +1113,7 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ BranchLinkPatchable(label);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1124,18 +1123,7 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ BranchLinkPatchable(label);
|
||||
AddCurrentDescriptor(kind, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count());
|
||||
}
|
||||
|
||||
|
||||
@@ -1145,20 +1133,7 @@ void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
|
||||
intptr_t argument_count,
|
||||
LocationSummary* locs) {
|
||||
__ CallRuntime(entry, argument_count);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
}
|
||||
RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1278,10 +1253,8 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ LoadObject(R4, arguments_descriptor, PP);
|
||||
__ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, PP);
|
||||
__ blr(R1);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther,
|
||||
Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
|
||||
RecordCallInfo(
|
||||
token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1110,8 +1110,7 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ call(label);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1121,18 +1120,7 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ call(label);
|
||||
AddCurrentDescriptor(kind, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count());
|
||||
}
|
||||
|
||||
|
||||
@@ -1142,20 +1130,7 @@ void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
|
||||
intptr_t argument_count,
|
||||
LocationSummary* locs) {
|
||||
__ CallRuntime(entry, argument_count);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
}
|
||||
RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1297,10 +1272,8 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ LoadObject(EDX, arguments_descriptor);
|
||||
__ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
|
||||
__ call(EBX);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther,
|
||||
Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
|
||||
RecordCallInfo(
|
||||
token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1139,8 +1139,7 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ BranchLinkPatchable(label);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1150,20 +1149,7 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ BranchLinkPatchable(label);
|
||||
AddCurrentDescriptor(kind, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos);
|
||||
}
|
||||
RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count());
|
||||
}
|
||||
|
||||
|
||||
@@ -1173,22 +1159,7 @@ void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
|
||||
intptr_t argument_count,
|
||||
LocationSummary* locs) {
|
||||
__ CallRuntime(entry, argument_count);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos);
|
||||
}
|
||||
}
|
||||
RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1312,10 +1283,8 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ LoadObject(S4, arguments_descriptor);
|
||||
__ AddImmediate(T1, Instructions::HeaderSize() - kHeapObjectTag);
|
||||
__ jalr(T1);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther,
|
||||
Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
|
||||
RecordCallInfo(
|
||||
token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1148,8 +1148,7 @@ void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ Call(label, PP);
|
||||
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1159,18 +1158,7 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
|
||||
RawPcDescriptors::Kind kind,
|
||||
LocationSummary* locs) {
|
||||
__ CallPatchable(label);
|
||||
AddCurrentDescriptor(kind, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count());
|
||||
}
|
||||
|
||||
|
||||
@@ -1180,20 +1168,7 @@ void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
|
||||
intptr_t argument_count,
|
||||
LocationSummary* locs) {
|
||||
__ CallRuntime(entry, argument_count);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
if (deopt_id != Isolate::kNoDeoptId) {
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, token_pos);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
|
||||
}
|
||||
}
|
||||
RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1334,10 +1309,8 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ AddImmediate(
|
||||
RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP);
|
||||
__ call(RCX);
|
||||
AddCurrentDescriptor(RawPcDescriptors::kOther,
|
||||
Isolate::kNoDeoptId, token_pos);
|
||||
RecordSafepoint(locs);
|
||||
AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
|
||||
RecordCallInfo(
|
||||
token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -2722,12 +2722,15 @@ void Environment::DeepCopyTo(Isolate* isolate, Instruction* instr) const {
|
||||
|
||||
// Copies the environment as outer on an inlined instruction and updates the
|
||||
// environment use lists.
|
||||
void Environment::DeepCopyToOuter(Isolate* isolate, Instruction* instr) const {
|
||||
void Environment::DeepCopyToOuter(Isolate* isolate,
|
||||
Instruction* instr,
|
||||
intptr_t input_count) const {
|
||||
// Create a deep copy removing caller arguments from the environment.
|
||||
ASSERT(this != NULL);
|
||||
ASSERT(instr->env()->outer() == NULL);
|
||||
intptr_t argument_count = instr->env()->fixed_parameter_count();
|
||||
Environment* copy = DeepCopy(isolate, values_.length() - argument_count);
|
||||
Environment* copy = DeepCopy(isolate,
|
||||
values_.length() - argument_count - input_count);
|
||||
instr->env()->outer_ = copy;
|
||||
intptr_t use_index = instr->env()->Length(); // Start index after inner.
|
||||
for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
|
||||
|
||||
@@ -8376,7 +8376,9 @@ class Environment : public ZoneAllocated {
|
||||
}
|
||||
|
||||
void DeepCopyTo(Isolate* isolate, Instruction* instr) const;
|
||||
void DeepCopyToOuter(Isolate* isolate, Instruction* instr) const;
|
||||
void DeepCopyToOuter(Isolate* isolate,
|
||||
Instruction* instr,
|
||||
intptr_t input_count) const;
|
||||
|
||||
void PrintTo(BufferFormatter* f) const;
|
||||
const char* ToCString() const;
|
||||
|
||||
@@ -227,22 +227,11 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
__ LoadImmediate(R5, 0);
|
||||
__ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag);
|
||||
__ blx(R2);
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
token_pos());
|
||||
compiler->RecordSafepoint(locs());
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
|
||||
if (compiler->is_optimizing()) {
|
||||
compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos());
|
||||
}
|
||||
compiler->RecordCallInfo(token_pos(),
|
||||
RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
locs(),
|
||||
locs()->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,22 +222,11 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
__ LoadImmediate(R5, 0, PP);
|
||||
__ AddImmediate(R2, R2, Instructions::HeaderSize() - kHeapObjectTag, PP);
|
||||
__ blr(R2);
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
token_pos());
|
||||
compiler->RecordSafepoint(locs());
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
|
||||
if (compiler->is_optimizing()) {
|
||||
compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos());
|
||||
}
|
||||
compiler->RecordCallInfo(token_pos(),
|
||||
RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
locs(),
|
||||
locs()->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -6885,22 +6885,11 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
__ xorl(ECX, ECX);
|
||||
__ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
|
||||
__ call(EBX);
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
token_pos());
|
||||
compiler->RecordSafepoint(locs());
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
|
||||
if (compiler->is_optimizing()) {
|
||||
compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos());
|
||||
}
|
||||
compiler->RecordCallInfo(token_pos(),
|
||||
RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
locs(),
|
||||
locs()->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,22 +247,11 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
__ lw(T2, FieldAddress(T0, Function::instructions_offset()));
|
||||
__ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag);
|
||||
__ jalr(T2);
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
token_pos());
|
||||
compiler->RecordSafepoint(locs());
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
|
||||
if (compiler->is_optimizing()) {
|
||||
compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos());
|
||||
}
|
||||
compiler->RecordCallInfo(token_pos(),
|
||||
RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
locs(),
|
||||
locs()->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -5888,22 +5888,11 @@ void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
__ xorq(RBX, RBX);
|
||||
__ addq(RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
|
||||
__ call(RCX);
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
token_pos());
|
||||
compiler->RecordSafepoint(locs());
|
||||
// Marks either the continuation point in unoptimized code or the
|
||||
// deoptimization point in optimized code, after call.
|
||||
const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id());
|
||||
if (compiler->is_optimizing()) {
|
||||
compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos());
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
|
||||
deopt_id_after,
|
||||
token_pos());
|
||||
}
|
||||
compiler->RecordCallInfo(token_pos(),
|
||||
RawPcDescriptors::kClosureCall,
|
||||
deopt_id(),
|
||||
locs(),
|
||||
locs()->input_count());
|
||||
__ Drop(argument_count);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user