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

Side by Side Diff: src/compiler/mips/code-generator-mips.cc

Issue 940453003: MIPS: Fix 'MIPS: [turbofan] Optimize certain chains of Branch into a Switch.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix nit. Created 5 years, 10 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 | « no previous file | src/compiler/mips/instruction-selector-mips.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/mips/macro-assembler-mips.h" 9 #include "src/mips/macro-assembler-mips.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 __ bind(&false_value); 882 __ bind(&false_value);
883 __ li(result, Operand(0)); 883 __ li(result, Operand(0));
884 __ bind(&done); 884 __ bind(&done);
885 } 885 }
886 886
887 887
888 void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { 888 void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) {
889 MipsOperandConverter i(this, instr); 889 MipsOperandConverter i(this, instr);
890 Register input = i.InputRegister(0); 890 Register input = i.InputRegister(0);
891 for (size_t index = 2; index < instr->InputCount(); index += 2) { 891 for (size_t index = 2; index < instr->InputCount(); index += 2) {
892 __ Branch(GetLabel(i.InputRpo(index + 1)), eq, input, 892 __ li(at, Operand(i.InputInt32(index + 0)));
893 Operand(i.InputInt32(index + 0))); 893 __ beq(input, at, GetLabel(i.InputRpo(index + 1)));
894 } 894 }
895 __ nop(); // Branch delay slot of the last beq.
895 AssembleArchJump(i.InputRpo(1)); 896 AssembleArchJump(i.InputRpo(1));
896 } 897 }
897 898
898 899
899 void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { 900 void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
900 MipsOperandConverter i(this, instr); 901 MipsOperandConverter i(this, instr);
901 Register input = i.InputRegister(0); 902 Register input = i.InputRegister(0);
902 size_t const case_count = instr->InputCount() - 2; 903 size_t const case_count = instr->InputCount() - 2;
903 Label here; 904 Label here;
904 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); 905 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count));
906 __ BlockTrampolinePoolFor(case_count + 6);
905 __ bal(&here); 907 __ bal(&here);
906 __ nop(); // Branch delay slot nop. 908 __ sll(at, input, 2); // Branch delay slot.
907 __ bind(&here); 909 __ bind(&here);
908 __ sll(at, input, 2);
909 __ addu(at, at, ra); 910 __ addu(at, at, ra);
910 __ lw(at, MemOperand(at, 5 * v8::internal::Assembler::kInstrSize)); 911 __ lw(at, MemOperand(at, 4 * v8::internal::Assembler::kInstrSize));
911 __ jr(at); 912 __ jr(at);
912 __ nop(); // Branch delay slot nop. 913 __ nop(); // Branch delay slot nop.
913 for (size_t index = 0; index < case_count; ++index) { 914 for (size_t index = 0; index < case_count; ++index) {
914 __ dd(GetLabel(i.InputRpo(index + 2))); 915 __ dd(GetLabel(i.InputRpo(index + 2)));
915 } 916 }
916 } 917 }
917 918
918 919
919 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { 920 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) {
920 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( 921 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1198 }
1198 } 1199 }
1199 MarkLazyDeoptSite(); 1200 MarkLazyDeoptSite();
1200 } 1201 }
1201 1202
1202 #undef __ 1203 #undef __
1203 1204
1204 } // namespace compiler 1205 } // namespace compiler
1205 } // namespace internal 1206 } // namespace internal
1206 } // namespace v8 1207 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips/instruction-selector-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698