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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 14246031: Simplified LCodeGen::GetNextEmittedBlock and LCodeGen::EmitGoto a bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/x64/lithium-codegen-x64.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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 ASSERT(ToRegister(instr->result()).is(v0)); 1749 ASSERT(ToRegister(instr->result()).is(v0));
1750 1750
1751 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 1751 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
1752 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 1752 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1753 // Other arch use a nop here, to signal that there is no inlined 1753 // Other arch use a nop here, to signal that there is no inlined
1754 // patchable code. Mips does not need the nop, since our marker 1754 // patchable code. Mips does not need the nop, since our marker
1755 // instruction (andi zero_reg) will never be used in normal code. 1755 // instruction (andi zero_reg) will never be used in normal code.
1756 } 1756 }
1757 1757
1758 1758
1759 int LCodeGen::GetNextEmittedBlock(int block) { 1759 int LCodeGen::GetNextEmittedBlock() {
1760 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { 1760 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
1761 LLabel* label = chunk_->GetLabel(i); 1761 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
1762 if (!label->HasReplacement()) return i;
1763 } 1762 }
1764 return -1; 1763 return -1;
1765 } 1764 }
1766 1765
1767 1766
1768 void LCodeGen::EmitBranch(int left_block, int right_block, 1767 void LCodeGen::EmitBranch(int left_block, int right_block,
1769 Condition cc, Register src1, const Operand& src2) { 1768 Condition cc, Register src1, const Operand& src2) {
1770 int next_block = GetNextEmittedBlock(current_block_); 1769 int next_block = GetNextEmittedBlock();
1771 right_block = chunk_->LookupDestination(right_block); 1770 right_block = chunk_->LookupDestination(right_block);
1772 left_block = chunk_->LookupDestination(left_block); 1771 left_block = chunk_->LookupDestination(left_block);
1773 if (right_block == left_block) { 1772 if (right_block == left_block) {
1774 EmitGoto(left_block); 1773 EmitGoto(left_block);
1775 } else if (left_block == next_block) { 1774 } else if (left_block == next_block) {
1776 __ Branch(chunk_->GetAssemblyLabel(right_block), 1775 __ Branch(chunk_->GetAssemblyLabel(right_block),
1777 NegateCondition(cc), src1, src2); 1776 NegateCondition(cc), src1, src2);
1778 } else if (right_block == next_block) { 1777 } else if (right_block == next_block) {
1779 __ Branch(chunk_->GetAssemblyLabel(left_block), cc, src1, src2); 1778 __ Branch(chunk_->GetAssemblyLabel(left_block), cc, src1, src2);
1780 } else { 1779 } else {
1781 __ Branch(chunk_->GetAssemblyLabel(left_block), cc, src1, src2); 1780 __ Branch(chunk_->GetAssemblyLabel(left_block), cc, src1, src2);
1782 __ Branch(chunk_->GetAssemblyLabel(right_block)); 1781 __ Branch(chunk_->GetAssemblyLabel(right_block));
1783 } 1782 }
1784 } 1783 }
1785 1784
1786 1785
1787 void LCodeGen::EmitBranchF(int left_block, int right_block, 1786 void LCodeGen::EmitBranchF(int left_block, int right_block,
1788 Condition cc, FPURegister src1, FPURegister src2) { 1787 Condition cc, FPURegister src1, FPURegister src2) {
1789 int next_block = GetNextEmittedBlock(current_block_); 1788 int next_block = GetNextEmittedBlock();
1790 right_block = chunk_->LookupDestination(right_block); 1789 right_block = chunk_->LookupDestination(right_block);
1791 left_block = chunk_->LookupDestination(left_block); 1790 left_block = chunk_->LookupDestination(left_block);
1792 if (right_block == left_block) { 1791 if (right_block == left_block) {
1793 EmitGoto(left_block); 1792 EmitGoto(left_block);
1794 } else if (left_block == next_block) { 1793 } else if (left_block == next_block) {
1795 __ BranchF(chunk_->GetAssemblyLabel(right_block), NULL, 1794 __ BranchF(chunk_->GetAssemblyLabel(right_block), NULL,
1796 NegateCondition(cc), src1, src2); 1795 NegateCondition(cc), src1, src2);
1797 } else if (right_block == next_block) { 1796 } else if (right_block == next_block) {
1798 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, cc, src1, src2); 1797 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, cc, src1, src2);
1799 } else { 1798 } else {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 } 1908 }
1910 1909
1911 // We've seen something for the first time -> deopt. 1910 // We've seen something for the first time -> deopt.
1912 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg)); 1911 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg));
1913 } 1912 }
1914 } 1913 }
1915 } 1914 }
1916 1915
1917 1916
1918 void LCodeGen::EmitGoto(int block) { 1917 void LCodeGen::EmitGoto(int block) {
1919 block = chunk_->LookupDestination(block); 1918 int destination = chunk_->LookupDestination(block);
1920 int next_block = GetNextEmittedBlock(current_block_); 1919 if (destination != GetNextEmittedBlock()) {
1921 if (block != next_block) { 1920 __ jmp(chunk_->GetAssemblyLabel(destination));
1922 __ jmp(chunk_->GetAssemblyLabel(block));
1923 } 1921 }
1924 } 1922 }
1925 1923
1926 1924
1927 void LCodeGen::DoGoto(LGoto* instr) { 1925 void LCodeGen::DoGoto(LGoto* instr) {
1928 EmitGoto(instr->block_id()); 1926 EmitGoto(instr->block_id());
1929 } 1927 }
1930 1928
1931 1929
1932 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { 1930 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
(...skipping 3787 matching lines...) Expand 10 before | Expand all | Expand 10 after
5720 __ Subu(scratch, result, scratch); 5718 __ Subu(scratch, result, scratch);
5721 __ lw(result, FieldMemOperand(scratch, 5719 __ lw(result, FieldMemOperand(scratch,
5722 FixedArray::kHeaderSize - kPointerSize)); 5720 FixedArray::kHeaderSize - kPointerSize));
5723 __ bind(&done); 5721 __ bind(&done);
5724 } 5722 }
5725 5723
5726 5724
5727 #undef __ 5725 #undef __
5728 5726
5729 } } // namespace v8::internal 5727 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698