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 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 } else { | 2117 } else { |
2118 __ j(cc, chunk_->GetAssemblyLabel(left_block)); | 2118 __ j(cc, chunk_->GetAssemblyLabel(left_block)); |
2119 __ jmp(chunk_->GetAssemblyLabel(right_block)); | 2119 __ jmp(chunk_->GetAssemblyLabel(right_block)); |
2120 } | 2120 } |
2121 } | 2121 } |
2122 | 2122 |
2123 | 2123 |
2124 void LCodeGen::DoBranch(LBranch* instr) { | 2124 void LCodeGen::DoBranch(LBranch* instr) { |
2125 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2125 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
2126 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2126 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
2127 CpuFeatureScope scope(masm(), SSE2); | |
2128 | 2127 |
2129 Representation r = instr->hydrogen()->value()->representation(); | 2128 Representation r = instr->hydrogen()->value()->representation(); |
2130 if (r.IsSmiOrInteger32()) { | 2129 if (r.IsSmiOrInteger32()) { |
| 2130 ASSERT(!info()->IsStub()); |
2131 Register reg = ToRegister(instr->value()); | 2131 Register reg = ToRegister(instr->value()); |
2132 __ test(reg, Operand(reg)); | 2132 __ test(reg, Operand(reg)); |
2133 EmitBranch(true_block, false_block, not_zero); | 2133 EmitBranch(true_block, false_block, not_zero); |
2134 } else if (r.IsDouble()) { | 2134 } else if (r.IsDouble()) { |
| 2135 ASSERT(!info()->IsStub()); |
| 2136 CpuFeatureScope scope(masm(), SSE2); |
2135 XMMRegister reg = ToDoubleRegister(instr->value()); | 2137 XMMRegister reg = ToDoubleRegister(instr->value()); |
2136 __ xorps(xmm0, xmm0); | 2138 __ xorps(xmm0, xmm0); |
2137 __ ucomisd(reg, xmm0); | 2139 __ ucomisd(reg, xmm0); |
2138 EmitBranch(true_block, false_block, not_equal); | 2140 EmitBranch(true_block, false_block, not_equal); |
2139 } else { | 2141 } else { |
2140 ASSERT(r.IsTagged()); | 2142 ASSERT(r.IsTagged()); |
2141 Register reg = ToRegister(instr->value()); | 2143 Register reg = ToRegister(instr->value()); |
2142 HType type = instr->hydrogen()->value()->type(); | 2144 HType type = instr->hydrogen()->value()->type(); |
2143 if (type.IsBoolean()) { | 2145 if (type.IsBoolean()) { |
| 2146 ASSERT(!info()->IsStub()); |
2144 __ cmp(reg, factory()->true_value()); | 2147 __ cmp(reg, factory()->true_value()); |
2145 EmitBranch(true_block, false_block, equal); | 2148 EmitBranch(true_block, false_block, equal); |
2146 } else if (type.IsSmi()) { | 2149 } else if (type.IsSmi()) { |
| 2150 ASSERT(!info()->IsStub()); |
2147 __ test(reg, Operand(reg)); | 2151 __ test(reg, Operand(reg)); |
2148 EmitBranch(true_block, false_block, not_equal); | 2152 EmitBranch(true_block, false_block, not_equal); |
2149 } else { | 2153 } else { |
2150 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 2154 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
2151 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 2155 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
2152 | 2156 |
2153 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 2157 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
2154 // Avoid deopts in the case where we've never executed this path before. | 2158 // Avoid deopts in the case where we've never executed this path before. |
2155 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | 2159 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); |
2156 | 2160 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2220 __ CmpInstanceType(map, SYMBOL_TYPE); | 2224 __ CmpInstanceType(map, SYMBOL_TYPE); |
2221 __ j(equal, true_label); | 2225 __ j(equal, true_label); |
2222 } | 2226 } |
2223 | 2227 |
2224 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2228 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
2225 // heap number -> false iff +0, -0, or NaN. | 2229 // heap number -> false iff +0, -0, or NaN. |
2226 Label not_heap_number; | 2230 Label not_heap_number; |
2227 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2231 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
2228 factory()->heap_number_map()); | 2232 factory()->heap_number_map()); |
2229 __ j(not_equal, ¬_heap_number, Label::kNear); | 2233 __ j(not_equal, ¬_heap_number, Label::kNear); |
2230 __ xorps(xmm0, xmm0); | 2234 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
2231 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); | 2235 CpuFeatureScope scope(masm(), SSE2); |
| 2236 __ xorps(xmm0, xmm0); |
| 2237 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2238 } else { |
| 2239 __ fldz(); |
| 2240 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2241 __ FCmp(); |
| 2242 } |
2232 __ j(zero, false_label); | 2243 __ j(zero, false_label); |
2233 __ jmp(true_label); | 2244 __ jmp(true_label); |
2234 __ bind(¬_heap_number); | 2245 __ bind(¬_heap_number); |
2235 } | 2246 } |
2236 | 2247 |
2237 // We've seen something for the first time -> deopt. | 2248 // We've seen something for the first time -> deopt. |
2238 DeoptimizeIf(no_condition, instr->environment()); | 2249 DeoptimizeIf(no_condition, instr->environment()); |
2239 } | 2250 } |
2240 } | 2251 } |
2241 } | 2252 } |
(...skipping 4339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6581 FixedArray::kHeaderSize - kPointerSize)); | 6592 FixedArray::kHeaderSize - kPointerSize)); |
6582 __ bind(&done); | 6593 __ bind(&done); |
6583 } | 6594 } |
6584 | 6595 |
6585 | 6596 |
6586 #undef __ | 6597 #undef __ |
6587 | 6598 |
6588 } } // namespace v8::internal | 6599 } } // namespace v8::internal |
6589 | 6600 |
6590 #endif // V8_TARGET_ARCH_IA32 | 6601 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |