| 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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 Register reg = ToRegister(instr->value()); | 2126 Register reg = ToRegister(instr->value()); |
| 2127 HType type = instr->hydrogen()->value()->type(); | 2127 HType type = instr->hydrogen()->value()->type(); |
| 2128 if (type.IsBoolean()) { | 2128 if (type.IsBoolean()) { |
| 2129 ASSERT(!info()->IsStub()); | 2129 ASSERT(!info()->IsStub()); |
| 2130 __ cmp(reg, factory()->true_value()); | 2130 __ cmp(reg, factory()->true_value()); |
| 2131 EmitBranch(instr, equal); | 2131 EmitBranch(instr, equal); |
| 2132 } else if (type.IsSmi()) { | 2132 } else if (type.IsSmi()) { |
| 2133 ASSERT(!info()->IsStub()); | 2133 ASSERT(!info()->IsStub()); |
| 2134 __ test(reg, Operand(reg)); | 2134 __ test(reg, Operand(reg)); |
| 2135 EmitBranch(instr, not_equal); | 2135 EmitBranch(instr, not_equal); |
| 2136 } else if (type.IsJSArray()) { |
| 2137 ASSERT(!info()->IsStub()); |
| 2138 EmitBranch(instr, no_condition); |
| 2139 } else if (type.IsHeapNumber()) { |
| 2140 ASSERT(!info()->IsStub()); |
| 2141 CpuFeatureScope scope(masm(), SSE2); |
| 2142 __ xorps(xmm0, xmm0); |
| 2143 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2144 EmitBranch(instr, not_equal); |
| 2145 } else if (type.IsString()) { |
| 2146 ASSERT(!info()->IsStub()); |
| 2147 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); |
| 2148 EmitBranch(instr, not_equal); |
| 2136 } else { | 2149 } else { |
| 2137 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 2150 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
| 2138 // Avoid deopts in the case where we've never executed this path before. | 2151 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); |
| 2139 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | |
| 2140 | 2152 |
| 2141 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 2153 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
| 2142 // undefined -> false. | 2154 // undefined -> false. |
| 2143 __ cmp(reg, factory()->undefined_value()); | 2155 __ cmp(reg, factory()->undefined_value()); |
| 2144 __ j(equal, instr->FalseLabel(chunk_)); | 2156 __ j(equal, instr->FalseLabel(chunk_)); |
| 2145 } | 2157 } |
| 2146 if (expected.Contains(ToBooleanStub::BOOLEAN)) { | 2158 if (expected.Contains(ToBooleanStub::BOOLEAN)) { |
| 2147 // true -> true. | 2159 // true -> true. |
| 2148 __ cmp(reg, factory()->true_value()); | 2160 __ cmp(reg, factory()->true_value()); |
| 2149 __ j(equal, instr->TrueLabel(chunk_)); | 2161 __ j(equal, instr->TrueLabel(chunk_)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 } else { | 2230 } else { |
| 2219 __ fldz(); | 2231 __ fldz(); |
| 2220 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 2232 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2221 __ FCmp(); | 2233 __ FCmp(); |
| 2222 } | 2234 } |
| 2223 __ j(zero, instr->FalseLabel(chunk_)); | 2235 __ j(zero, instr->FalseLabel(chunk_)); |
| 2224 __ jmp(instr->TrueLabel(chunk_)); | 2236 __ jmp(instr->TrueLabel(chunk_)); |
| 2225 __ bind(¬_heap_number); | 2237 __ bind(¬_heap_number); |
| 2226 } | 2238 } |
| 2227 | 2239 |
| 2228 // We've seen something for the first time -> deopt. | 2240 if (!expected.IsGeneric()) { |
| 2229 DeoptimizeIf(no_condition, instr->environment()); | 2241 // We've seen something for the first time -> deopt. |
| 2242 // This can only happen if we are not generic already. |
| 2243 DeoptimizeIf(no_condition, instr->environment()); |
| 2244 } |
| 2230 } | 2245 } |
| 2231 } | 2246 } |
| 2232 } | 2247 } |
| 2233 | 2248 |
| 2234 | 2249 |
| 2235 void LCodeGen::EmitGoto(int block) { | 2250 void LCodeGen::EmitGoto(int block) { |
| 2236 if (!IsNextEmittedBlock(block)) { | 2251 if (!IsNextEmittedBlock(block)) { |
| 2237 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); | 2252 __ jmp(chunk_->GetAssemblyLabel(LookupDestination(block))); |
| 2238 } | 2253 } |
| 2239 } | 2254 } |
| (...skipping 4305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6545 FixedArray::kHeaderSize - kPointerSize)); | 6560 FixedArray::kHeaderSize - kPointerSize)); |
| 6546 __ bind(&done); | 6561 __ bind(&done); |
| 6547 } | 6562 } |
| 6548 | 6563 |
| 6549 | 6564 |
| 6550 #undef __ | 6565 #undef __ |
| 6551 | 6566 |
| 6552 } } // namespace v8::internal | 6567 } } // namespace v8::internal |
| 6553 | 6568 |
| 6554 #endif // V8_TARGET_ARCH_IA32 | 6569 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |