OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 ASSERT(ToRegister(instr->left()).is(rdx)); | 1815 ASSERT(ToRegister(instr->left()).is(rdx)); |
1816 ASSERT(ToRegister(instr->right()).is(rax)); | 1816 ASSERT(ToRegister(instr->right()).is(rax)); |
1817 ASSERT(ToRegister(instr->result()).is(rax)); | 1817 ASSERT(ToRegister(instr->result()).is(rax)); |
1818 | 1818 |
1819 BinaryOpStub stub(instr->op(), NO_OVERWRITE); | 1819 BinaryOpStub stub(instr->op(), NO_OVERWRITE); |
1820 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 1820 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
1821 __ nop(); // Signals no inlined code. | 1821 __ nop(); // Signals no inlined code. |
1822 } | 1822 } |
1823 | 1823 |
1824 | 1824 |
1825 int LCodeGen::GetNextEmittedBlock(int block) { | 1825 int LCodeGen::GetNextEmittedBlock() { |
1826 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { | 1826 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
1827 LLabel* label = chunk_->GetLabel(i); | 1827 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
1828 if (!label->HasReplacement()) return i; | |
1829 } | 1828 } |
1830 return -1; | 1829 return -1; |
1831 } | 1830 } |
1832 | 1831 |
1833 | 1832 |
1834 void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) { | 1833 void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) { |
1835 int next_block = GetNextEmittedBlock(current_block_); | 1834 int next_block = GetNextEmittedBlock(); |
1836 right_block = chunk_->LookupDestination(right_block); | 1835 right_block = chunk_->LookupDestination(right_block); |
1837 left_block = chunk_->LookupDestination(left_block); | 1836 left_block = chunk_->LookupDestination(left_block); |
1838 | 1837 |
1839 if (right_block == left_block) { | 1838 if (right_block == left_block) { |
1840 EmitGoto(left_block); | 1839 EmitGoto(left_block); |
1841 } else if (left_block == next_block) { | 1840 } else if (left_block == next_block) { |
1842 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); | 1841 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); |
1843 } else if (right_block == next_block) { | 1842 } else if (right_block == next_block) { |
1844 __ j(cc, chunk_->GetAssemblyLabel(left_block)); | 1843 __ j(cc, chunk_->GetAssemblyLabel(left_block)); |
1845 } else { | 1844 } else { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 } | 1954 } |
1956 | 1955 |
1957 // We've seen something for the first time -> deopt. | 1956 // We've seen something for the first time -> deopt. |
1958 DeoptimizeIf(no_condition, instr->environment()); | 1957 DeoptimizeIf(no_condition, instr->environment()); |
1959 } | 1958 } |
1960 } | 1959 } |
1961 } | 1960 } |
1962 | 1961 |
1963 | 1962 |
1964 void LCodeGen::EmitGoto(int block) { | 1963 void LCodeGen::EmitGoto(int block) { |
1965 block = chunk_->LookupDestination(block); | 1964 int destination = chunk_->LookupDestination(block); |
1966 int next_block = GetNextEmittedBlock(current_block_); | 1965 if (destination != GetNextEmittedBlock()) { |
1967 if (block != next_block) { | 1966 __ jmp(chunk_->GetAssemblyLabel(destination)); |
1968 __ jmp(chunk_->GetAssemblyLabel(block)); | |
1969 } | 1967 } |
1970 } | 1968 } |
1971 | 1969 |
1972 | 1970 |
1973 void LCodeGen::DoGoto(LGoto* instr) { | 1971 void LCodeGen::DoGoto(LGoto* instr) { |
1974 EmitGoto(instr->block_id()); | 1972 EmitGoto(instr->block_id()); |
1975 } | 1973 } |
1976 | 1974 |
1977 | 1975 |
1978 inline Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { | 1976 inline Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { |
(...skipping 3682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5661 FixedArray::kHeaderSize - kPointerSize)); | 5659 FixedArray::kHeaderSize - kPointerSize)); |
5662 __ bind(&done); | 5660 __ bind(&done); |
5663 } | 5661 } |
5664 | 5662 |
5665 | 5663 |
5666 #undef __ | 5664 #undef __ |
5667 | 5665 |
5668 } } // namespace v8::internal | 5666 } } // namespace v8::internal |
5669 | 5667 |
5670 #endif // V8_TARGET_ARCH_X64 | 5668 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |