| Index: src/arm/lithium-codegen-arm.cc
|
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
|
| index 06a6506b2216580401c8b666ad6de2499d1bc14a..2932d9cbd402f2e142a0a45e9050d1bfc3024874 100644
|
| --- a/src/arm/lithium-codegen-arm.cc
|
| +++ b/src/arm/lithium-codegen-arm.cc
|
| @@ -87,6 +87,7 @@ void LCodeGen::FinishCode(Handle<Code> code) {
|
| RegisterDependentCodeForEmbeddedMaps(code);
|
| }
|
| PopulateDeoptimizationData(code);
|
| + PopulateDeoptCounterCells(code);
|
| for (int i = 0 ; i < prototype_maps_.length(); i++) {
|
| prototype_maps_.at(i)->AddDependentCode(
|
| DependentCode::kPrototypeCheckGroup, code);
|
| @@ -5794,6 +5795,54 @@ void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoDeoptCounter(LDeoptCounter* instr) {
|
| + Handle<JSGlobalPropertyCell> cell =
|
| + isolate()->factory()->NewJSGlobalPropertyCell(
|
| + Handle<Object>(Smi::FromInt(instr->initial_value()), isolate()));
|
| + LDeoptCounterCell* deopt_cell =
|
| + new(zone()) LDeoptCounterCell(instr->id(), instr->max_value(), cell);
|
| + deopt_counter_cells_.Add(deopt_cell, zone());
|
| +}
|
| +
|
| +
|
| +void LCodeGen::DoDeoptCounterAdd(LDeoptCounterAdd* instr) {
|
| + for (int i = 0; i < deopt_counter_cells_.length(); ++i) {
|
| + LDeoptCounterCell* deopt_cell = deopt_counter_cells_[i];
|
| + if (deopt_cell->id() != instr->counter()) continue;
|
| +
|
| + Handle<JSGlobalPropertyCell> cell = deopt_cell->cell();
|
| + Register scratch = ToRegister(instr->temp());
|
| + Register scratch2 = ToRegister(instr->temp2());
|
| +
|
| + // Increment counter
|
| + Label ok;
|
| + MemOperand counter = MemOperand(scratch,
|
| + JSGlobalPropertyCell::kValueOffset);
|
| +
|
| + ASSERT(instr->delta() != 0);
|
| + __ LoadHeapObject(scratch, cell);
|
| + __ ldr(scratch2, counter);
|
| + __ AssertSmi(scratch2);
|
| + __ add(scratch2, scratch2, Operand(Smi::FromInt(instr->delta())));
|
| + __ cmp(scratch2, Operand(Smi::FromInt(deopt_cell->max_value())));
|
| + __ b(le, &ok);
|
| +
|
| + // Limit counter
|
| + __ mov(scratch2, Operand(Smi::FromInt(deopt_cell->max_value())));
|
| + __ bind(&ok);
|
| +
|
| + // Update cell value
|
| + __ str(scratch2, counter);
|
| +
|
| + // And deoptimize on negative value
|
| + __ cmp(scratch2, Operand(Smi::FromInt(0)));
|
| + DeoptimizeIf(le, instr->environment(), Deoptimizer::SOFT);
|
| + return;
|
| + }
|
| + UNREACHABLE();
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
| if (instr->hydrogen_value()->IsSoftDeoptimize()) {
|
| SoftDeoptimize(instr->environment());
|
|
|