Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6142004: ARM: Fix comparison of NaN values.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1069 int true_block = chunk_->LookupDestination(instr->true_block_id());
1070 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1070 int false_block = chunk_->LookupDestination(instr->false_block_id());
1071 1071
1072 Representation r = instr->hydrogen()->representation(); 1072 Representation r = instr->hydrogen()->representation();
1073 if (r.IsInteger32()) { 1073 if (r.IsInteger32()) {
1074 Register reg = ToRegister(instr->input()); 1074 Register reg = ToRegister(instr->input());
1075 __ cmp(reg, Operand(0)); 1075 __ cmp(reg, Operand(0));
1076 EmitBranch(true_block, false_block, nz); 1076 EmitBranch(true_block, false_block, nz);
1077 } else if (r.IsDouble()) { 1077 } else if (r.IsDouble()) {
1078 DoubleRegister reg = ToDoubleRegister(instr->input()); 1078 DoubleRegister reg = ToDoubleRegister(instr->input());
1079 Register scratch = scratch0();
1080
1081 // Test for the double value. Zero and NaN are false.
1082 // Clear the Invalid cumulative exception flags.
1083 __ ClearFPSCRBits(kVFPInvalidExceptionBit, scratch);
1079 __ vcmp(reg, 0.0); 1084 __ vcmp(reg, 0.0);
1080 __ vmrs(pc); // Move vector status bits to normal status bits. 1085 // Retrieve the exception and status flags and
1086 // check for zero or an invalid exception.
1087 __ vmrs(scratch);
1088 __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPInvalidExceptionBit));
1081 EmitBranch(true_block, false_block, ne); 1089 EmitBranch(true_block, false_block, ne);
1082 } else { 1090 } else {
1083 ASSERT(r.IsTagged()); 1091 ASSERT(r.IsTagged());
1084 Register reg = ToRegister(instr->input()); 1092 Register reg = ToRegister(instr->input());
1085 if (instr->hydrogen()->type().IsBoolean()) { 1093 if (instr->hydrogen()->type().IsBoolean()) {
1086 __ LoadRoot(ip, Heap::kTrueValueRootIndex); 1094 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1087 __ cmp(reg, ip); 1095 __ cmp(reg, ip);
1088 EmitBranch(true_block, false_block, eq); 1096 EmitBranch(true_block, false_block, eq);
1089 } else { 1097 } else {
1090 Label* true_label = chunk_->GetAssemblyLabel(true_block); 1098 Label* true_label = chunk_->GetAssemblyLabel(true_block);
1091 Label* false_label = chunk_->GetAssemblyLabel(false_block); 1099 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1092 1100
1093 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 1101 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1094 __ cmp(reg, ip); 1102 __ cmp(reg, ip);
1095 __ b(eq, false_label); 1103 __ b(eq, false_label);
1096 __ LoadRoot(ip, Heap::kTrueValueRootIndex); 1104 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
1097 __ cmp(reg, ip); 1105 __ cmp(reg, ip);
1098 __ b(eq, true_label); 1106 __ b(eq, true_label);
1099 __ LoadRoot(ip, Heap::kFalseValueRootIndex); 1107 __ LoadRoot(ip, Heap::kFalseValueRootIndex);
1100 __ cmp(reg, ip); 1108 __ cmp(reg, ip);
1101 __ b(eq, false_label); 1109 __ b(eq, false_label);
1102 __ cmp(reg, Operand(0)); 1110 __ cmp(reg, Operand(0));
1103 __ b(eq, false_label); 1111 __ b(eq, false_label);
1104 __ tst(reg, Operand(kSmiTagMask)); 1112 __ tst(reg, Operand(kSmiTagMask));
1105 __ b(eq, true_label); 1113 __ b(eq, true_label);
1106 1114
1107 // Test for double values. Zero is false. 1115 // Test for double values. Zero and NaN are false.
1108 Label call_stub; 1116 Label call_stub;
1109 DoubleRegister dbl_scratch = d0; 1117 DoubleRegister dbl_scratch = d0;
1110 Register scratch = scratch0(); 1118 Register scratch = scratch0();
1111 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); 1119 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
1112 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); 1120 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
1113 __ cmp(scratch, Operand(ip)); 1121 __ cmp(scratch, Operand(ip));
1114 __ b(ne, &call_stub); 1122 __ b(ne, &call_stub);
1115 __ sub(ip, reg, Operand(kHeapObjectTag)); 1123 __ sub(ip, reg, Operand(kHeapObjectTag));
1116 __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset); 1124 __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset);
1125 // Clear the Invalid cumulative exception flags.
1126 __ ClearFPSCRBits(kVFPInvalidExceptionBit, scratch);
1117 __ vcmp(dbl_scratch, 0.0); 1127 __ vcmp(dbl_scratch, 0.0);
1118 __ vmrs(pc); // Move vector status bits to normal status bits. 1128 // Retrieve the exception and status flags and
1119 __ b(eq, false_label); 1129 // check for zero or an invalid exception.
1130 __ vmrs(scratch);
1131 __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPInvalidExceptionBit));
1132 __ b(ne, false_label);
1120 __ b(true_label); 1133 __ b(true_label);
1121 1134
1122 // The conversion stub doesn't cause garbage collections so it's 1135 // The conversion stub doesn't cause garbage collections so it's
1123 // safe to not record a safepoint after the call. 1136 // safe to not record a safepoint after the call.
1124 __ bind(&call_stub); 1137 __ bind(&call_stub);
1125 ToBooleanStub stub(reg); 1138 ToBooleanStub stub(reg);
1126 RegList saved_regs = kJSCallerSaved | kCalleeSaved; 1139 RegList saved_regs = kJSCallerSaved | kCalleeSaved;
1127 __ stm(db_w, sp, saved_regs); 1140 __ stm(db_w, sp, saved_regs);
1128 __ CallStub(&stub); 1141 __ CallStub(&stub);
1129 __ cmp(reg, Operand(0)); 1142 __ cmp(reg, Operand(0));
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 2636
2624 2637
2625 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2638 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2626 Abort("DoOsrEntry unimplemented."); 2639 Abort("DoOsrEntry unimplemented.");
2627 } 2640 }
2628 2641
2629 2642
2630 #undef __ 2643 #undef __
2631 2644
2632 } } // namespace v8::internal 2645 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698