| 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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/ic/ic.h" | 16 #include "src/ic/ic.h" |
| 17 #include "src/ic/stub-cache.h" | 17 #include "src/ic/stub-cache.h" |
| 18 #include "src/x87/lithium-codegen-x87.h" | 18 #include "src/x87/lithium-codegen-x87.h" |
| 19 | 19 |
| 20 namespace v8 { | 20 namespace v8 { |
| 21 namespace internal { | 21 namespace internal { |
| 22 | 22 |
| 23 | 23 |
| 24 // When invoking builtins, we need to record the safepoint in the middle of | 24 // When invoking builtins, we need to record the safepoint in the middle of |
| 25 // the invoke instruction sequence generated by the macro assembler. | 25 // the invoke instruction sequence generated by the macro assembler. |
| 26 class SafepointGenerator FINAL : public CallWrapper { | 26 class SafepointGenerator final : public CallWrapper { |
| 27 public: | 27 public: |
| 28 SafepointGenerator(LCodeGen* codegen, | 28 SafepointGenerator(LCodeGen* codegen, |
| 29 LPointerMap* pointers, | 29 LPointerMap* pointers, |
| 30 Safepoint::DeoptMode mode) | 30 Safepoint::DeoptMode mode) |
| 31 : codegen_(codegen), | 31 : codegen_(codegen), |
| 32 pointers_(pointers), | 32 pointers_(pointers), |
| 33 deopt_mode_(mode) {} | 33 deopt_mode_(mode) {} |
| 34 virtual ~SafepointGenerator() {} | 34 virtual ~SafepointGenerator() {} |
| 35 | 35 |
| 36 void BeforeCall(int call_size) const OVERRIDE {} | 36 void BeforeCall(int call_size) const override {} |
| 37 | 37 |
| 38 void AfterCall() const OVERRIDE { | 38 void AfterCall() const override { |
| 39 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 39 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 LCodeGen* codegen_; | 43 LCodeGen* codegen_; |
| 44 LPointerMap* pointers_; | 44 LPointerMap* pointers_; |
| 45 Safepoint::DeoptMode deopt_mode_; | 45 Safepoint::DeoptMode deopt_mode_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 | 48 |
| (...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 __ j(zero, &true_value, Label::kNear); | 2939 __ j(zero, &true_value, Label::kNear); |
| 2940 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2940 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2941 __ jmp(&done, Label::kNear); | 2941 __ jmp(&done, Label::kNear); |
| 2942 __ bind(&true_value); | 2942 __ bind(&true_value); |
| 2943 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2943 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2944 __ bind(&done); | 2944 __ bind(&done); |
| 2945 } | 2945 } |
| 2946 | 2946 |
| 2947 | 2947 |
| 2948 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2948 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| 2949 class DeferredInstanceOfKnownGlobal FINAL : public LDeferredCode { | 2949 class DeferredInstanceOfKnownGlobal final : public LDeferredCode { |
| 2950 public: | 2950 public: |
| 2951 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2951 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
| 2952 LInstanceOfKnownGlobal* instr, | 2952 LInstanceOfKnownGlobal* instr, |
| 2953 const X87Stack& x87_stack) | 2953 const X87Stack& x87_stack) |
| 2954 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 2954 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 2955 void Generate() OVERRIDE { | 2955 void Generate() override { |
| 2956 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2956 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
| 2957 } | 2957 } |
| 2958 LInstruction* instr() OVERRIDE { return instr_; } | 2958 LInstruction* instr() override { return instr_; } |
| 2959 Label* map_check() { return &map_check_; } | 2959 Label* map_check() { return &map_check_; } |
| 2960 private: | 2960 private: |
| 2961 LInstanceOfKnownGlobal* instr_; | 2961 LInstanceOfKnownGlobal* instr_; |
| 2962 Label map_check_; | 2962 Label map_check_; |
| 2963 }; | 2963 }; |
| 2964 | 2964 |
| 2965 DeferredInstanceOfKnownGlobal* deferred; | 2965 DeferredInstanceOfKnownGlobal* deferred; |
| 2966 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr, x87_stack_); | 2966 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr, x87_stack_); |
| 2967 | 2967 |
| 2968 Label done, false_result; | 2968 Label done, false_result; |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3871 Label is_positive; | 3871 Label is_positive; |
| 3872 __ j(not_sign, &is_positive, Label::kNear); | 3872 __ j(not_sign, &is_positive, Label::kNear); |
| 3873 __ neg(input_reg); // Sets flags. | 3873 __ neg(input_reg); // Sets flags. |
| 3874 DeoptimizeIf(negative, instr, Deoptimizer::kOverflow); | 3874 DeoptimizeIf(negative, instr, Deoptimizer::kOverflow); |
| 3875 __ bind(&is_positive); | 3875 __ bind(&is_positive); |
| 3876 } | 3876 } |
| 3877 | 3877 |
| 3878 | 3878 |
| 3879 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3879 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
| 3880 // Class for deferred case. | 3880 // Class for deferred case. |
| 3881 class DeferredMathAbsTaggedHeapNumber FINAL : public LDeferredCode { | 3881 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { |
| 3882 public: | 3882 public: |
| 3883 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, | 3883 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, |
| 3884 LMathAbs* instr, | 3884 LMathAbs* instr, |
| 3885 const X87Stack& x87_stack) | 3885 const X87Stack& x87_stack) |
| 3886 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 3886 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 3887 void Generate() OVERRIDE { | 3887 void Generate() override { |
| 3888 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3888 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
| 3889 } | 3889 } |
| 3890 LInstruction* instr() OVERRIDE { return instr_; } | 3890 LInstruction* instr() override { return instr_; } |
| 3891 | 3891 |
| 3892 private: | 3892 private: |
| 3893 LMathAbs* instr_; | 3893 LMathAbs* instr_; |
| 3894 }; | 3894 }; |
| 3895 | 3895 |
| 3896 DCHECK(instr->value()->Equals(instr->result())); | 3896 DCHECK(instr->value()->Equals(instr->result())); |
| 3897 Representation r = instr->hydrogen()->value()->representation(); | 3897 Representation r = instr->hydrogen()->value()->representation(); |
| 3898 | 3898 |
| 3899 if (r.IsDouble()) { | 3899 if (r.IsDouble()) { |
| 3900 X87Register value = ToX87Register(instr->value()); | 3900 X87Register value = ToX87Register(instr->value()); |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4829 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); | 4829 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); |
| 4830 __ CallStub(&stub); | 4830 __ CallStub(&stub); |
| 4831 RecordSafepointWithLazyDeopt(instr, | 4831 RecordSafepointWithLazyDeopt(instr, |
| 4832 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 4832 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 4833 } | 4833 } |
| 4834 __ bind(¬_applicable); | 4834 __ bind(¬_applicable); |
| 4835 } | 4835 } |
| 4836 | 4836 |
| 4837 | 4837 |
| 4838 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4838 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 4839 class DeferredStringCharCodeAt FINAL : public LDeferredCode { | 4839 class DeferredStringCharCodeAt final : public LDeferredCode { |
| 4840 public: | 4840 public: |
| 4841 DeferredStringCharCodeAt(LCodeGen* codegen, | 4841 DeferredStringCharCodeAt(LCodeGen* codegen, |
| 4842 LStringCharCodeAt* instr, | 4842 LStringCharCodeAt* instr, |
| 4843 const X87Stack& x87_stack) | 4843 const X87Stack& x87_stack) |
| 4844 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4844 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4845 void Generate() OVERRIDE { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4845 void Generate() override { codegen()->DoDeferredStringCharCodeAt(instr_); } |
| 4846 LInstruction* instr() OVERRIDE { return instr_; } | 4846 LInstruction* instr() override { return instr_; } |
| 4847 | 4847 |
| 4848 private: | 4848 private: |
| 4849 LStringCharCodeAt* instr_; | 4849 LStringCharCodeAt* instr_; |
| 4850 }; | 4850 }; |
| 4851 | 4851 |
| 4852 DeferredStringCharCodeAt* deferred = | 4852 DeferredStringCharCodeAt* deferred = |
| 4853 new(zone()) DeferredStringCharCodeAt(this, instr, x87_stack_); | 4853 new(zone()) DeferredStringCharCodeAt(this, instr, x87_stack_); |
| 4854 | 4854 |
| 4855 StringCharLoadGenerator::Generate(masm(), | 4855 StringCharLoadGenerator::Generate(masm(), |
| 4856 factory(), | 4856 factory(), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4887 } | 4887 } |
| 4888 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, | 4888 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, |
| 4889 instr, instr->context()); | 4889 instr, instr->context()); |
| 4890 __ AssertSmi(eax); | 4890 __ AssertSmi(eax); |
| 4891 __ SmiUntag(eax); | 4891 __ SmiUntag(eax); |
| 4892 __ StoreToSafepointRegisterSlot(result, eax); | 4892 __ StoreToSafepointRegisterSlot(result, eax); |
| 4893 } | 4893 } |
| 4894 | 4894 |
| 4895 | 4895 |
| 4896 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4896 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
| 4897 class DeferredStringCharFromCode FINAL : public LDeferredCode { | 4897 class DeferredStringCharFromCode final : public LDeferredCode { |
| 4898 public: | 4898 public: |
| 4899 DeferredStringCharFromCode(LCodeGen* codegen, | 4899 DeferredStringCharFromCode(LCodeGen* codegen, |
| 4900 LStringCharFromCode* instr, | 4900 LStringCharFromCode* instr, |
| 4901 const X87Stack& x87_stack) | 4901 const X87Stack& x87_stack) |
| 4902 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4902 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4903 void Generate() OVERRIDE { | 4903 void Generate() override { |
| 4904 codegen()->DoDeferredStringCharFromCode(instr_); | 4904 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4905 } | 4905 } |
| 4906 LInstruction* instr() OVERRIDE { return instr_; } | 4906 LInstruction* instr() override { return instr_; } |
| 4907 | 4907 |
| 4908 private: | 4908 private: |
| 4909 LStringCharFromCode* instr_; | 4909 LStringCharFromCode* instr_; |
| 4910 }; | 4910 }; |
| 4911 | 4911 |
| 4912 DeferredStringCharFromCode* deferred = | 4912 DeferredStringCharFromCode* deferred = |
| 4913 new(zone()) DeferredStringCharFromCode(this, instr, x87_stack_); | 4913 new(zone()) DeferredStringCharFromCode(this, instr, x87_stack_); |
| 4914 | 4914 |
| 4915 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); | 4915 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); |
| 4916 Register char_code = ToRegister(instr->char_code()); | 4916 Register char_code = ToRegister(instr->char_code()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4977 LOperand* input = instr->value(); | 4977 LOperand* input = instr->value(); |
| 4978 LOperand* output = instr->result(); | 4978 LOperand* output = instr->result(); |
| 4979 X87Register res = ToX87Register(output); | 4979 X87Register res = ToX87Register(output); |
| 4980 X87PrepareToWrite(res); | 4980 X87PrepareToWrite(res); |
| 4981 __ LoadUint32NoSSE2(ToRegister(input)); | 4981 __ LoadUint32NoSSE2(ToRegister(input)); |
| 4982 X87CommitWrite(res); | 4982 X87CommitWrite(res); |
| 4983 } | 4983 } |
| 4984 | 4984 |
| 4985 | 4985 |
| 4986 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4986 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4987 class DeferredNumberTagI FINAL : public LDeferredCode { | 4987 class DeferredNumberTagI final : public LDeferredCode { |
| 4988 public: | 4988 public: |
| 4989 DeferredNumberTagI(LCodeGen* codegen, | 4989 DeferredNumberTagI(LCodeGen* codegen, |
| 4990 LNumberTagI* instr, | 4990 LNumberTagI* instr, |
| 4991 const X87Stack& x87_stack) | 4991 const X87Stack& x87_stack) |
| 4992 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4992 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4993 void Generate() OVERRIDE { | 4993 void Generate() override { |
| 4994 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), | 4994 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), |
| 4995 SIGNED_INT32); | 4995 SIGNED_INT32); |
| 4996 } | 4996 } |
| 4997 LInstruction* instr() OVERRIDE { return instr_; } | 4997 LInstruction* instr() override { return instr_; } |
| 4998 | 4998 |
| 4999 private: | 4999 private: |
| 5000 LNumberTagI* instr_; | 5000 LNumberTagI* instr_; |
| 5001 }; | 5001 }; |
| 5002 | 5002 |
| 5003 LOperand* input = instr->value(); | 5003 LOperand* input = instr->value(); |
| 5004 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 5004 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 5005 Register reg = ToRegister(input); | 5005 Register reg = ToRegister(input); |
| 5006 | 5006 |
| 5007 DeferredNumberTagI* deferred = | 5007 DeferredNumberTagI* deferred = |
| 5008 new(zone()) DeferredNumberTagI(this, instr, x87_stack_); | 5008 new(zone()) DeferredNumberTagI(this, instr, x87_stack_); |
| 5009 __ SmiTag(reg); | 5009 __ SmiTag(reg); |
| 5010 __ j(overflow, deferred->entry()); | 5010 __ j(overflow, deferred->entry()); |
| 5011 __ bind(deferred->exit()); | 5011 __ bind(deferred->exit()); |
| 5012 } | 5012 } |
| 5013 | 5013 |
| 5014 | 5014 |
| 5015 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 5015 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
| 5016 class DeferredNumberTagU FINAL : public LDeferredCode { | 5016 class DeferredNumberTagU final : public LDeferredCode { |
| 5017 public: | 5017 public: |
| 5018 DeferredNumberTagU(LCodeGen* codegen, | 5018 DeferredNumberTagU(LCodeGen* codegen, |
| 5019 LNumberTagU* instr, | 5019 LNumberTagU* instr, |
| 5020 const X87Stack& x87_stack) | 5020 const X87Stack& x87_stack) |
| 5021 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5021 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 5022 void Generate() OVERRIDE { | 5022 void Generate() override { |
| 5023 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), | 5023 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), |
| 5024 UNSIGNED_INT32); | 5024 UNSIGNED_INT32); |
| 5025 } | 5025 } |
| 5026 LInstruction* instr() OVERRIDE { return instr_; } | 5026 LInstruction* instr() override { return instr_; } |
| 5027 | 5027 |
| 5028 private: | 5028 private: |
| 5029 LNumberTagU* instr_; | 5029 LNumberTagU* instr_; |
| 5030 }; | 5030 }; |
| 5031 | 5031 |
| 5032 LOperand* input = instr->value(); | 5032 LOperand* input = instr->value(); |
| 5033 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 5033 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 5034 Register reg = ToRegister(input); | 5034 Register reg = ToRegister(input); |
| 5035 | 5035 |
| 5036 DeferredNumberTagU* deferred = | 5036 DeferredNumberTagU* deferred = |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5096 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 5096 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 5097 __ StoreToSafepointRegisterSlot(reg, eax); | 5097 __ StoreToSafepointRegisterSlot(reg, eax); |
| 5098 } | 5098 } |
| 5099 | 5099 |
| 5100 __ bind(&done); | 5100 __ bind(&done); |
| 5101 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 5101 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
| 5102 } | 5102 } |
| 5103 | 5103 |
| 5104 | 5104 |
| 5105 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 5105 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 5106 class DeferredNumberTagD FINAL : public LDeferredCode { | 5106 class DeferredNumberTagD final : public LDeferredCode { |
| 5107 public: | 5107 public: |
| 5108 DeferredNumberTagD(LCodeGen* codegen, | 5108 DeferredNumberTagD(LCodeGen* codegen, |
| 5109 LNumberTagD* instr, | 5109 LNumberTagD* instr, |
| 5110 const X87Stack& x87_stack) | 5110 const X87Stack& x87_stack) |
| 5111 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5111 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 5112 void Generate() OVERRIDE { codegen()->DoDeferredNumberTagD(instr_); } | 5112 void Generate() override { codegen()->DoDeferredNumberTagD(instr_); } |
| 5113 LInstruction* instr() OVERRIDE { return instr_; } | 5113 LInstruction* instr() override { return instr_; } |
| 5114 | 5114 |
| 5115 private: | 5115 private: |
| 5116 LNumberTagD* instr_; | 5116 LNumberTagD* instr_; |
| 5117 }; | 5117 }; |
| 5118 | 5118 |
| 5119 Register reg = ToRegister(instr->result()); | 5119 Register reg = ToRegister(instr->result()); |
| 5120 | 5120 |
| 5121 // Put the value to the top of stack | 5121 // Put the value to the top of stack |
| 5122 X87Register src = ToX87Register(instr->value()); | 5122 X87Register src = ToX87Register(instr->value()); |
| 5123 // Don't use X87LoadForUsage here, which is only used by Instruction which | 5123 // Don't use X87LoadForUsage here, which is only used by Instruction which |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5343 __ FCmp(); | 5343 __ FCmp(); |
| 5344 __ pop(input_reg); | 5344 __ pop(input_reg); |
| 5345 DeoptimizeIf(not_equal, instr, Deoptimizer::kLostPrecision); | 5345 DeoptimizeIf(not_equal, instr, Deoptimizer::kLostPrecision); |
| 5346 DeoptimizeIf(parity_even, instr, Deoptimizer::kNaN); | 5346 DeoptimizeIf(parity_even, instr, Deoptimizer::kNaN); |
| 5347 } | 5347 } |
| 5348 } | 5348 } |
| 5349 } | 5349 } |
| 5350 | 5350 |
| 5351 | 5351 |
| 5352 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 5352 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 5353 class DeferredTaggedToI FINAL : public LDeferredCode { | 5353 class DeferredTaggedToI final : public LDeferredCode { |
| 5354 public: | 5354 public: |
| 5355 DeferredTaggedToI(LCodeGen* codegen, | 5355 DeferredTaggedToI(LCodeGen* codegen, |
| 5356 LTaggedToI* instr, | 5356 LTaggedToI* instr, |
| 5357 const X87Stack& x87_stack) | 5357 const X87Stack& x87_stack) |
| 5358 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5358 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 5359 void Generate() OVERRIDE { codegen()->DoDeferredTaggedToI(instr_, done()); } | 5359 void Generate() override { codegen()->DoDeferredTaggedToI(instr_, done()); } |
| 5360 LInstruction* instr() OVERRIDE { return instr_; } | 5360 LInstruction* instr() override { return instr_; } |
| 5361 | 5361 |
| 5362 private: | 5362 private: |
| 5363 LTaggedToI* instr_; | 5363 LTaggedToI* instr_; |
| 5364 }; | 5364 }; |
| 5365 | 5365 |
| 5366 LOperand* input = instr->value(); | 5366 LOperand* input = instr->value(); |
| 5367 DCHECK(input->IsRegister()); | 5367 DCHECK(input->IsRegister()); |
| 5368 Register input_reg = ToRegister(input); | 5368 Register input_reg = ToRegister(input); |
| 5369 DCHECK(input_reg.is(ToRegister(instr->result()))); | 5369 DCHECK(input_reg.is(ToRegister(instr->result()))); |
| 5370 | 5370 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5544 RecordSafepointWithRegisters( | 5544 RecordSafepointWithRegisters( |
| 5545 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 5545 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 5546 | 5546 |
| 5547 __ test(eax, Immediate(kSmiTagMask)); | 5547 __ test(eax, Immediate(kSmiTagMask)); |
| 5548 } | 5548 } |
| 5549 DeoptimizeIf(zero, instr, Deoptimizer::kInstanceMigrationFailed); | 5549 DeoptimizeIf(zero, instr, Deoptimizer::kInstanceMigrationFailed); |
| 5550 } | 5550 } |
| 5551 | 5551 |
| 5552 | 5552 |
| 5553 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5553 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5554 class DeferredCheckMaps FINAL : public LDeferredCode { | 5554 class DeferredCheckMaps final : public LDeferredCode { |
| 5555 public: | 5555 public: |
| 5556 DeferredCheckMaps(LCodeGen* codegen, | 5556 DeferredCheckMaps(LCodeGen* codegen, |
| 5557 LCheckMaps* instr, | 5557 LCheckMaps* instr, |
| 5558 Register object, | 5558 Register object, |
| 5559 const X87Stack& x87_stack) | 5559 const X87Stack& x87_stack) |
| 5560 : LDeferredCode(codegen, x87_stack), instr_(instr), object_(object) { | 5560 : LDeferredCode(codegen, x87_stack), instr_(instr), object_(object) { |
| 5561 SetExit(check_maps()); | 5561 SetExit(check_maps()); |
| 5562 } | 5562 } |
| 5563 void Generate() OVERRIDE { | 5563 void Generate() override { |
| 5564 codegen()->DoDeferredInstanceMigration(instr_, object_); | 5564 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 5565 } | 5565 } |
| 5566 Label* check_maps() { return &check_maps_; } | 5566 Label* check_maps() { return &check_maps_; } |
| 5567 LInstruction* instr() OVERRIDE { return instr_; } | 5567 LInstruction* instr() override { return instr_; } |
| 5568 | 5568 |
| 5569 private: | 5569 private: |
| 5570 LCheckMaps* instr_; | 5570 LCheckMaps* instr_; |
| 5571 Label check_maps_; | 5571 Label check_maps_; |
| 5572 Register object_; | 5572 Register object_; |
| 5573 }; | 5573 }; |
| 5574 | 5574 |
| 5575 if (instr->hydrogen()->IsStabilityCheck()) { | 5575 if (instr->hydrogen()->IsStabilityCheck()) { |
| 5576 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); | 5576 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); |
| 5577 for (int i = 0; i < maps->size(); ++i) { | 5577 for (int i = 0; i < maps->size(); ++i) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5771 __ sub(esp, Immediate(kDoubleSize)); | 5771 __ sub(esp, Immediate(kDoubleSize)); |
| 5772 __ mov(Operand(esp, 0), lo_reg); | 5772 __ mov(Operand(esp, 0), lo_reg); |
| 5773 __ mov(Operand(esp, kPointerSize), hi_reg); | 5773 __ mov(Operand(esp, kPointerSize), hi_reg); |
| 5774 __ fld_d(Operand(esp, 0)); | 5774 __ fld_d(Operand(esp, 0)); |
| 5775 __ add(esp, Immediate(kDoubleSize)); | 5775 __ add(esp, Immediate(kDoubleSize)); |
| 5776 X87CommitWrite(result_reg); | 5776 X87CommitWrite(result_reg); |
| 5777 } | 5777 } |
| 5778 | 5778 |
| 5779 | 5779 |
| 5780 void LCodeGen::DoAllocate(LAllocate* instr) { | 5780 void LCodeGen::DoAllocate(LAllocate* instr) { |
| 5781 class DeferredAllocate FINAL : public LDeferredCode { | 5781 class DeferredAllocate final : public LDeferredCode { |
| 5782 public: | 5782 public: |
| 5783 DeferredAllocate(LCodeGen* codegen, | 5783 DeferredAllocate(LCodeGen* codegen, |
| 5784 LAllocate* instr, | 5784 LAllocate* instr, |
| 5785 const X87Stack& x87_stack) | 5785 const X87Stack& x87_stack) |
| 5786 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5786 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 5787 void Generate() OVERRIDE { codegen()->DoDeferredAllocate(instr_); } | 5787 void Generate() override { codegen()->DoDeferredAllocate(instr_); } |
| 5788 LInstruction* instr() OVERRIDE { return instr_; } | 5788 LInstruction* instr() override { return instr_; } |
| 5789 | 5789 |
| 5790 private: | 5790 private: |
| 5791 LAllocate* instr_; | 5791 LAllocate* instr_; |
| 5792 }; | 5792 }; |
| 5793 | 5793 |
| 5794 DeferredAllocate* deferred = | 5794 DeferredAllocate* deferred = |
| 5795 new(zone()) DeferredAllocate(this, instr, x87_stack_); | 5795 new(zone()) DeferredAllocate(this, instr, x87_stack_); |
| 5796 | 5796 |
| 5797 Register result = ToRegister(instr->result()); | 5797 Register result = ToRegister(instr->result()); |
| 5798 Register temp = ToRegister(instr->temp()); | 5798 Register temp = ToRegister(instr->temp()); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6131 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 6131 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
| 6132 RecordSafepointWithLazyDeopt( | 6132 RecordSafepointWithLazyDeopt( |
| 6133 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 6133 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 6134 DCHECK(instr->HasEnvironment()); | 6134 DCHECK(instr->HasEnvironment()); |
| 6135 LEnvironment* env = instr->environment(); | 6135 LEnvironment* env = instr->environment(); |
| 6136 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 6136 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 6137 } | 6137 } |
| 6138 | 6138 |
| 6139 | 6139 |
| 6140 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 6140 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 6141 class DeferredStackCheck FINAL : public LDeferredCode { | 6141 class DeferredStackCheck final : public LDeferredCode { |
| 6142 public: | 6142 public: |
| 6143 DeferredStackCheck(LCodeGen* codegen, | 6143 DeferredStackCheck(LCodeGen* codegen, |
| 6144 LStackCheck* instr, | 6144 LStackCheck* instr, |
| 6145 const X87Stack& x87_stack) | 6145 const X87Stack& x87_stack) |
| 6146 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 6146 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 6147 void Generate() OVERRIDE { codegen()->DoDeferredStackCheck(instr_); } | 6147 void Generate() override { codegen()->DoDeferredStackCheck(instr_); } |
| 6148 LInstruction* instr() OVERRIDE { return instr_; } | 6148 LInstruction* instr() override { return instr_; } |
| 6149 | 6149 |
| 6150 private: | 6150 private: |
| 6151 LStackCheck* instr_; | 6151 LStackCheck* instr_; |
| 6152 }; | 6152 }; |
| 6153 | 6153 |
| 6154 DCHECK(instr->HasEnvironment()); | 6154 DCHECK(instr->HasEnvironment()); |
| 6155 LEnvironment* env = instr->environment(); | 6155 LEnvironment* env = instr->environment(); |
| 6156 // There is no LLazyBailout instruction for stack-checks. We have to | 6156 // There is no LLazyBailout instruction for stack-checks. We have to |
| 6157 // prepare for lazy deoptimization explicitly here. | 6157 // prepare for lazy deoptimization explicitly here. |
| 6158 if (instr->hydrogen()->is_function_entry()) { | 6158 if (instr->hydrogen()->is_function_entry()) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6269 __ push(index); | 6269 __ push(index); |
| 6270 __ xor_(esi, esi); | 6270 __ xor_(esi, esi); |
| 6271 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); | 6271 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); |
| 6272 RecordSafepointWithRegisters( | 6272 RecordSafepointWithRegisters( |
| 6273 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); | 6273 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); |
| 6274 __ StoreToSafepointRegisterSlot(object, eax); | 6274 __ StoreToSafepointRegisterSlot(object, eax); |
| 6275 } | 6275 } |
| 6276 | 6276 |
| 6277 | 6277 |
| 6278 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 6278 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 6279 class DeferredLoadMutableDouble FINAL : public LDeferredCode { | 6279 class DeferredLoadMutableDouble final : public LDeferredCode { |
| 6280 public: | 6280 public: |
| 6281 DeferredLoadMutableDouble(LCodeGen* codegen, | 6281 DeferredLoadMutableDouble(LCodeGen* codegen, |
| 6282 LLoadFieldByIndex* instr, | 6282 LLoadFieldByIndex* instr, |
| 6283 Register object, | 6283 Register object, |
| 6284 Register index, | 6284 Register index, |
| 6285 const X87Stack& x87_stack) | 6285 const X87Stack& x87_stack) |
| 6286 : LDeferredCode(codegen, x87_stack), | 6286 : LDeferredCode(codegen, x87_stack), |
| 6287 instr_(instr), | 6287 instr_(instr), |
| 6288 object_(object), | 6288 object_(object), |
| 6289 index_(index) { | 6289 index_(index) { |
| 6290 } | 6290 } |
| 6291 void Generate() OVERRIDE { | 6291 void Generate() override { |
| 6292 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); | 6292 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); |
| 6293 } | 6293 } |
| 6294 LInstruction* instr() OVERRIDE { return instr_; } | 6294 LInstruction* instr() override { return instr_; } |
| 6295 | 6295 |
| 6296 private: | 6296 private: |
| 6297 LLoadFieldByIndex* instr_; | 6297 LLoadFieldByIndex* instr_; |
| 6298 Register object_; | 6298 Register object_; |
| 6299 Register index_; | 6299 Register index_; |
| 6300 }; | 6300 }; |
| 6301 | 6301 |
| 6302 Register object = ToRegister(instr->object()); | 6302 Register object = ToRegister(instr->object()); |
| 6303 Register index = ToRegister(instr->index()); | 6303 Register index = ToRegister(instr->index()); |
| 6304 | 6304 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6346 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6346 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6347 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6347 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6348 } | 6348 } |
| 6349 | 6349 |
| 6350 | 6350 |
| 6351 #undef __ | 6351 #undef __ |
| 6352 | 6352 |
| 6353 } } // namespace v8::internal | 6353 } } // namespace v8::internal |
| 6354 | 6354 |
| 6355 #endif // V8_TARGET_ARCH_X87 | 6355 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |