Profiler experiments: fix snapshotting with count-based interrupts

Review URL: https://chromiumcodereview.appspot.com/9447098

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10837 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 610d179b
...@@ -342,7 +342,15 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, ...@@ -342,7 +342,15 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
weight = Min(127, Max(1, distance / 100)); weight = Min(127, Max(1, distance / 100));
} }
__ sub(Operand::Cell(profiling_counter_), Immediate(Smi::FromInt(weight))); if (Serializer::enabled()) {
__ mov(ebx, Immediate(profiling_counter_));
__ sub(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset),
Immediate(Smi::FromInt(weight)));
} else {
// This version is slightly faster, but not snapshot safe.
__ sub(Operand::Cell(profiling_counter_),
Immediate(Smi::FromInt(weight)));
}
__ j(positive, &ok, Label::kNear); __ j(positive, &ok, Label::kNear);
InterruptStub stub; InterruptStub stub;
__ CallStub(&stub); __ CallStub(&stub);
...@@ -372,8 +380,14 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, ...@@ -372,8 +380,14 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
if (FLAG_count_based_interrupts) { if (FLAG_count_based_interrupts) {
// Reset the countdown. // Reset the countdown.
__ mov(Operand::Cell(profiling_counter_), if (Serializer::enabled()) {
Immediate(Smi::FromInt(FLAG_interrupt_budget))); __ mov(ebx, Immediate(profiling_counter_));
__ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset),
Immediate(Smi::FromInt(FLAG_interrupt_budget)));
} else {
__ mov(Operand::Cell(profiling_counter_),
Immediate(Smi::FromInt(FLAG_interrupt_budget)));
}
} }
__ bind(&ok); __ bind(&ok);
...@@ -403,8 +417,15 @@ void FullCodeGenerator::EmitReturnSequence() { ...@@ -403,8 +417,15 @@ void FullCodeGenerator::EmitReturnSequence() {
int distance = masm_->pc_offset(); int distance = masm_->pc_offset();
weight = Min(127, Max(1, distance / 100)); weight = Min(127, Max(1, distance / 100));
} }
__ sub(Operand::Cell(profiling_counter_), if (Serializer::enabled()) {
Immediate(Smi::FromInt(weight))); __ mov(ebx, Immediate(profiling_counter_));
__ sub(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset),
Immediate(Smi::FromInt(weight)));
} else {
// This version is slightly faster, but not snapshot safe.
__ sub(Operand::Cell(profiling_counter_),
Immediate(Smi::FromInt(weight)));
}
Label ok; Label ok;
__ j(positive, &ok, Label::kNear); __ j(positive, &ok, Label::kNear);
__ push(eax); __ push(eax);
...@@ -412,8 +433,14 @@ void FullCodeGenerator::EmitReturnSequence() { ...@@ -412,8 +433,14 @@ void FullCodeGenerator::EmitReturnSequence() {
__ CallStub(&stub); __ CallStub(&stub);
__ pop(eax); __ pop(eax);
// Reset the countdown. // Reset the countdown.
__ mov(Operand::Cell(profiling_counter_), if (Serializer::enabled()) {
Immediate(Smi::FromInt(FLAG_interrupt_budget))); __ mov(ebx, Immediate(profiling_counter_));
__ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset),
Immediate(Smi::FromInt(FLAG_interrupt_budget)));
} else {
__ mov(Operand::Cell(profiling_counter_),
Immediate(Smi::FromInt(FLAG_interrupt_budget)));
}
__ bind(&ok); __ bind(&ok);
} }
#ifdef DEBUG #ifdef DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment