| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| 11 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
| 12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 13 #include "src/cpu-profiler.h" | 13 #include "src/cpu-profiler.h" |
| 14 #include "src/deoptimizer.h" | 14 #include "src/deoptimizer.h" |
| 15 #include "src/hydrogen-osr.h" | 15 #include "src/hydrogen-osr.h" |
| 16 #include "src/ia32/lithium-codegen-ia32.h" | 16 #include "src/ia32/lithium-codegen-ia32.h" |
| 17 #include "src/ic/ic.h" | 17 #include "src/ic/ic.h" |
| 18 #include "src/ic/stub-cache.h" | 18 #include "src/ic/stub-cache.h" |
| 19 | 19 |
| 20 namespace v8 { | 20 namespace v8 { |
| 21 namespace internal { | 21 namespace internal { |
| 22 | 22 |
| 23 // When invoking builtins, we need to record the safepoint in the middle of | 23 // When invoking builtins, we need to record the safepoint in the middle of |
| 24 // the invoke instruction sequence generated by the macro assembler. | 24 // the invoke instruction sequence generated by the macro assembler. |
| 25 class SafepointGenerator FINAL : public CallWrapper { | 25 class SafepointGenerator final : public CallWrapper { |
| 26 public: | 26 public: |
| 27 SafepointGenerator(LCodeGen* codegen, | 27 SafepointGenerator(LCodeGen* codegen, |
| 28 LPointerMap* pointers, | 28 LPointerMap* pointers, |
| 29 Safepoint::DeoptMode mode) | 29 Safepoint::DeoptMode mode) |
| 30 : codegen_(codegen), | 30 : codegen_(codegen), |
| 31 pointers_(pointers), | 31 pointers_(pointers), |
| 32 deopt_mode_(mode) {} | 32 deopt_mode_(mode) {} |
| 33 virtual ~SafepointGenerator() {} | 33 virtual ~SafepointGenerator() {} |
| 34 | 34 |
| 35 void BeforeCall(int call_size) const OVERRIDE {} | 35 void BeforeCall(int call_size) const override {} |
| 36 | 36 |
| 37 void AfterCall() const OVERRIDE { | 37 void AfterCall() const override { |
| 38 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 38 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 LCodeGen* codegen_; | 42 LCodeGen* codegen_; |
| 43 LPointerMap* pointers_; | 43 LPointerMap* pointers_; |
| 44 Safepoint::DeoptMode deopt_mode_; | 44 Safepoint::DeoptMode deopt_mode_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 | 47 |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 __ j(zero, &true_value, Label::kNear); | 2662 __ j(zero, &true_value, Label::kNear); |
| 2663 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2663 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2664 __ jmp(&done, Label::kNear); | 2664 __ jmp(&done, Label::kNear); |
| 2665 __ bind(&true_value); | 2665 __ bind(&true_value); |
| 2666 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2666 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2667 __ bind(&done); | 2667 __ bind(&done); |
| 2668 } | 2668 } |
| 2669 | 2669 |
| 2670 | 2670 |
| 2671 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2671 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| 2672 class DeferredInstanceOfKnownGlobal FINAL : public LDeferredCode { | 2672 class DeferredInstanceOfKnownGlobal final : public LDeferredCode { |
| 2673 public: | 2673 public: |
| 2674 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2674 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
| 2675 LInstanceOfKnownGlobal* instr) | 2675 LInstanceOfKnownGlobal* instr) |
| 2676 : LDeferredCode(codegen), instr_(instr) { } | 2676 : LDeferredCode(codegen), instr_(instr) { } |
| 2677 void Generate() OVERRIDE { | 2677 void Generate() override { |
| 2678 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2678 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
| 2679 } | 2679 } |
| 2680 LInstruction* instr() OVERRIDE { return instr_; } | 2680 LInstruction* instr() override { return instr_; } |
| 2681 Label* map_check() { return &map_check_; } | 2681 Label* map_check() { return &map_check_; } |
| 2682 private: | 2682 private: |
| 2683 LInstanceOfKnownGlobal* instr_; | 2683 LInstanceOfKnownGlobal* instr_; |
| 2684 Label map_check_; | 2684 Label map_check_; |
| 2685 }; | 2685 }; |
| 2686 | 2686 |
| 2687 DeferredInstanceOfKnownGlobal* deferred; | 2687 DeferredInstanceOfKnownGlobal* deferred; |
| 2688 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2688 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
| 2689 | 2689 |
| 2690 Label done, false_result; | 2690 Label done, false_result; |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3605 Label is_positive; | 3605 Label is_positive; |
| 3606 __ j(not_sign, &is_positive, Label::kNear); | 3606 __ j(not_sign, &is_positive, Label::kNear); |
| 3607 __ neg(input_reg); // Sets flags. | 3607 __ neg(input_reg); // Sets flags. |
| 3608 DeoptimizeIf(negative, instr, Deoptimizer::kOverflow); | 3608 DeoptimizeIf(negative, instr, Deoptimizer::kOverflow); |
| 3609 __ bind(&is_positive); | 3609 __ bind(&is_positive); |
| 3610 } | 3610 } |
| 3611 | 3611 |
| 3612 | 3612 |
| 3613 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3613 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
| 3614 // Class for deferred case. | 3614 // Class for deferred case. |
| 3615 class DeferredMathAbsTaggedHeapNumber FINAL : public LDeferredCode { | 3615 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { |
| 3616 public: | 3616 public: |
| 3617 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, | 3617 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, |
| 3618 LMathAbs* instr) | 3618 LMathAbs* instr) |
| 3619 : LDeferredCode(codegen), instr_(instr) { } | 3619 : LDeferredCode(codegen), instr_(instr) { } |
| 3620 void Generate() OVERRIDE { | 3620 void Generate() override { |
| 3621 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3621 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
| 3622 } | 3622 } |
| 3623 LInstruction* instr() OVERRIDE { return instr_; } | 3623 LInstruction* instr() override { return instr_; } |
| 3624 | 3624 |
| 3625 private: | 3625 private: |
| 3626 LMathAbs* instr_; | 3626 LMathAbs* instr_; |
| 3627 }; | 3627 }; |
| 3628 | 3628 |
| 3629 DCHECK(instr->value()->Equals(instr->result())); | 3629 DCHECK(instr->value()->Equals(instr->result())); |
| 3630 Representation r = instr->hydrogen()->value()->representation(); | 3630 Representation r = instr->hydrogen()->value()->representation(); |
| 3631 | 3631 |
| 3632 if (r.IsDouble()) { | 3632 if (r.IsDouble()) { |
| 3633 XMMRegister scratch = double_scratch0(); | 3633 XMMRegister scratch = double_scratch0(); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4378 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); | 4378 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); |
| 4379 __ CallStub(&stub); | 4379 __ CallStub(&stub); |
| 4380 RecordSafepointWithLazyDeopt(instr, | 4380 RecordSafepointWithLazyDeopt(instr, |
| 4381 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 4381 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 4382 } | 4382 } |
| 4383 __ bind(¬_applicable); | 4383 __ bind(¬_applicable); |
| 4384 } | 4384 } |
| 4385 | 4385 |
| 4386 | 4386 |
| 4387 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4387 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 4388 class DeferredStringCharCodeAt FINAL : public LDeferredCode { | 4388 class DeferredStringCharCodeAt final : public LDeferredCode { |
| 4389 public: | 4389 public: |
| 4390 DeferredStringCharCodeAt(LCodeGen* codegen, | 4390 DeferredStringCharCodeAt(LCodeGen* codegen, |
| 4391 LStringCharCodeAt* instr) | 4391 LStringCharCodeAt* instr) |
| 4392 : LDeferredCode(codegen), instr_(instr) { } | 4392 : LDeferredCode(codegen), instr_(instr) { } |
| 4393 void Generate() OVERRIDE { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4393 void Generate() override { codegen()->DoDeferredStringCharCodeAt(instr_); } |
| 4394 LInstruction* instr() OVERRIDE { return instr_; } | 4394 LInstruction* instr() override { return instr_; } |
| 4395 | 4395 |
| 4396 private: | 4396 private: |
| 4397 LStringCharCodeAt* instr_; | 4397 LStringCharCodeAt* instr_; |
| 4398 }; | 4398 }; |
| 4399 | 4399 |
| 4400 DeferredStringCharCodeAt* deferred = | 4400 DeferredStringCharCodeAt* deferred = |
| 4401 new(zone()) DeferredStringCharCodeAt(this, instr); | 4401 new(zone()) DeferredStringCharCodeAt(this, instr); |
| 4402 | 4402 |
| 4403 StringCharLoadGenerator::Generate(masm(), | 4403 StringCharLoadGenerator::Generate(masm(), |
| 4404 factory(), | 4404 factory(), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4435 } | 4435 } |
| 4436 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, | 4436 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, |
| 4437 instr, instr->context()); | 4437 instr, instr->context()); |
| 4438 __ AssertSmi(eax); | 4438 __ AssertSmi(eax); |
| 4439 __ SmiUntag(eax); | 4439 __ SmiUntag(eax); |
| 4440 __ StoreToSafepointRegisterSlot(result, eax); | 4440 __ StoreToSafepointRegisterSlot(result, eax); |
| 4441 } | 4441 } |
| 4442 | 4442 |
| 4443 | 4443 |
| 4444 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4444 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
| 4445 class DeferredStringCharFromCode FINAL : public LDeferredCode { | 4445 class DeferredStringCharFromCode final : public LDeferredCode { |
| 4446 public: | 4446 public: |
| 4447 DeferredStringCharFromCode(LCodeGen* codegen, | 4447 DeferredStringCharFromCode(LCodeGen* codegen, |
| 4448 LStringCharFromCode* instr) | 4448 LStringCharFromCode* instr) |
| 4449 : LDeferredCode(codegen), instr_(instr) { } | 4449 : LDeferredCode(codegen), instr_(instr) { } |
| 4450 void Generate() OVERRIDE { | 4450 void Generate() override { |
| 4451 codegen()->DoDeferredStringCharFromCode(instr_); | 4451 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4452 } | 4452 } |
| 4453 LInstruction* instr() OVERRIDE { return instr_; } | 4453 LInstruction* instr() override { return instr_; } |
| 4454 | 4454 |
| 4455 private: | 4455 private: |
| 4456 LStringCharFromCode* instr_; | 4456 LStringCharFromCode* instr_; |
| 4457 }; | 4457 }; |
| 4458 | 4458 |
| 4459 DeferredStringCharFromCode* deferred = | 4459 DeferredStringCharFromCode* deferred = |
| 4460 new(zone()) DeferredStringCharFromCode(this, instr); | 4460 new(zone()) DeferredStringCharFromCode(this, instr); |
| 4461 | 4461 |
| 4462 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); | 4462 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); |
| 4463 Register char_code = ToRegister(instr->char_code()); | 4463 Register char_code = ToRegister(instr->char_code()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4514 | 4514 |
| 4515 | 4515 |
| 4516 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4516 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
| 4517 LOperand* input = instr->value(); | 4517 LOperand* input = instr->value(); |
| 4518 LOperand* output = instr->result(); | 4518 LOperand* output = instr->result(); |
| 4519 __ LoadUint32(ToDoubleRegister(output), ToRegister(input)); | 4519 __ LoadUint32(ToDoubleRegister(output), ToRegister(input)); |
| 4520 } | 4520 } |
| 4521 | 4521 |
| 4522 | 4522 |
| 4523 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4523 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4524 class DeferredNumberTagI FINAL : public LDeferredCode { | 4524 class DeferredNumberTagI final : public LDeferredCode { |
| 4525 public: | 4525 public: |
| 4526 DeferredNumberTagI(LCodeGen* codegen, | 4526 DeferredNumberTagI(LCodeGen* codegen, |
| 4527 LNumberTagI* instr) | 4527 LNumberTagI* instr) |
| 4528 : LDeferredCode(codegen), instr_(instr) { } | 4528 : LDeferredCode(codegen), instr_(instr) { } |
| 4529 void Generate() OVERRIDE { | 4529 void Generate() override { |
| 4530 codegen()->DoDeferredNumberTagIU( | 4530 codegen()->DoDeferredNumberTagIU( |
| 4531 instr_, instr_->value(), instr_->temp(), SIGNED_INT32); | 4531 instr_, instr_->value(), instr_->temp(), SIGNED_INT32); |
| 4532 } | 4532 } |
| 4533 LInstruction* instr() OVERRIDE { return instr_; } | 4533 LInstruction* instr() override { return instr_; } |
| 4534 | 4534 |
| 4535 private: | 4535 private: |
| 4536 LNumberTagI* instr_; | 4536 LNumberTagI* instr_; |
| 4537 }; | 4537 }; |
| 4538 | 4538 |
| 4539 LOperand* input = instr->value(); | 4539 LOperand* input = instr->value(); |
| 4540 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4540 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 4541 Register reg = ToRegister(input); | 4541 Register reg = ToRegister(input); |
| 4542 | 4542 |
| 4543 DeferredNumberTagI* deferred = | 4543 DeferredNumberTagI* deferred = |
| 4544 new(zone()) DeferredNumberTagI(this, instr); | 4544 new(zone()) DeferredNumberTagI(this, instr); |
| 4545 __ SmiTag(reg); | 4545 __ SmiTag(reg); |
| 4546 __ j(overflow, deferred->entry()); | 4546 __ j(overflow, deferred->entry()); |
| 4547 __ bind(deferred->exit()); | 4547 __ bind(deferred->exit()); |
| 4548 } | 4548 } |
| 4549 | 4549 |
| 4550 | 4550 |
| 4551 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4551 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
| 4552 class DeferredNumberTagU FINAL : public LDeferredCode { | 4552 class DeferredNumberTagU final : public LDeferredCode { |
| 4553 public: | 4553 public: |
| 4554 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4554 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
| 4555 : LDeferredCode(codegen), instr_(instr) { } | 4555 : LDeferredCode(codegen), instr_(instr) { } |
| 4556 void Generate() OVERRIDE { | 4556 void Generate() override { |
| 4557 codegen()->DoDeferredNumberTagIU( | 4557 codegen()->DoDeferredNumberTagIU( |
| 4558 instr_, instr_->value(), instr_->temp(), UNSIGNED_INT32); | 4558 instr_, instr_->value(), instr_->temp(), UNSIGNED_INT32); |
| 4559 } | 4559 } |
| 4560 LInstruction* instr() OVERRIDE { return instr_; } | 4560 LInstruction* instr() override { return instr_; } |
| 4561 | 4561 |
| 4562 private: | 4562 private: |
| 4563 LNumberTagU* instr_; | 4563 LNumberTagU* instr_; |
| 4564 }; | 4564 }; |
| 4565 | 4565 |
| 4566 LOperand* input = instr->value(); | 4566 LOperand* input = instr->value(); |
| 4567 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4567 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 4568 Register reg = ToRegister(input); | 4568 Register reg = ToRegister(input); |
| 4569 | 4569 |
| 4570 DeferredNumberTagU* deferred = | 4570 DeferredNumberTagU* deferred = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4625 } | 4625 } |
| 4626 | 4626 |
| 4627 // Done. Put the value in xmm_scratch into the value of the allocated heap | 4627 // Done. Put the value in xmm_scratch into the value of the allocated heap |
| 4628 // number. | 4628 // number. |
| 4629 __ bind(&done); | 4629 __ bind(&done); |
| 4630 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm_scratch); | 4630 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm_scratch); |
| 4631 } | 4631 } |
| 4632 | 4632 |
| 4633 | 4633 |
| 4634 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4634 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 4635 class DeferredNumberTagD FINAL : public LDeferredCode { | 4635 class DeferredNumberTagD final : public LDeferredCode { |
| 4636 public: | 4636 public: |
| 4637 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4637 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 4638 : LDeferredCode(codegen), instr_(instr) { } | 4638 : LDeferredCode(codegen), instr_(instr) { } |
| 4639 void Generate() OVERRIDE { codegen()->DoDeferredNumberTagD(instr_); } | 4639 void Generate() override { codegen()->DoDeferredNumberTagD(instr_); } |
| 4640 LInstruction* instr() OVERRIDE { return instr_; } | 4640 LInstruction* instr() override { return instr_; } |
| 4641 | 4641 |
| 4642 private: | 4642 private: |
| 4643 LNumberTagD* instr_; | 4643 LNumberTagD* instr_; |
| 4644 }; | 4644 }; |
| 4645 | 4645 |
| 4646 Register reg = ToRegister(instr->result()); | 4646 Register reg = ToRegister(instr->result()); |
| 4647 | 4647 |
| 4648 DeferredNumberTagD* deferred = | 4648 DeferredNumberTagD* deferred = |
| 4649 new(zone()) DeferredNumberTagD(this, instr); | 4649 new(zone()) DeferredNumberTagD(this, instr); |
| 4650 if (FLAG_inline_new) { | 4650 if (FLAG_inline_new) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4823 __ j(not_zero, done); | 4823 __ j(not_zero, done); |
| 4824 __ movmskpd(input_reg, xmm0); | 4824 __ movmskpd(input_reg, xmm0); |
| 4825 __ and_(input_reg, 1); | 4825 __ and_(input_reg, 1); |
| 4826 DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero); | 4826 DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero); |
| 4827 } | 4827 } |
| 4828 } | 4828 } |
| 4829 } | 4829 } |
| 4830 | 4830 |
| 4831 | 4831 |
| 4832 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4832 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4833 class DeferredTaggedToI FINAL : public LDeferredCode { | 4833 class DeferredTaggedToI final : public LDeferredCode { |
| 4834 public: | 4834 public: |
| 4835 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4835 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
| 4836 : LDeferredCode(codegen), instr_(instr) { } | 4836 : LDeferredCode(codegen), instr_(instr) { } |
| 4837 void Generate() OVERRIDE { codegen()->DoDeferredTaggedToI(instr_, done()); } | 4837 void Generate() override { codegen()->DoDeferredTaggedToI(instr_, done()); } |
| 4838 LInstruction* instr() OVERRIDE { return instr_; } | 4838 LInstruction* instr() override { return instr_; } |
| 4839 | 4839 |
| 4840 private: | 4840 private: |
| 4841 LTaggedToI* instr_; | 4841 LTaggedToI* instr_; |
| 4842 }; | 4842 }; |
| 4843 | 4843 |
| 4844 LOperand* input = instr->value(); | 4844 LOperand* input = instr->value(); |
| 4845 DCHECK(input->IsRegister()); | 4845 DCHECK(input->IsRegister()); |
| 4846 Register input_reg = ToRegister(input); | 4846 Register input_reg = ToRegister(input); |
| 4847 DCHECK(input_reg.is(ToRegister(instr->result()))); | 4847 DCHECK(input_reg.is(ToRegister(instr->result()))); |
| 4848 | 4848 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5025 RecordSafepointWithRegisters( | 5025 RecordSafepointWithRegisters( |
| 5026 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5026 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 5027 | 5027 |
| 5028 __ test(eax, Immediate(kSmiTagMask)); | 5028 __ test(eax, Immediate(kSmiTagMask)); |
| 5029 } | 5029 } |
| 5030 DeoptimizeIf(zero, instr, Deoptimizer::kInstanceMigrationFailed); | 5030 DeoptimizeIf(zero, instr, Deoptimizer::kInstanceMigrationFailed); |
| 5031 } | 5031 } |
| 5032 | 5032 |
| 5033 | 5033 |
| 5034 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5034 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5035 class DeferredCheckMaps FINAL : public LDeferredCode { | 5035 class DeferredCheckMaps final : public LDeferredCode { |
| 5036 public: | 5036 public: |
| 5037 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 5037 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 5038 : LDeferredCode(codegen), instr_(instr), object_(object) { | 5038 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 5039 SetExit(check_maps()); | 5039 SetExit(check_maps()); |
| 5040 } | 5040 } |
| 5041 void Generate() OVERRIDE { | 5041 void Generate() override { |
| 5042 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5042 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 5043 } | 5043 } |
| 5044 Label* check_maps() { return &check_maps_; } | 5044 Label* check_maps() { return &check_maps_; } |
| 5045 LInstruction* instr() OVERRIDE { return instr_; } | 5045 LInstruction* instr() override { return instr_; } |
| 5046 | 5046 |
| 5047 private: | 5047 private: |
| 5048 LCheckMaps* instr_; | 5048 LCheckMaps* instr_; |
| 5049 Label check_maps_; | 5049 Label check_maps_; |
| 5050 Register object_; | 5050 Register object_; |
| 5051 }; | 5051 }; |
| 5052 | 5052 |
| 5053 if (instr->hydrogen()->IsStabilityCheck()) { | 5053 if (instr->hydrogen()->IsStabilityCheck()) { |
| 5054 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); | 5054 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); |
| 5055 for (int i = 0; i < maps->size(); ++i) { | 5055 for (int i = 0; i < maps->size(); ++i) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5169 XMMRegister xmm_scratch = double_scratch0(); | 5169 XMMRegister xmm_scratch = double_scratch0(); |
| 5170 __ movd(result_reg, hi_reg); | 5170 __ movd(result_reg, hi_reg); |
| 5171 __ psllq(result_reg, 32); | 5171 __ psllq(result_reg, 32); |
| 5172 __ movd(xmm_scratch, lo_reg); | 5172 __ movd(xmm_scratch, lo_reg); |
| 5173 __ orps(result_reg, xmm_scratch); | 5173 __ orps(result_reg, xmm_scratch); |
| 5174 } | 5174 } |
| 5175 } | 5175 } |
| 5176 | 5176 |
| 5177 | 5177 |
| 5178 void LCodeGen::DoAllocate(LAllocate* instr) { | 5178 void LCodeGen::DoAllocate(LAllocate* instr) { |
| 5179 class DeferredAllocate FINAL : public LDeferredCode { | 5179 class DeferredAllocate final : public LDeferredCode { |
| 5180 public: | 5180 public: |
| 5181 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5181 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
| 5182 : LDeferredCode(codegen), instr_(instr) { } | 5182 : LDeferredCode(codegen), instr_(instr) { } |
| 5183 void Generate() OVERRIDE { codegen()->DoDeferredAllocate(instr_); } | 5183 void Generate() override { codegen()->DoDeferredAllocate(instr_); } |
| 5184 LInstruction* instr() OVERRIDE { return instr_; } | 5184 LInstruction* instr() override { return instr_; } |
| 5185 | 5185 |
| 5186 private: | 5186 private: |
| 5187 LAllocate* instr_; | 5187 LAllocate* instr_; |
| 5188 }; | 5188 }; |
| 5189 | 5189 |
| 5190 DeferredAllocate* deferred = new(zone()) DeferredAllocate(this, instr); | 5190 DeferredAllocate* deferred = new(zone()) DeferredAllocate(this, instr); |
| 5191 | 5191 |
| 5192 Register result = ToRegister(instr->result()); | 5192 Register result = ToRegister(instr->result()); |
| 5193 Register temp = ToRegister(instr->temp()); | 5193 Register temp = ToRegister(instr->temp()); |
| 5194 | 5194 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5526 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5526 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
| 5527 RecordSafepointWithLazyDeopt( | 5527 RecordSafepointWithLazyDeopt( |
| 5528 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5528 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 5529 DCHECK(instr->HasEnvironment()); | 5529 DCHECK(instr->HasEnvironment()); |
| 5530 LEnvironment* env = instr->environment(); | 5530 LEnvironment* env = instr->environment(); |
| 5531 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5531 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5532 } | 5532 } |
| 5533 | 5533 |
| 5534 | 5534 |
| 5535 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5535 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 5536 class DeferredStackCheck FINAL : public LDeferredCode { | 5536 class DeferredStackCheck final : public LDeferredCode { |
| 5537 public: | 5537 public: |
| 5538 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5538 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
| 5539 : LDeferredCode(codegen), instr_(instr) { } | 5539 : LDeferredCode(codegen), instr_(instr) { } |
| 5540 void Generate() OVERRIDE { codegen()->DoDeferredStackCheck(instr_); } | 5540 void Generate() override { codegen()->DoDeferredStackCheck(instr_); } |
| 5541 LInstruction* instr() OVERRIDE { return instr_; } | 5541 LInstruction* instr() override { return instr_; } |
| 5542 | 5542 |
| 5543 private: | 5543 private: |
| 5544 LStackCheck* instr_; | 5544 LStackCheck* instr_; |
| 5545 }; | 5545 }; |
| 5546 | 5546 |
| 5547 DCHECK(instr->HasEnvironment()); | 5547 DCHECK(instr->HasEnvironment()); |
| 5548 LEnvironment* env = instr->environment(); | 5548 LEnvironment* env = instr->environment(); |
| 5549 // There is no LLazyBailout instruction for stack-checks. We have to | 5549 // There is no LLazyBailout instruction for stack-checks. We have to |
| 5550 // prepare for lazy deoptimization explicitly here. | 5550 // prepare for lazy deoptimization explicitly here. |
| 5551 if (instr->hydrogen()->is_function_entry()) { | 5551 if (instr->hydrogen()->is_function_entry()) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5662 __ push(index); | 5662 __ push(index); |
| 5663 __ xor_(esi, esi); | 5663 __ xor_(esi, esi); |
| 5664 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); | 5664 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); |
| 5665 RecordSafepointWithRegisters( | 5665 RecordSafepointWithRegisters( |
| 5666 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); | 5666 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); |
| 5667 __ StoreToSafepointRegisterSlot(object, eax); | 5667 __ StoreToSafepointRegisterSlot(object, eax); |
| 5668 } | 5668 } |
| 5669 | 5669 |
| 5670 | 5670 |
| 5671 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5671 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 5672 class DeferredLoadMutableDouble FINAL : public LDeferredCode { | 5672 class DeferredLoadMutableDouble final : public LDeferredCode { |
| 5673 public: | 5673 public: |
| 5674 DeferredLoadMutableDouble(LCodeGen* codegen, | 5674 DeferredLoadMutableDouble(LCodeGen* codegen, |
| 5675 LLoadFieldByIndex* instr, | 5675 LLoadFieldByIndex* instr, |
| 5676 Register object, | 5676 Register object, |
| 5677 Register index) | 5677 Register index) |
| 5678 : LDeferredCode(codegen), | 5678 : LDeferredCode(codegen), |
| 5679 instr_(instr), | 5679 instr_(instr), |
| 5680 object_(object), | 5680 object_(object), |
| 5681 index_(index) { | 5681 index_(index) { |
| 5682 } | 5682 } |
| 5683 void Generate() OVERRIDE { | 5683 void Generate() override { |
| 5684 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); | 5684 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); |
| 5685 } | 5685 } |
| 5686 LInstruction* instr() OVERRIDE { return instr_; } | 5686 LInstruction* instr() override { return instr_; } |
| 5687 | 5687 |
| 5688 private: | 5688 private: |
| 5689 LLoadFieldByIndex* instr_; | 5689 LLoadFieldByIndex* instr_; |
| 5690 Register object_; | 5690 Register object_; |
| 5691 Register index_; | 5691 Register index_; |
| 5692 }; | 5692 }; |
| 5693 | 5693 |
| 5694 Register object = ToRegister(instr->object()); | 5694 Register object = ToRegister(instr->object()); |
| 5695 Register index = ToRegister(instr->index()); | 5695 Register index = ToRegister(instr->index()); |
| 5696 | 5696 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5738 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5738 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5739 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5739 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5740 } | 5740 } |
| 5741 | 5741 |
| 5742 | 5742 |
| 5743 #undef __ | 5743 #undef __ |
| 5744 | 5744 |
| 5745 } } // namespace v8::internal | 5745 } } // namespace v8::internal |
| 5746 | 5746 |
| 5747 #endif // V8_TARGET_ARCH_IA32 | 5747 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |