| 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 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 Register reg = ToRegister(instr->value()); | 2127 Register reg = ToRegister(instr->value()); |
| 2128 HType type = instr->hydrogen()->value()->type(); | 2128 HType type = instr->hydrogen()->value()->type(); |
| 2129 if (type.IsBoolean()) { | 2129 if (type.IsBoolean()) { |
| 2130 ASSERT(!info()->IsStub()); | 2130 ASSERT(!info()->IsStub()); |
| 2131 __ cmp(reg, factory()->true_value()); | 2131 __ cmp(reg, factory()->true_value()); |
| 2132 EmitBranch(true_block, false_block, equal); | 2132 EmitBranch(true_block, false_block, equal); |
| 2133 } else if (type.IsSmi()) { | 2133 } else if (type.IsSmi()) { |
| 2134 ASSERT(!info()->IsStub()); | 2134 ASSERT(!info()->IsStub()); |
| 2135 __ test(reg, Operand(reg)); | 2135 __ test(reg, Operand(reg)); |
| 2136 EmitBranch(true_block, false_block, not_equal); | 2136 EmitBranch(true_block, false_block, not_equal); |
| 2137 } else if (type.IsJSArray()) { |
| 2138 ASSERT(!info()->IsStub()); |
| 2139 EmitBranch(true_block, false_block, no_condition); |
| 2140 } else if (type.IsHeapNumber()) { |
| 2141 ASSERT(!info()->IsStub()); |
| 2142 CpuFeatureScope scope(masm(), SSE2); |
| 2143 __ xorps(xmm0, xmm0); |
| 2144 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2145 EmitBranch(true_block, false_block, not_equal); |
| 2146 } else if (type.IsString()) { |
| 2147 ASSERT(!info()->IsStub()); |
| 2148 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); |
| 2149 EmitBranch(true_block, false_block, not_equal); |
| 2137 } else { | 2150 } else { |
| 2138 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 2151 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 2139 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 2152 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 2140 | 2153 |
| 2141 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 2154 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
| 2142 // Avoid deopts in the case where we've never executed this path before. | 2155 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); |
| 2143 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | |
| 2144 | 2156 |
| 2145 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 2157 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
| 2146 // undefined -> false. | 2158 // undefined -> false. |
| 2147 __ cmp(reg, factory()->undefined_value()); | 2159 __ cmp(reg, factory()->undefined_value()); |
| 2148 __ j(equal, false_label); | 2160 __ j(equal, false_label); |
| 2149 } | 2161 } |
| 2150 if (expected.Contains(ToBooleanStub::BOOLEAN)) { | 2162 if (expected.Contains(ToBooleanStub::BOOLEAN)) { |
| 2151 // true -> true. | 2163 // true -> true. |
| 2152 __ cmp(reg, factory()->true_value()); | 2164 __ cmp(reg, factory()->true_value()); |
| 2153 __ j(equal, true_label); | 2165 __ j(equal, true_label); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 } else { | 2234 } else { |
| 2223 __ fldz(); | 2235 __ fldz(); |
| 2224 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 2236 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2225 __ FCmp(); | 2237 __ FCmp(); |
| 2226 } | 2238 } |
| 2227 __ j(zero, false_label); | 2239 __ j(zero, false_label); |
| 2228 __ jmp(true_label); | 2240 __ jmp(true_label); |
| 2229 __ bind(¬_heap_number); | 2241 __ bind(¬_heap_number); |
| 2230 } | 2242 } |
| 2231 | 2243 |
| 2232 // We've seen something for the first time -> deopt. | 2244 if (!expected.IsGeneric()) { |
| 2233 DeoptimizeIf(no_condition, instr->environment()); | 2245 // We've seen something for the first time -> deopt. |
| 2246 // This can only happen if we are not generic already. |
| 2247 DeoptimizeIf(no_condition, instr->environment()); |
| 2248 } |
| 2234 } | 2249 } |
| 2235 } | 2250 } |
| 2236 } | 2251 } |
| 2237 | 2252 |
| 2238 | 2253 |
| 2239 void LCodeGen::EmitGoto(int block) { | 2254 void LCodeGen::EmitGoto(int block) { |
| 2240 if (!IsNextEmittedBlock(block)) { | 2255 if (!IsNextEmittedBlock(block)) { |
| 2241 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); | 2256 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); |
| 2242 } | 2257 } |
| 2243 } | 2258 } |
| (...skipping 4260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6504 FixedArray::kHeaderSize - kPointerSize)); | 6519 FixedArray::kHeaderSize - kPointerSize)); |
| 6505 __ bind(&done); | 6520 __ bind(&done); |
| 6506 } | 6521 } |
| 6507 | 6522 |
| 6508 | 6523 |
| 6509 #undef __ | 6524 #undef __ |
| 6510 | 6525 |
| 6511 } } // namespace v8::internal | 6526 } } // namespace v8::internal |
| 6512 | 6527 |
| 6513 #endif // V8_TARGET_ARCH_IA32 | 6528 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |