OLD | NEW |
---|---|
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 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2154 | 2154 |
2155 int LCodeGen::GetNextEmittedBlock() const { | 2155 int LCodeGen::GetNextEmittedBlock() const { |
2156 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 2156 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
2157 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 2157 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
2158 } | 2158 } |
2159 return -1; | 2159 return -1; |
2160 } | 2160 } |
2161 | 2161 |
2162 template<class InstrType> | 2162 template<class InstrType> |
2163 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { | 2163 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { |
2164 int left_block = instr->TrueDestination(chunk_); | |
danno
2013/06/21 16:38:04
Why this unrelated change?
| |
2164 int right_block = instr->FalseDestination(chunk_); | 2165 int right_block = instr->FalseDestination(chunk_); |
2165 int left_block = instr->TrueDestination(chunk_); | |
2166 | 2166 |
2167 int next_block = GetNextEmittedBlock(); | 2167 int next_block = GetNextEmittedBlock(); |
2168 | 2168 |
2169 if (right_block == left_block) { | 2169 if (right_block == left_block || cc == al) { |
2170 EmitGoto(left_block); | 2170 EmitGoto(left_block); |
2171 } else if (left_block == next_block) { | 2171 } else if (left_block == next_block) { |
2172 __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); | 2172 __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); |
2173 } else if (right_block == next_block) { | 2173 } else if (right_block == next_block) { |
2174 __ b(cc, chunk_->GetAssemblyLabel(left_block)); | 2174 __ b(cc, chunk_->GetAssemblyLabel(left_block)); |
2175 } else { | 2175 } else { |
2176 __ b(cc, chunk_->GetAssemblyLabel(left_block)); | 2176 __ b(cc, chunk_->GetAssemblyLabel(left_block)); |
2177 __ b(chunk_->GetAssemblyLabel(right_block)); | 2177 __ b(chunk_->GetAssemblyLabel(right_block)); |
2178 } | 2178 } |
2179 } | 2179 } |
2180 | 2180 |
2181 | 2181 |
2182 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { | 2182 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { |
2183 __ stop("LBreak"); | 2183 __ stop("LBreak"); |
2184 } | 2184 } |
2185 | 2185 |
2186 | 2186 |
2187 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) { | |
2188 Representation r = instr->hydrogen()->value()->representation(); | |
2189 if (r.IsSmiOrInteger32() || r.IsDouble()) { | |
2190 EmitBranch(instr, al); | |
2191 } else { | |
2192 ASSERT(r.IsTagged()); | |
2193 Register reg = ToRegister(instr->value()); | |
2194 HType type = instr->hydrogen()->value()->type(); | |
2195 if (type.IsTaggedNumber()) { | |
2196 EmitBranch(instr, al); | |
2197 } | |
2198 __ JumpIfSmi(reg, instr->TrueLabel(chunk_)); | |
2199 __ ldr(ip, FieldMemOperand(reg, HeapObject::kMapOffset)); | |
Rodolph Perfetta
2013/06/21 18:32:38
ip shouldn't be used outside the macro assembler.
| |
2200 __ CompareRoot(ip, Heap::kHeapNumberMapRootIndex); | |
2201 EmitBranch(instr, eq); | |
2202 } | |
2203 } | |
2204 | |
2205 | |
2187 void LCodeGen::DoBranch(LBranch* instr) { | 2206 void LCodeGen::DoBranch(LBranch* instr) { |
2188 Representation r = instr->hydrogen()->value()->representation(); | 2207 Representation r = instr->hydrogen()->value()->representation(); |
2189 if (r.IsInteger32() || r.IsSmi()) { | 2208 if (r.IsInteger32() || r.IsSmi()) { |
2190 ASSERT(!info()->IsStub()); | 2209 ASSERT(!info()->IsStub()); |
2191 Register reg = ToRegister(instr->value()); | 2210 Register reg = ToRegister(instr->value()); |
2192 __ cmp(reg, Operand::Zero()); | 2211 __ cmp(reg, Operand::Zero()); |
2193 EmitBranch(instr, ne); | 2212 EmitBranch(instr, ne); |
2194 } else if (r.IsDouble()) { | 2213 } else if (r.IsDouble()) { |
2195 ASSERT(!info()->IsStub()); | 2214 ASSERT(!info()->IsStub()); |
2196 DwVfpRegister reg = ToDoubleRegister(instr->value()); | 2215 DwVfpRegister reg = ToDoubleRegister(instr->value()); |
(...skipping 3727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5924 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5943 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5925 __ ldr(result, FieldMemOperand(scratch, | 5944 __ ldr(result, FieldMemOperand(scratch, |
5926 FixedArray::kHeaderSize - kPointerSize)); | 5945 FixedArray::kHeaderSize - kPointerSize)); |
5927 __ bind(&done); | 5946 __ bind(&done); |
5928 } | 5947 } |
5929 | 5948 |
5930 | 5949 |
5931 #undef __ | 5950 #undef __ |
5932 | 5951 |
5933 } } // namespace v8::internal | 5952 } } // namespace v8::internal |
OLD | NEW |