OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 if (type.IsBoolean()) { | 970 if (type.IsBoolean()) { |
971 __ Cmp(reg, Factory::true_value()); | 971 __ Cmp(reg, Factory::true_value()); |
972 EmitBranch(true_block, false_block, equal); | 972 EmitBranch(true_block, false_block, equal); |
973 } else if (type.IsSmi()) { | 973 } else if (type.IsSmi()) { |
974 __ SmiCompare(reg, Smi::FromInt(0)); | 974 __ SmiCompare(reg, Smi::FromInt(0)); |
975 EmitBranch(true_block, false_block, not_equal); | 975 EmitBranch(true_block, false_block, not_equal); |
976 } else { | 976 } else { |
977 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 977 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
978 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 978 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
979 | 979 |
980 __ Cmp(reg, Factory::undefined_value()); | 980 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
981 __ j(equal, false_label); | 981 __ j(equal, false_label); |
982 __ Cmp(reg, Factory::true_value()); | 982 __ CompareRoot(reg, Heap::kTrueValueRootIndex); |
983 __ j(equal, true_label); | 983 __ j(equal, true_label); |
984 __ Cmp(reg, Factory::false_value()); | 984 __ CompareRoot(reg, Heap::kFalseValueRootIndex); |
985 __ j(equal, false_label); | 985 __ j(equal, false_label); |
986 __ SmiCompare(reg, Smi::FromInt(0)); | 986 __ SmiCompare(reg, Smi::FromInt(0)); |
987 __ j(equal, false_label); | 987 __ j(equal, false_label); |
988 __ JumpIfSmi(reg, true_label); | 988 __ JumpIfSmi(reg, true_label); |
989 | 989 |
990 // Test for double values. Plus/minus zero are false. NaN is handled | 990 // Test for double values. Plus/minus zero and NaN are false. |
991 // in the stub. | |
992 NearLabel call_stub; | 991 NearLabel call_stub; |
993 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 992 __ CompareRoot(FieldOperand(reg, HeapObject::kMapOffset), |
994 Factory::heap_number_map()); | 993 Heap::kHeapNumberMapRootIndex); |
995 __ j(not_equal, &call_stub); | 994 __ j(not_equal, &call_stub); |
996 __ movq(kScratchRegister, FieldOperand(reg, HeapNumber::kValueOffset)); | 995 |
997 __ shl(kScratchRegister, Immediate(1)); // Shift out the sign bit. | 996 // HeapNumber => false iff +0, -0, or NaN. These three cases set the |
998 __ j(zero, false_label); // Zero or negative zero. | 997 // zero flag when compared to zero using ucomisd. |
| 998 __ xorpd(xmm0, xmm0); |
| 999 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 1000 __ j(zero, false_label); |
999 __ jmp(true_label); | 1001 __ jmp(true_label); |
1000 | 1002 |
1001 // The conversion stub doesn't cause garbage collections so it's | 1003 // The conversion stub doesn't cause garbage collections so it's |
1002 // safe to not record a safepoint after the call. | 1004 // safe to not record a safepoint after the call. |
1003 __ bind(&call_stub); | 1005 __ bind(&call_stub); |
1004 ToBooleanStub stub; | 1006 ToBooleanStub stub; |
1005 __ Pushad(); | 1007 __ Pushad(); |
1006 __ push(reg); | 1008 __ push(reg); |
1007 __ CallStub(&stub); | 1009 __ CallStub(&stub); |
1008 __ testq(rax, rax); | 1010 __ testq(rax, rax); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 | 1932 |
1931 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 1933 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
1932 Abort("Unimplemented: %s", "DoOsrEntry"); | 1934 Abort("Unimplemented: %s", "DoOsrEntry"); |
1933 } | 1935 } |
1934 | 1936 |
1935 #undef __ | 1937 #undef __ |
1936 | 1938 |
1937 } } // namespace v8::internal | 1939 } } // namespace v8::internal |
1938 | 1940 |
1939 #endif // V8_TARGET_ARCH_X64 | 1941 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |