OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 FPURegister src1, | 2093 FPURegister src1, |
2094 FPURegister src2) { | 2094 FPURegister src2) { |
2095 int right_block = instr->FalseDestination(chunk_); | 2095 int right_block = instr->FalseDestination(chunk_); |
2096 int left_block = instr->TrueDestination(chunk_); | 2096 int left_block = instr->TrueDestination(chunk_); |
2097 | 2097 |
2098 int next_block = GetNextEmittedBlock(); | 2098 int next_block = GetNextEmittedBlock(); |
2099 if (right_block == left_block) { | 2099 if (right_block == left_block) { |
2100 EmitGoto(left_block); | 2100 EmitGoto(left_block); |
2101 } else if (left_block == next_block) { | 2101 } else if (left_block == next_block) { |
2102 __ BranchF(chunk_->GetAssemblyLabel(right_block), NULL, | 2102 __ BranchF(chunk_->GetAssemblyLabel(right_block), NULL, |
2103 NegateCondition(condition), src1, src2); | 2103 NegateFpuCondition(condition), src1, src2); |
2104 } else if (right_block == next_block) { | 2104 } else if (right_block == next_block) { |
2105 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, | 2105 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, |
2106 condition, src1, src2); | 2106 condition, src1, src2); |
2107 } else { | 2107 } else { |
2108 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, | 2108 __ BranchF(chunk_->GetAssemblyLabel(left_block), NULL, |
2109 condition, src1, src2); | 2109 condition, src1, src2); |
2110 __ Branch(chunk_->GetAssemblyLabel(right_block)); | 2110 __ Branch(chunk_->GetAssemblyLabel(right_block)); |
2111 } | 2111 } |
2112 } | 2112 } |
2113 | 2113 |
(...skipping 27 matching lines...) Expand all Loading... |
2141 void LCodeGen::DoBranch(LBranch* instr) { | 2141 void LCodeGen::DoBranch(LBranch* instr) { |
2142 Representation r = instr->hydrogen()->value()->representation(); | 2142 Representation r = instr->hydrogen()->value()->representation(); |
2143 if (r.IsInteger32() || r.IsSmi()) { | 2143 if (r.IsInteger32() || r.IsSmi()) { |
2144 DCHECK(!info()->IsStub()); | 2144 DCHECK(!info()->IsStub()); |
2145 Register reg = ToRegister(instr->value()); | 2145 Register reg = ToRegister(instr->value()); |
2146 EmitBranch(instr, ne, reg, Operand(zero_reg)); | 2146 EmitBranch(instr, ne, reg, Operand(zero_reg)); |
2147 } else if (r.IsDouble()) { | 2147 } else if (r.IsDouble()) { |
2148 DCHECK(!info()->IsStub()); | 2148 DCHECK(!info()->IsStub()); |
2149 DoubleRegister reg = ToDoubleRegister(instr->value()); | 2149 DoubleRegister reg = ToDoubleRegister(instr->value()); |
2150 // Test the double value. Zero and NaN are false. | 2150 // Test the double value. Zero and NaN are false. |
2151 EmitBranchF(instr, nue, reg, kDoubleRegZero); | 2151 EmitBranchF(instr, ogl, reg, kDoubleRegZero); |
2152 } else { | 2152 } else { |
2153 DCHECK(r.IsTagged()); | 2153 DCHECK(r.IsTagged()); |
2154 Register reg = ToRegister(instr->value()); | 2154 Register reg = ToRegister(instr->value()); |
2155 HType type = instr->hydrogen()->value()->type(); | 2155 HType type = instr->hydrogen()->value()->type(); |
2156 if (type.IsBoolean()) { | 2156 if (type.IsBoolean()) { |
2157 DCHECK(!info()->IsStub()); | 2157 DCHECK(!info()->IsStub()); |
2158 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 2158 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
2159 EmitBranch(instr, eq, reg, Operand(at)); | 2159 EmitBranch(instr, eq, reg, Operand(at)); |
2160 } else if (type.IsSmi()) { | 2160 } else if (type.IsSmi()) { |
2161 DCHECK(!info()->IsStub()); | 2161 DCHECK(!info()->IsStub()); |
2162 EmitBranch(instr, ne, reg, Operand(zero_reg)); | 2162 EmitBranch(instr, ne, reg, Operand(zero_reg)); |
2163 } else if (type.IsJSArray()) { | 2163 } else if (type.IsJSArray()) { |
2164 DCHECK(!info()->IsStub()); | 2164 DCHECK(!info()->IsStub()); |
2165 EmitBranch(instr, al, zero_reg, Operand(zero_reg)); | 2165 EmitBranch(instr, al, zero_reg, Operand(zero_reg)); |
2166 } else if (type.IsHeapNumber()) { | 2166 } else if (type.IsHeapNumber()) { |
2167 DCHECK(!info()->IsStub()); | 2167 DCHECK(!info()->IsStub()); |
2168 DoubleRegister dbl_scratch = double_scratch0(); | 2168 DoubleRegister dbl_scratch = double_scratch0(); |
2169 __ ldc1(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); | 2169 __ ldc1(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); |
2170 // Test the double value. Zero and NaN are false. | 2170 // Test the double value. Zero and NaN are false. |
2171 EmitBranchF(instr, nue, dbl_scratch, kDoubleRegZero); | 2171 EmitBranchF(instr, ogl, dbl_scratch, kDoubleRegZero); |
2172 } else if (type.IsString()) { | 2172 } else if (type.IsString()) { |
2173 DCHECK(!info()->IsStub()); | 2173 DCHECK(!info()->IsStub()); |
2174 __ ld(at, FieldMemOperand(reg, String::kLengthOffset)); | 2174 __ ld(at, FieldMemOperand(reg, String::kLengthOffset)); |
2175 EmitBranch(instr, ne, at, Operand(zero_reg)); | 2175 EmitBranch(instr, ne, at, Operand(zero_reg)); |
2176 } else { | 2176 } else { |
2177 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 2177 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
2178 // Avoid deopts in the case where we've never executed this path before. | 2178 // Avoid deopts in the case where we've never executed this path before. |
2179 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); | 2179 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); |
2180 | 2180 |
2181 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 2181 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
(...skipping 3872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6054 __ li(at, scope_info); | 6054 __ li(at, scope_info); |
6055 __ Push(at, ToRegister(instr->function())); | 6055 __ Push(at, ToRegister(instr->function())); |
6056 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6056 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6057 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6057 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6058 } | 6058 } |
6059 | 6059 |
6060 | 6060 |
6061 #undef __ | 6061 #undef __ |
6062 | 6062 |
6063 } } // namespace v8::internal | 6063 } } // namespace v8::internal |
OLD | NEW |