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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 81
82 void LCodeGen::FinishCode(Handle<Code> code) { 82 void LCodeGen::FinishCode(Handle<Code> code) {
83 ASSERT(is_done()); 83 ASSERT(is_done());
84 code->set_stack_slots(GetStackSlotCount()); 84 code->set_stack_slots(GetStackSlotCount());
85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
86 if (FLAG_weak_embedded_maps_in_optimized_code) { 86 if (FLAG_weak_embedded_maps_in_optimized_code) {
87 RegisterDependentCodeForEmbeddedMaps(code); 87 RegisterDependentCodeForEmbeddedMaps(code);
88 } 88 }
89 PopulateDeoptimizationData(code); 89 PopulateDeoptimizationData(code);
90 PopulateDeoptCounterCells(code);
90 for (int i = 0 ; i < prototype_maps_.length(); i++) { 91 for (int i = 0 ; i < prototype_maps_.length(); i++) {
91 prototype_maps_.at(i)->AddDependentCode( 92 prototype_maps_.at(i)->AddDependentCode(
92 DependentCode::kPrototypeCheckGroup, code); 93 DependentCode::kPrototypeCheckGroup, code);
93 } 94 }
94 for (int i = 0 ; i < transition_maps_.length(); i++) { 95 for (int i = 0 ; i < transition_maps_.length(); i++) {
95 transition_maps_.at(i)->AddDependentCode( 96 transition_maps_.at(i)->AddDependentCode(
96 DependentCode::kTransitionGroup, code); 97 DependentCode::kTransitionGroup, code);
97 } 98 }
98 if (graph()->depends_on_empty_array_proto_elements()) { 99 if (graph()->depends_on_empty_array_proto_elements()) {
99 isolate()->initial_object_prototype()->map()->AddDependentCode( 100 isolate()->initial_object_prototype()->map()->AddDependentCode(
(...skipping 5460 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 5561
5561 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { 5562 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
5562 EnsureSpaceForLazyDeopt(); 5563 EnsureSpaceForLazyDeopt();
5563 ASSERT(instr->HasEnvironment()); 5564 ASSERT(instr->HasEnvironment());
5564 LEnvironment* env = instr->environment(); 5565 LEnvironment* env = instr->environment();
5565 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); 5566 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
5566 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); 5567 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
5567 } 5568 }
5568 5569
5569 5570
5571 void LCodeGen::DoDeoptCounter(LDeoptCounter* instr) {
5572 Handle<JSGlobalPropertyCell> cell =
5573 isolate()->factory()->NewJSGlobalPropertyCell(
5574 Handle<Object>(Smi::FromInt(instr->initial_value()), isolate()));
5575 LDeoptCounterCell* deopt_cell =
5576 new(zone()) LDeoptCounterCell(instr->id(), instr->max_value(), cell);
5577 deopt_counter_cells_.Add(deopt_cell, zone());
5578 }
5579
5580
5581 void LCodeGen::DoDeoptCounterAdd(LDeoptCounterAdd* instr) {
5582 for (int i = 0; i < deopt_counter_cells_.length(); ++i) {
5583 LDeoptCounterCell* deopt_cell = deopt_counter_cells_[i];
5584 if (deopt_cell->id() != instr->counter()) continue;
5585
5586 Handle<JSGlobalPropertyCell> cell = deopt_cell->cell();
5587 Register scratch = ToRegister(instr->temp());
5588 Register scratch2 = ToRegister(instr->temp2());
5589
5590 // Increment counter
5591 Label ok;
5592 MemOperand counter =
5593 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset);
5594
5595 ASSERT(instr->delta() != 0);
5596 __ LoadHeapObject(scratch, cell);
5597 __ lw(scratch2, counter);
5598 __ Addu(scratch2, scratch2, Operand(Smi::FromInt(instr->delta())));
5599 __ Branch(&ok,
5600 le,
5601 scratch2,
5602 Operand(Smi::FromInt(deopt_cell->max_value())));
5603
5604 // Limit counter
5605 __ li(scratch2, Operand(Smi::FromInt(deopt_cell->max_value())));
5606 __ bind(&ok);
5607 __ sw(scratch2, counter);
5608
5609 // And deoptimize on negative value
5610 DeoptimizeIf(le,
5611 instr->environment(),
5612 Deoptimizer::SOFT,
5613 scratch2,
5614 Operand(Smi::FromInt(0)));
5615 return;
5616 }
5617 UNREACHABLE();
5618 }
5619
5620
5570 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { 5621 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
5571 if (instr->hydrogen_value()->IsSoftDeoptimize()) { 5622 if (instr->hydrogen_value()->IsSoftDeoptimize()) {
5572 SoftDeoptimize(instr->environment(), zero_reg, Operand(zero_reg)); 5623 SoftDeoptimize(instr->environment(), zero_reg, Operand(zero_reg));
5573 } else { 5624 } else {
5574 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg)); 5625 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg));
5575 } 5626 }
5576 } 5627 }
5577 5628
5578 5629
5579 void LCodeGen::DoDummyUse(LDummyUse* instr) { 5630 void LCodeGen::DoDummyUse(LDummyUse* instr) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5768 __ Subu(scratch, result, scratch); 5819 __ Subu(scratch, result, scratch);
5769 __ lw(result, FieldMemOperand(scratch, 5820 __ lw(result, FieldMemOperand(scratch,
5770 FixedArray::kHeaderSize - kPointerSize)); 5821 FixedArray::kHeaderSize - kPointerSize));
5771 __ bind(&done); 5822 __ bind(&done);
5772 } 5823 }
5773 5824
5774 5825
5775 #undef __ 5826 #undef __
5776 5827
5777 } } // namespace v8::internal 5828 } } // namespace v8::internal
OLDNEW
« 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