| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3715 | 3715 |
| 3716 void LCodeGen::DoMathCos(LMathCos* instr) { | 3716 void LCodeGen::DoMathCos(LMathCos* instr) { |
| 3717 ASSERT(ToDoubleRegister(instr->result()).is(d0)); | 3717 ASSERT(ToDoubleRegister(instr->result()).is(d0)); |
| 3718 TranscendentalCacheStub stub(TranscendentalCache::COS, | 3718 TranscendentalCacheStub stub(TranscendentalCache::COS, |
| 3719 TranscendentalCacheStub::UNTAGGED); | 3719 TranscendentalCacheStub::UNTAGGED); |
| 3720 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3720 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3721 ASSERT(ToDoubleRegister(instr->result()).Is(d0)); | 3721 ASSERT(ToDoubleRegister(instr->result()).Is(d0)); |
| 3722 } | 3722 } |
| 3723 | 3723 |
| 3724 | 3724 |
| 3725 // TODO(all): This will disappear when Math.random is rewritten in JavaScript. |
| 3725 void LCodeGen::DoRandom(LRandom* instr) { | 3726 void LCodeGen::DoRandom(LRandom* instr) { |
| 3726 class DeferredDoRandom: public LDeferredCode { | 3727 class DeferredDoRandom: public LDeferredCode { |
| 3727 public: | 3728 public: |
| 3728 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) | 3729 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) |
| 3729 : LDeferredCode(codegen), instr_(instr) { } | 3730 : LDeferredCode(codegen), instr_(instr) { } |
| 3730 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } | 3731 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } |
| 3731 virtual LInstruction* instr() { return instr_; } | 3732 virtual LInstruction* instr() { return instr_; } |
| 3732 | 3733 |
| 3733 private: | 3734 private: |
| 3734 LRandom* instr_; | 3735 LRandom* instr_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3779 __ And(w3, w3, 0x3FFFF); | 3780 __ And(w3, w3, 0x3FFFF); |
| 3780 __ Add(w0, w3, Operand(w2, LSL, 14)); | 3781 __ Add(w0, w3, Operand(w2, LSL, 14)); |
| 3781 | 3782 |
| 3782 __ Bind(deferred->exit()); | 3783 __ Bind(deferred->exit()); |
| 3783 // Interpret the 32 random bits as a 0.32 fixed point number, and convert to | 3784 // Interpret the 32 random bits as a 0.32 fixed point number, and convert to |
| 3784 // a double in the range 0.0 <= number < 1.0. | 3785 // a double in the range 0.0 <= number < 1.0. |
| 3785 __ Ucvtf(d7, w0, 32); | 3786 __ Ucvtf(d7, w0, 32); |
| 3786 } | 3787 } |
| 3787 | 3788 |
| 3788 | 3789 |
| 3790 // TODO(all): This will disappear when Math.random is rewritten in JavaScript. |
| 3789 void LCodeGen::DoDeferredRandom(LRandom* instr) { | 3791 void LCodeGen::DoDeferredRandom(LRandom* instr) { |
| 3790 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3792 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
| 3791 // Return value is in x0. | 3793 // Return value is in x0. |
| 3792 } | 3794 } |
| 3793 | 3795 |
| 3794 | 3796 |
| 3795 void LCodeGen::DoMathExp(LMathExp* instr) { | 3797 void LCodeGen::DoMathExp(LMathExp* instr) { |
| 3796 DoubleRegister input = ToDoubleRegister(instr->value()); | 3798 DoubleRegister input = ToDoubleRegister(instr->value()); |
| 3797 DoubleRegister result = ToDoubleRegister(instr->result()); | 3799 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 3798 DoubleRegister double_temp1 = ToDoubleRegister(instr->double_temp1()); | 3800 DoubleRegister double_temp1 = ToDoubleRegister(instr->double_temp1()); |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4530 } | 4532 } |
| 4531 __ Ret(); | 4533 __ Ret(); |
| 4532 | 4534 |
| 4533 if (no_frame_start != -1) { | 4535 if (no_frame_start != -1) { |
| 4534 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 4536 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 4535 } | 4537 } |
| 4536 } | 4538 } |
| 4537 | 4539 |
| 4538 | 4540 |
| 4539 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 4541 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
| 4542 // TODO(all): Port ARM optimizations from r16707. |
| 4543 |
| 4540 String::Encoding encoding = instr->encoding(); | 4544 String::Encoding encoding = instr->encoding(); |
| 4541 Register string = ToRegister(instr->string()); | 4545 Register string = ToRegister(instr->string()); |
| 4542 Register index = ToRegister(instr->index()); | 4546 Register index = ToRegister(instr->index()); |
| 4543 Register value = ToRegister(instr->value()); | 4547 Register value = ToRegister(instr->value()); |
| 4544 Register temp = ToRegister(instr->temp()); | 4548 Register temp = ToRegister(instr->temp()); |
| 4545 | 4549 |
| 4546 if (FLAG_debug_code) { | 4550 if (FLAG_debug_code) { |
| 4547 __ Ldr(temp, FieldMemOperand(string, HeapObject::kMapOffset)); | 4551 __ Ldr(temp, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 4548 __ Ldrb(temp, FieldMemOperand(temp, Map::kInstanceTypeOffset)); | 4552 __ Ldrb(temp, FieldMemOperand(temp, Map::kInstanceTypeOffset)); |
| 4549 __ And(temp, temp, kStringRepresentationMask | kStringEncodingMask); | 4553 __ And(temp, temp, kStringRepresentationMask | kStringEncodingMask); |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5263 } | 5267 } |
| 5264 | 5268 |
| 5265 virtual LInstruction* instr() { return instr_; } | 5269 virtual LInstruction* instr() { return instr_; } |
| 5266 private: | 5270 private: |
| 5267 LTaggedToI* instr_; | 5271 LTaggedToI* instr_; |
| 5268 }; | 5272 }; |
| 5269 | 5273 |
| 5270 Register input = ToRegister(instr->value()); | 5274 Register input = ToRegister(instr->value()); |
| 5271 Register output = ToRegister(instr->result()); | 5275 Register output = ToRegister(instr->result()); |
| 5272 | 5276 |
| 5273 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); | 5277 if (instr->hydrogen()->value()->representation().IsSmi()) { |
| 5278 __ SmiUntag(input); |
| 5279 } else { |
| 5280 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); |
| 5274 | 5281 |
| 5275 // TODO(jbramley): We can't use JumpIfNotSmi here because the tbz it uses | 5282 // TODO(jbramley): We can't use JumpIfNotSmi here because the tbz it uses |
| 5276 // doesn't always have enough range. Consider making a variant of it, or a | 5283 // doesn't always have enough range. Consider making a variant of it, or a |
| 5277 // TestIsSmi helper. | 5284 // TestIsSmi helper. |
| 5278 STATIC_ASSERT(kSmiTag == 0); | 5285 STATIC_ASSERT(kSmiTag == 0); |
| 5279 __ Tst(input, kSmiTagMask); | 5286 __ Tst(input, kSmiTagMask); |
| 5280 __ B(ne, deferred->entry()); | 5287 __ B(ne, deferred->entry()); |
| 5281 | 5288 |
| 5282 __ SmiUntag(output, input); | 5289 __ SmiUntag(output, input); |
| 5283 __ Bind(deferred->exit()); | 5290 __ Bind(deferred->exit()); |
| 5291 } |
| 5284 } | 5292 } |
| 5285 | 5293 |
| 5286 | 5294 |
| 5287 void LCodeGen::DoThisFunction(LThisFunction* instr) { | 5295 void LCodeGen::DoThisFunction(LThisFunction* instr) { |
| 5288 Register result = ToRegister(instr->result()); | 5296 Register result = ToRegister(instr->result()); |
| 5289 __ Ldr(result, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 5297 __ Ldr(result, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 5290 } | 5298 } |
| 5291 | 5299 |
| 5292 | 5300 |
| 5293 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5301 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5606 __ Bind(&out_of_object); | 5614 __ Bind(&out_of_object); |
| 5607 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5615 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5608 // Index is equal to negated out of object property index plus 1. | 5616 // Index is equal to negated out of object property index plus 1. |
| 5609 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5617 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5610 __ Ldr(result, FieldMemOperand(result, | 5618 __ Ldr(result, FieldMemOperand(result, |
| 5611 FixedArray::kHeaderSize - kPointerSize)); | 5619 FixedArray::kHeaderSize - kPointerSize)); |
| 5612 __ Bind(&done); | 5620 __ Bind(&done); |
| 5613 } | 5621 } |
| 5614 | 5622 |
| 5615 } } // namespace v8::internal | 5623 } } // namespace v8::internal |
| OLD | NEW |