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

Unified Diff: src/arm/lithium-codegen-arm.cc

Issue 16128004: Reorder switch clauses using newly-introduced execution counters in (Closed) Base URL: gh:v8/v8.git@master
Patch Set: tweak heuristic Created 7 years, 7 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 | « src/arm/lithium-codegen-arm.h ('k') | src/ast.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698