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

Unified Diff: src/mips/lithium-codegen-mips.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/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
index 25ba16232aa5a7b70f19e86756bcd5809a590e58..7be1748f088b5bb4f1cd5578d2c16bb0f6be06a6 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.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);
@@ -5567,6 +5568,56 @@ 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 =
+ FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset);
+
+ ASSERT(instr->delta() != 0);
+ __ LoadHeapObject(scratch, cell);
+ __ lw(scratch2, counter);
+ __ Addu(scratch2, scratch2, Operand(Smi::FromInt(instr->delta())));
+ __ Branch(&ok,
+ le,
+ scratch2,
+ Operand(Smi::FromInt(deopt_cell->max_value())));
+
+ // Limit counter
+ __ li(scratch2, Operand(Smi::FromInt(deopt_cell->max_value())));
+ __ bind(&ok);
+ __ sw(scratch2, counter);
+
+ // And deoptimize on negative value
+ DeoptimizeIf(le,
+ instr->environment(),
+ Deoptimizer::SOFT,
+ scratch2,
+ Operand(Smi::FromInt(0)));
+ return;
+ }
+ UNREACHABLE();
+}
+
+
void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
if (instr->hydrogen_value()->IsSoftDeoptimize()) {
SoftDeoptimize(instr->environment(), zero_reg, Operand(zero_reg));
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698