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 4292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); | 4303 __ vcvt_f64_u32(ToDoubleRegister(output), flt_scratch); |
4304 } | 4304 } |
4305 | 4305 |
4306 | 4306 |
4307 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4307 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4308 class DeferredNumberTagI: public LDeferredCode { | 4308 class DeferredNumberTagI: public LDeferredCode { |
4309 public: | 4309 public: |
4310 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4310 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4311 : LDeferredCode(codegen), instr_(instr) { } | 4311 : LDeferredCode(codegen), instr_(instr) { } |
4312 virtual void Generate() { | 4312 virtual void Generate() { |
4313 codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32); | 4313 codegen()->DoDeferredNumberTagI(instr_, |
| 4314 instr_->InputAt(0), |
| 4315 SIGNED_INT32); |
4314 } | 4316 } |
4315 virtual LInstruction* instr() { return instr_; } | 4317 virtual LInstruction* instr() { return instr_; } |
4316 private: | 4318 private: |
4317 LNumberTagI* instr_; | 4319 LNumberTagI* instr_; |
4318 }; | 4320 }; |
4319 | 4321 |
4320 Register src = ToRegister(instr->InputAt(0)); | 4322 Register src = ToRegister(instr->InputAt(0)); |
4321 Register dst = ToRegister(instr->result()); | 4323 Register dst = ToRegister(instr->result()); |
4322 | 4324 |
4323 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); | 4325 DeferredNumberTagI* deferred = new(zone()) DeferredNumberTagI(this, instr); |
4324 __ SmiTag(dst, src, SetCC); | 4326 __ SmiTag(dst, src, SetCC); |
4325 __ b(vs, deferred->entry()); | 4327 __ b(vs, deferred->entry()); |
4326 __ bind(deferred->exit()); | 4328 __ bind(deferred->exit()); |
4327 } | 4329 } |
4328 | 4330 |
4329 | 4331 |
4330 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4332 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4331 class DeferredNumberTagU: public LDeferredCode { | 4333 class DeferredNumberTagU: public LDeferredCode { |
4332 public: | 4334 public: |
4333 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4335 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4334 : LDeferredCode(codegen), instr_(instr) { } | 4336 : LDeferredCode(codegen), instr_(instr) { } |
4335 virtual void Generate() { | 4337 virtual void Generate() { |
4336 codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32); | 4338 codegen()->DoDeferredNumberTagI(instr_, |
| 4339 instr_->InputAt(0), |
| 4340 UNSIGNED_INT32); |
4337 } | 4341 } |
4338 virtual LInstruction* instr() { return instr_; } | 4342 virtual LInstruction* instr() { return instr_; } |
4339 private: | 4343 private: |
4340 LNumberTagU* instr_; | 4344 LNumberTagU* instr_; |
4341 }; | 4345 }; |
4342 | 4346 |
4343 LOperand* input = instr->InputAt(0); | 4347 LOperand* input = instr->InputAt(0); |
4344 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4348 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4345 Register reg = ToRegister(input); | 4349 Register reg = ToRegister(input); |
4346 | 4350 |
4347 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4351 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4348 __ cmp(reg, Operand(Smi::kMaxValue)); | 4352 __ cmp(reg, Operand(Smi::kMaxValue)); |
4349 __ b(hi, deferred->entry()); | 4353 __ b(hi, deferred->entry()); |
4350 __ SmiTag(reg, reg); | 4354 __ SmiTag(reg, reg); |
4351 __ bind(deferred->exit()); | 4355 __ bind(deferred->exit()); |
4352 } | 4356 } |
4353 | 4357 |
4354 | 4358 |
4355 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, | 4359 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, |
| 4360 LOperand* value, |
4356 IntegerSignedness signedness) { | 4361 IntegerSignedness signedness) { |
4357 Label slow; | 4362 Label slow; |
4358 Register src = ToRegister(instr->InputAt(0)); | 4363 Register src = ToRegister(value); |
4359 Register dst = ToRegister(instr->result()); | 4364 Register dst = ToRegister(instr->result()); |
4360 DoubleRegister dbl_scratch = double_scratch0(); | 4365 DoubleRegister dbl_scratch = double_scratch0(); |
4361 SwVfpRegister flt_scratch = dbl_scratch.low(); | 4366 SwVfpRegister flt_scratch = dbl_scratch.low(); |
4362 | 4367 |
4363 // Preserve the value of all registers. | 4368 // Preserve the value of all registers. |
4364 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 4369 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
4365 | 4370 |
4366 Label done; | 4371 Label done; |
4367 if (signedness == SIGNED_INT32) { | 4372 if (signedness == SIGNED_INT32) { |
4368 // There was overflow, so bits 30 and 31 of the original integer | 4373 // There was overflow, so bits 30 and 31 of the original integer |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5603 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5608 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5604 __ ldr(result, FieldMemOperand(scratch, | 5609 __ ldr(result, FieldMemOperand(scratch, |
5605 FixedArray::kHeaderSize - kPointerSize)); | 5610 FixedArray::kHeaderSize - kPointerSize)); |
5606 __ bind(&done); | 5611 __ bind(&done); |
5607 } | 5612 } |
5608 | 5613 |
5609 | 5614 |
5610 #undef __ | 5615 #undef __ |
5611 | 5616 |
5612 } } // namespace v8::internal | 5617 } } // namespace v8::internal |
OLD | NEW |