Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. | |
|
Søren Thygesen Gjesse
2011/01/07 11:44:32
I will suggest a macro assembler instruction for t
Alexandre
2011/01/07 18:34:49
Added the ClearFPSCRBits Masm instruction.
On 2011
| |
| 1083 __ vmrs(scratch); | |
| 1084 __ bic(scratch, scratch, Operand(kVFPInvalidExceptionBit)); | |
| 1085 __ vmsr(scratch); | |
| 1079 __ vcmp(reg, 0.0); | 1086 __ vcmp(reg, 0.0); |
| 1080 __ vmrs(pc); // Move vector status bits to normal status bits. | 1087 __ vmrs(scratch); // Retrieve the exception and status flags. |
| 1088 // Check for zero or an invalid exception. | |
| 1089 __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPInvalidExceptionBit)); | |
| 1081 EmitBranch(true_block, false_block, ne); | 1090 EmitBranch(true_block, false_block, ne); |
| 1082 } else { | 1091 } else { |
| 1083 ASSERT(r.IsTagged()); | 1092 ASSERT(r.IsTagged()); |
| 1084 Register reg = ToRegister(instr->input()); | 1093 Register reg = ToRegister(instr->input()); |
| 1085 if (instr->hydrogen()->type().IsBoolean()) { | 1094 if (instr->hydrogen()->type().IsBoolean()) { |
| 1086 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 1095 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
| 1087 __ cmp(reg, ip); | 1096 __ cmp(reg, ip); |
| 1088 EmitBranch(true_block, false_block, eq); | 1097 EmitBranch(true_block, false_block, eq); |
| 1089 } else { | 1098 } else { |
| 1090 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1099 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1091 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1100 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1092 | 1101 |
| 1093 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 1102 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 1094 __ cmp(reg, ip); | 1103 __ cmp(reg, ip); |
| 1095 __ b(eq, false_label); | 1104 __ b(eq, false_label); |
| 1096 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 1105 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
| 1097 __ cmp(reg, ip); | 1106 __ cmp(reg, ip); |
| 1098 __ b(eq, true_label); | 1107 __ b(eq, true_label); |
| 1099 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 1108 __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
| 1100 __ cmp(reg, ip); | 1109 __ cmp(reg, ip); |
| 1101 __ b(eq, false_label); | 1110 __ b(eq, false_label); |
| 1102 __ cmp(reg, Operand(0)); | 1111 __ cmp(reg, Operand(0)); |
| 1103 __ b(eq, false_label); | 1112 __ b(eq, false_label); |
| 1104 __ tst(reg, Operand(kSmiTagMask)); | 1113 __ tst(reg, Operand(kSmiTagMask)); |
| 1105 __ b(eq, true_label); | 1114 __ b(eq, true_label); |
| 1106 | 1115 |
| 1107 // Test for double values. Zero is false. | 1116 // Test for double values. Zero and NaN are false. |
| 1108 Label call_stub; | 1117 Label call_stub; |
| 1109 DoubleRegister dbl_scratch = d0; | 1118 DoubleRegister dbl_scratch = d0; |
| 1110 Register scratch = scratch0(); | 1119 Register scratch = scratch0(); |
| 1111 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 1120 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 1112 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 1121 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 1113 __ cmp(scratch, Operand(ip)); | 1122 __ cmp(scratch, Operand(ip)); |
| 1114 __ b(ne, &call_stub); | 1123 __ b(ne, &call_stub); |
| 1115 __ sub(ip, reg, Operand(kHeapObjectTag)); | 1124 __ sub(ip, reg, Operand(kHeapObjectTag)); |
| 1116 __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset); | 1125 __ vldr(dbl_scratch, ip, HeapNumber::kValueOffset); |
| 1126 // Clear the Invalid cumulative exception flags. | |
|
Søren Thygesen Gjesse
2011/01/07 11:44:32
Ditto.
Alexandre
2011/01/07 18:34:49
Used the new pseudo instruction.
On 2011/01/07 11:
| |
| 1127 __ vmrs(scratch); | |
| 1128 __ bic(scratch, scratch, Operand(kVFPInvalidExceptionBit)); | |
| 1129 __ vmsr(scratch); | |
| 1117 __ vcmp(dbl_scratch, 0.0); | 1130 __ vcmp(dbl_scratch, 0.0); |
| 1118 __ vmrs(pc); // Move vector status bits to normal status bits. | 1131 __ vmrs(scratch); // Retrieve the exception and status flags. |
| 1119 __ b(eq, false_label); | 1132 // Check for zero or an invalid exception. |
| 1133 __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPInvalidExceptionBit)); | |
| 1134 __ b(ne, false_label); | |
| 1120 __ b(true_label); | 1135 __ b(true_label); |
| 1121 | 1136 |
| 1122 // The conversion stub doesn't cause garbage collections so it's | 1137 // The conversion stub doesn't cause garbage collections so it's |
| 1123 // safe to not record a safepoint after the call. | 1138 // safe to not record a safepoint after the call. |
| 1124 __ bind(&call_stub); | 1139 __ bind(&call_stub); |
| 1125 ToBooleanStub stub(reg); | 1140 ToBooleanStub stub(reg); |
| 1126 RegList saved_regs = kJSCallerSaved | kCalleeSaved; | 1141 RegList saved_regs = kJSCallerSaved | kCalleeSaved; |
| 1127 __ stm(db_w, sp, saved_regs); | 1142 __ stm(db_w, sp, saved_regs); |
| 1128 __ CallStub(&stub); | 1143 __ CallStub(&stub); |
| 1129 __ cmp(reg, Operand(0)); | 1144 __ cmp(reg, Operand(0)); |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2591 | 2606 |
| 2592 | 2607 |
| 2593 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2608 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 2594 Abort("DoOsrEntry unimplemented."); | 2609 Abort("DoOsrEntry unimplemented."); |
| 2595 } | 2610 } |
| 2596 | 2611 |
| 2597 | 2612 |
| 2598 #undef __ | 2613 #undef __ |
| 2599 | 2614 |
| 2600 } } // namespace v8::internal | 2615 } } // namespace v8::internal |
| OLD | NEW |