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 EmitBranch(true_block, false_block, no_condition); | |
2139 } else if (type.IsHeapNumber()) { | |
Toon Verwaest
2013/06/18 17:01:52
ASSERT(!info()->IsStub());
XMM is not available fo
| |
2140 CpuFeatureScope scope(masm(), SSE2); | |
2141 __ xorps(xmm0, xmm0); | |
2142 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); | |
2143 EmitBranch(true_block, false_block, not_equal); | |
2144 } else if (type.IsString()) { | |
2145 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); | |
2146 EmitBranch(true_block, false_block, not_equal); | |
2137 } else { | 2147 } else { |
2138 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 2148 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
2139 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 2149 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
2140 | 2150 |
2141 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); | 2151 ToBooleanStub::Types expected = instr->hydrogen()->expected_input_types(); |
2142 // Avoid deopts in the case where we've never executed this path before. | 2152 // Avoid deopts in the case where we've never executed this path before. |
2143 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); | 2153 if (expected.IsEmpty()) expected = ToBooleanStub::all_types(); |
2144 | 2154 |
2145 if (expected.Contains(ToBooleanStub::UNDEFINED)) { | 2155 if (expected.Contains(ToBooleanStub::UNDEFINED)) { |
2146 // undefined -> false. | 2156 // undefined -> false. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2222 } else { | 2232 } else { |
2223 __ fldz(); | 2233 __ fldz(); |
2224 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 2234 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
2225 __ FCmp(); | 2235 __ FCmp(); |
2226 } | 2236 } |
2227 __ j(zero, false_label); | 2237 __ j(zero, false_label); |
2228 __ jmp(true_label); | 2238 __ jmp(true_label); |
2229 __ bind(¬_heap_number); | 2239 __ bind(¬_heap_number); |
2230 } | 2240 } |
2231 | 2241 |
2232 // We've seen something for the first time -> deopt. | 2242 if (expected != ToBooleanStub::all_types()) { |
2233 DeoptimizeIf(no_condition, instr->environment()); | 2243 // We've seen something for the first time -> deopt. |
2244 DeoptimizeIf(no_condition, instr->environment()); | |
2245 } | |
2234 } | 2246 } |
2235 } | 2247 } |
2236 } | 2248 } |
2237 | 2249 |
2238 | 2250 |
2239 void LCodeGen::EmitGoto(int block) { | 2251 void LCodeGen::EmitGoto(int block) { |
2240 if (!IsNextEmittedBlock(block)) { | 2252 if (!IsNextEmittedBlock(block)) { |
2241 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); | 2253 __ jmp(chunk_->GetAssemblyLabel(chunk_->LookupDestination(block))); |
2242 } | 2254 } |
2243 } | 2255 } |
(...skipping 4260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6504 FixedArray::kHeaderSize - kPointerSize)); | 6516 FixedArray::kHeaderSize - kPointerSize)); |
6505 __ bind(&done); | 6517 __ bind(&done); |
6506 } | 6518 } |
6507 | 6519 |
6508 | 6520 |
6509 #undef __ | 6521 #undef __ |
6510 | 6522 |
6511 } } // namespace v8::internal | 6523 } } // namespace v8::internal |
6512 | 6524 |
6513 #endif // V8_TARGET_ARCH_IA32 | 6525 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |