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 4066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4077 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); | 4077 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); |
4078 } | 4078 } |
4079 | 4079 |
4080 | 4080 |
4081 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4081 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4082 class DeferredNumberTagI: public LDeferredCode { | 4082 class DeferredNumberTagI: public LDeferredCode { |
4083 public: | 4083 public: |
4084 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4084 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4085 : LDeferredCode(codegen), instr_(instr) { } | 4085 : LDeferredCode(codegen), instr_(instr) { } |
4086 virtual void Generate() { | 4086 virtual void Generate() { |
4087 codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32); | 4087 codegen()->DoDeferredNumberTagI(instr_, |
| 4088 instr_->InputAt(0), |
| 4089 SIGNED_INT32); |
4088 } | 4090 } |
4089 virtual LInstruction* instr() { return instr_; } | 4091 virtual LInstruction* instr() { return instr_; } |
4090 private: | 4092 private: |
4091 LNumberTagI* instr_; | 4093 LNumberTagI* instr_; |
4092 }; | 4094 }; |
4093 | 4095 |
4094 Register src = ToRegister(instr->InputAt(0)); | 4096 Register src = ToRegister(instr->InputAt(0)); |
4095 Register dst = ToRegister(instr->result()); | 4097 Register dst = ToRegister(instr->result()); |
4096 Register overflow = scratch0(); | 4098 Register overflow = scratch0(); |
4097 | 4099 |
4098 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4100 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4099 __ SmiTagCheckOverflow(dst, src, overflow); | 4101 __ SmiTagCheckOverflow(dst, src, overflow); |
4100 __ BranchOnOverflow(deferred->entry(), overflow); | 4102 __ BranchOnOverflow(deferred->entry(), overflow); |
4101 __ bind(deferred->exit()); | 4103 __ bind(deferred->exit()); |
4102 } | 4104 } |
4103 | 4105 |
4104 | 4106 |
4105 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4107 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4106 class DeferredNumberTagU: public LDeferredCode { | 4108 class DeferredNumberTagU: public LDeferredCode { |
4107 public: | 4109 public: |
4108 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4110 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4109 : LDeferredCode(codegen), instr_(instr) { } | 4111 : LDeferredCode(codegen), instr_(instr) { } |
4110 virtual void Generate() { | 4112 virtual void Generate() { |
4111 codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32); | 4113 codegen()->DoDeferredNumberTagI(instr_, |
| 4114 instr_->InputAt(0), |
| 4115 UNSIGNED_INT32); |
4112 } | 4116 } |
4113 virtual LInstruction* instr() { return instr_; } | 4117 virtual LInstruction* instr() { return instr_; } |
4114 private: | 4118 private: |
4115 LNumberTagU* instr_; | 4119 LNumberTagU* instr_; |
4116 }; | 4120 }; |
4117 | 4121 |
4118 LOperand* input = instr->InputAt(0); | 4122 LOperand* input = instr->InputAt(0); |
4119 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4123 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4120 Register reg = ToRegister(input); | 4124 Register reg = ToRegister(input); |
4121 | 4125 |
4122 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4126 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4123 __ Branch(deferred->entry(), hi, reg, Operand(Smi::kMaxValue)); | 4127 __ Branch(deferred->entry(), hi, reg, Operand(Smi::kMaxValue)); |
4124 __ SmiTag(reg, reg); | 4128 __ SmiTag(reg, reg); |
4125 __ bind(deferred->exit()); | 4129 __ bind(deferred->exit()); |
4126 } | 4130 } |
4127 | 4131 |
4128 | 4132 |
4129 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, | 4133 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
| 4134 LOperand* value, |
4130 IntegerSignedness signedness) { | 4135 IntegerSignedness signedness) { |
4131 Label slow; | 4136 Label slow; |
4132 Register src = ToRegister(instr->InputAt(0)); | 4137 Register src = ToRegister(value); |
4133 Register dst = ToRegister(instr->result()); | 4138 Register dst = ToRegister(instr->result()); |
4134 FPURegister dbl_scratch = double_scratch0(); | 4139 FPURegister dbl_scratch = double_scratch0(); |
4135 | 4140 |
4136 // Preserve the value of all registers. | 4141 // Preserve the value of all registers. |
4137 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 4142 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
4138 | 4143 |
4139 Label done; | 4144 Label done; |
4140 if (signedness == SIGNED_INT32) { | 4145 if (signedness == SIGNED_INT32) { |
4141 // There was overflow, so bits 30 and 31 of the original integer | 4146 // There was overflow, so bits 30 and 31 of the original integer |
4142 // disagree. Try to allocate a heap number in new space and store | 4147 // disagree. Try to allocate a heap number in new space and store |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5395 __ Subu(scratch, result, scratch); | 5400 __ Subu(scratch, result, scratch); |
5396 __ lw(result, FieldMemOperand(scratch, | 5401 __ lw(result, FieldMemOperand(scratch, |
5397 FixedArray::kHeaderSize - kPointerSize)); | 5402 FixedArray::kHeaderSize - kPointerSize)); |
5398 __ bind(&done); | 5403 __ bind(&done); |
5399 } | 5404 } |
5400 | 5405 |
5401 | 5406 |
5402 #undef __ | 5407 #undef __ |
5403 | 5408 |
5404 } } // namespace v8::internal | 5409 } } // namespace v8::internal |
OLD | NEW |