| 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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| 11 #include "src/deoptimizer.h" | 11 #include "src/deoptimizer.h" |
| 12 #include "src/hydrogen-osr.h" | 12 #include "src/hydrogen-osr.h" |
| 13 #include "src/x87/lithium-codegen-x87.h" | 13 #include "src/x87/lithium-codegen-x87.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 | 18 |
| 19 // When invoking builtins, we need to record the safepoint in the middle of | 19 // When invoking builtins, we need to record the safepoint in the middle of |
| 20 // the invoke instruction sequence generated by the macro assembler. | 20 // the invoke instruction sequence generated by the macro assembler. |
| 21 class SafepointGenerator V8_FINAL : public CallWrapper { | 21 class SafepointGenerator FINAL : public CallWrapper { |
| 22 public: | 22 public: |
| 23 SafepointGenerator(LCodeGen* codegen, | 23 SafepointGenerator(LCodeGen* codegen, |
| 24 LPointerMap* pointers, | 24 LPointerMap* pointers, |
| 25 Safepoint::DeoptMode mode) | 25 Safepoint::DeoptMode mode) |
| 26 : codegen_(codegen), | 26 : codegen_(codegen), |
| 27 pointers_(pointers), | 27 pointers_(pointers), |
| 28 deopt_mode_(mode) {} | 28 deopt_mode_(mode) {} |
| 29 virtual ~SafepointGenerator() {} | 29 virtual ~SafepointGenerator() {} |
| 30 | 30 |
| 31 virtual void BeforeCall(int call_size) const V8_OVERRIDE {} | 31 virtual void BeforeCall(int call_size) const OVERRIDE {} |
| 32 | 32 |
| 33 virtual void AfterCall() const V8_OVERRIDE { | 33 virtual void AfterCall() const OVERRIDE { |
| 34 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 34 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 LCodeGen* codegen_; | 38 LCodeGen* codegen_; |
| 39 LPointerMap* pointers_; | 39 LPointerMap* pointers_; |
| 40 Safepoint::DeoptMode deopt_mode_; | 40 Safepoint::DeoptMode deopt_mode_; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 | 43 |
| (...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 __ j(zero, &true_value, Label::kNear); | 2753 __ j(zero, &true_value, Label::kNear); |
| 2754 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2754 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2755 __ jmp(&done, Label::kNear); | 2755 __ jmp(&done, Label::kNear); |
| 2756 __ bind(&true_value); | 2756 __ bind(&true_value); |
| 2757 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2757 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2758 __ bind(&done); | 2758 __ bind(&done); |
| 2759 } | 2759 } |
| 2760 | 2760 |
| 2761 | 2761 |
| 2762 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2762 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| 2763 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { | 2763 class DeferredInstanceOfKnownGlobal FINAL : public LDeferredCode { |
| 2764 public: | 2764 public: |
| 2765 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2765 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
| 2766 LInstanceOfKnownGlobal* instr, | 2766 LInstanceOfKnownGlobal* instr, |
| 2767 const X87Stack& x87_stack) | 2767 const X87Stack& x87_stack) |
| 2768 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 2768 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 2769 virtual void Generate() V8_OVERRIDE { | 2769 virtual void Generate() OVERRIDE { |
| 2770 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2770 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
| 2771 } | 2771 } |
| 2772 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 2772 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 2773 Label* map_check() { return &map_check_; } | 2773 Label* map_check() { return &map_check_; } |
| 2774 private: | 2774 private: |
| 2775 LInstanceOfKnownGlobal* instr_; | 2775 LInstanceOfKnownGlobal* instr_; |
| 2776 Label map_check_; | 2776 Label map_check_; |
| 2777 }; | 2777 }; |
| 2778 | 2778 |
| 2779 DeferredInstanceOfKnownGlobal* deferred; | 2779 DeferredInstanceOfKnownGlobal* deferred; |
| 2780 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr, x87_stack_); | 2780 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr, x87_stack_); |
| 2781 | 2781 |
| 2782 Label done, false_result; | 2782 Label done, false_result; |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3678 Label is_positive; | 3678 Label is_positive; |
| 3679 __ j(not_sign, &is_positive, Label::kNear); | 3679 __ j(not_sign, &is_positive, Label::kNear); |
| 3680 __ neg(input_reg); // Sets flags. | 3680 __ neg(input_reg); // Sets flags. |
| 3681 DeoptimizeIf(negative, instr->environment()); | 3681 DeoptimizeIf(negative, instr->environment()); |
| 3682 __ bind(&is_positive); | 3682 __ bind(&is_positive); |
| 3683 } | 3683 } |
| 3684 | 3684 |
| 3685 | 3685 |
| 3686 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3686 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
| 3687 // Class for deferred case. | 3687 // Class for deferred case. |
| 3688 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { | 3688 class DeferredMathAbsTaggedHeapNumber FINAL : public LDeferredCode { |
| 3689 public: | 3689 public: |
| 3690 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, | 3690 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, |
| 3691 LMathAbs* instr, | 3691 LMathAbs* instr, |
| 3692 const X87Stack& x87_stack) | 3692 const X87Stack& x87_stack) |
| 3693 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 3693 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 3694 virtual void Generate() V8_OVERRIDE { | 3694 virtual void Generate() OVERRIDE { |
| 3695 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3695 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
| 3696 } | 3696 } |
| 3697 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3697 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 3698 private: | 3698 private: |
| 3699 LMathAbs* instr_; | 3699 LMathAbs* instr_; |
| 3700 }; | 3700 }; |
| 3701 | 3701 |
| 3702 DCHECK(instr->value()->Equals(instr->result())); | 3702 DCHECK(instr->value()->Equals(instr->result())); |
| 3703 Representation r = instr->hydrogen()->value()->representation(); | 3703 Representation r = instr->hydrogen()->value()->representation(); |
| 3704 | 3704 |
| 3705 if (r.IsDouble()) { | 3705 if (r.IsDouble()) { |
| 3706 UNIMPLEMENTED(); | 3706 UNIMPLEMENTED(); |
| 3707 } else if (r.IsSmiOrInteger32()) { | 3707 } else if (r.IsSmiOrInteger32()) { |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4239 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); | 4239 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); |
| 4240 __ CallStub(&stub); | 4240 __ CallStub(&stub); |
| 4241 RecordSafepointWithLazyDeopt(instr, | 4241 RecordSafepointWithLazyDeopt(instr, |
| 4242 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 4242 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 4243 } | 4243 } |
| 4244 __ bind(¬_applicable); | 4244 __ bind(¬_applicable); |
| 4245 } | 4245 } |
| 4246 | 4246 |
| 4247 | 4247 |
| 4248 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4248 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 4249 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { | 4249 class DeferredStringCharCodeAt FINAL : public LDeferredCode { |
| 4250 public: | 4250 public: |
| 4251 DeferredStringCharCodeAt(LCodeGen* codegen, | 4251 DeferredStringCharCodeAt(LCodeGen* codegen, |
| 4252 LStringCharCodeAt* instr, | 4252 LStringCharCodeAt* instr, |
| 4253 const X87Stack& x87_stack) | 4253 const X87Stack& x87_stack) |
| 4254 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4254 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4255 virtual void Generate() V8_OVERRIDE { | 4255 virtual void Generate() OVERRIDE { |
| 4256 codegen()->DoDeferredStringCharCodeAt(instr_); | 4256 codegen()->DoDeferredStringCharCodeAt(instr_); |
| 4257 } | 4257 } |
| 4258 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4258 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4259 private: | 4259 private: |
| 4260 LStringCharCodeAt* instr_; | 4260 LStringCharCodeAt* instr_; |
| 4261 }; | 4261 }; |
| 4262 | 4262 |
| 4263 DeferredStringCharCodeAt* deferred = | 4263 DeferredStringCharCodeAt* deferred = |
| 4264 new(zone()) DeferredStringCharCodeAt(this, instr, x87_stack_); | 4264 new(zone()) DeferredStringCharCodeAt(this, instr, x87_stack_); |
| 4265 | 4265 |
| 4266 StringCharLoadGenerator::Generate(masm(), | 4266 StringCharLoadGenerator::Generate(masm(), |
| 4267 factory(), | 4267 factory(), |
| 4268 ToRegister(instr->string()), | 4268 ToRegister(instr->string()), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4298 } | 4298 } |
| 4299 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, | 4299 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, |
| 4300 instr, instr->context()); | 4300 instr, instr->context()); |
| 4301 __ AssertSmi(eax); | 4301 __ AssertSmi(eax); |
| 4302 __ SmiUntag(eax); | 4302 __ SmiUntag(eax); |
| 4303 __ StoreToSafepointRegisterSlot(result, eax); | 4303 __ StoreToSafepointRegisterSlot(result, eax); |
| 4304 } | 4304 } |
| 4305 | 4305 |
| 4306 | 4306 |
| 4307 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4307 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
| 4308 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { | 4308 class DeferredStringCharFromCode FINAL : public LDeferredCode { |
| 4309 public: | 4309 public: |
| 4310 DeferredStringCharFromCode(LCodeGen* codegen, | 4310 DeferredStringCharFromCode(LCodeGen* codegen, |
| 4311 LStringCharFromCode* instr, | 4311 LStringCharFromCode* instr, |
| 4312 const X87Stack& x87_stack) | 4312 const X87Stack& x87_stack) |
| 4313 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4313 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4314 virtual void Generate() V8_OVERRIDE { | 4314 virtual void Generate() OVERRIDE { |
| 4315 codegen()->DoDeferredStringCharFromCode(instr_); | 4315 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4316 } | 4316 } |
| 4317 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4317 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4318 private: | 4318 private: |
| 4319 LStringCharFromCode* instr_; | 4319 LStringCharFromCode* instr_; |
| 4320 }; | 4320 }; |
| 4321 | 4321 |
| 4322 DeferredStringCharFromCode* deferred = | 4322 DeferredStringCharFromCode* deferred = |
| 4323 new(zone()) DeferredStringCharFromCode(this, instr, x87_stack_); | 4323 new(zone()) DeferredStringCharFromCode(this, instr, x87_stack_); |
| 4324 | 4324 |
| 4325 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); | 4325 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); |
| 4326 Register char_code = ToRegister(instr->char_code()); | 4326 Register char_code = ToRegister(instr->char_code()); |
| 4327 Register result = ToRegister(instr->result()); | 4327 Register result = ToRegister(instr->result()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 LOperand* input = instr->value(); | 4387 LOperand* input = instr->value(); |
| 4388 LOperand* output = instr->result(); | 4388 LOperand* output = instr->result(); |
| 4389 X87Register res = ToX87Register(output); | 4389 X87Register res = ToX87Register(output); |
| 4390 X87PrepareToWrite(res); | 4390 X87PrepareToWrite(res); |
| 4391 __ LoadUint32NoSSE2(ToRegister(input)); | 4391 __ LoadUint32NoSSE2(ToRegister(input)); |
| 4392 X87CommitWrite(res); | 4392 X87CommitWrite(res); |
| 4393 } | 4393 } |
| 4394 | 4394 |
| 4395 | 4395 |
| 4396 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4396 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4397 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4397 class DeferredNumberTagI FINAL : public LDeferredCode { |
| 4398 public: | 4398 public: |
| 4399 DeferredNumberTagI(LCodeGen* codegen, | 4399 DeferredNumberTagI(LCodeGen* codegen, |
| 4400 LNumberTagI* instr, | 4400 LNumberTagI* instr, |
| 4401 const X87Stack& x87_stack) | 4401 const X87Stack& x87_stack) |
| 4402 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4402 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4403 virtual void Generate() V8_OVERRIDE { | 4403 virtual void Generate() OVERRIDE { |
| 4404 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), | 4404 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), |
| 4405 SIGNED_INT32); | 4405 SIGNED_INT32); |
| 4406 } | 4406 } |
| 4407 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4407 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4408 private: | 4408 private: |
| 4409 LNumberTagI* instr_; | 4409 LNumberTagI* instr_; |
| 4410 }; | 4410 }; |
| 4411 | 4411 |
| 4412 LOperand* input = instr->value(); | 4412 LOperand* input = instr->value(); |
| 4413 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4413 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 4414 Register reg = ToRegister(input); | 4414 Register reg = ToRegister(input); |
| 4415 | 4415 |
| 4416 DeferredNumberTagI* deferred = | 4416 DeferredNumberTagI* deferred = |
| 4417 new(zone()) DeferredNumberTagI(this, instr, x87_stack_); | 4417 new(zone()) DeferredNumberTagI(this, instr, x87_stack_); |
| 4418 __ SmiTag(reg); | 4418 __ SmiTag(reg); |
| 4419 __ j(overflow, deferred->entry()); | 4419 __ j(overflow, deferred->entry()); |
| 4420 __ bind(deferred->exit()); | 4420 __ bind(deferred->exit()); |
| 4421 } | 4421 } |
| 4422 | 4422 |
| 4423 | 4423 |
| 4424 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4424 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
| 4425 class DeferredNumberTagU V8_FINAL : public LDeferredCode { | 4425 class DeferredNumberTagU FINAL : public LDeferredCode { |
| 4426 public: | 4426 public: |
| 4427 DeferredNumberTagU(LCodeGen* codegen, | 4427 DeferredNumberTagU(LCodeGen* codegen, |
| 4428 LNumberTagU* instr, | 4428 LNumberTagU* instr, |
| 4429 const X87Stack& x87_stack) | 4429 const X87Stack& x87_stack) |
| 4430 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4430 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4431 virtual void Generate() V8_OVERRIDE { | 4431 virtual void Generate() OVERRIDE { |
| 4432 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), | 4432 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp(), |
| 4433 UNSIGNED_INT32); | 4433 UNSIGNED_INT32); |
| 4434 } | 4434 } |
| 4435 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4435 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4436 private: | 4436 private: |
| 4437 LNumberTagU* instr_; | 4437 LNumberTagU* instr_; |
| 4438 }; | 4438 }; |
| 4439 | 4439 |
| 4440 LOperand* input = instr->value(); | 4440 LOperand* input = instr->value(); |
| 4441 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4441 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 4442 Register reg = ToRegister(input); | 4442 Register reg = ToRegister(input); |
| 4443 | 4443 |
| 4444 DeferredNumberTagU* deferred = | 4444 DeferredNumberTagU* deferred = |
| 4445 new(zone()) DeferredNumberTagU(this, instr, x87_stack_); | 4445 new(zone()) DeferredNumberTagU(this, instr, x87_stack_); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4504 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4504 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4505 __ StoreToSafepointRegisterSlot(reg, eax); | 4505 __ StoreToSafepointRegisterSlot(reg, eax); |
| 4506 } | 4506 } |
| 4507 | 4507 |
| 4508 __ bind(&done); | 4508 __ bind(&done); |
| 4509 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); | 4509 __ fstp_d(FieldOperand(reg, HeapNumber::kValueOffset)); |
| 4510 } | 4510 } |
| 4511 | 4511 |
| 4512 | 4512 |
| 4513 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4513 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 4514 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 4514 class DeferredNumberTagD FINAL : public LDeferredCode { |
| 4515 public: | 4515 public: |
| 4516 DeferredNumberTagD(LCodeGen* codegen, | 4516 DeferredNumberTagD(LCodeGen* codegen, |
| 4517 LNumberTagD* instr, | 4517 LNumberTagD* instr, |
| 4518 const X87Stack& x87_stack) | 4518 const X87Stack& x87_stack) |
| 4519 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4519 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4520 virtual void Generate() V8_OVERRIDE { | 4520 virtual void Generate() OVERRIDE { |
| 4521 codegen()->DoDeferredNumberTagD(instr_); | 4521 codegen()->DoDeferredNumberTagD(instr_); |
| 4522 } | 4522 } |
| 4523 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4523 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4524 private: | 4524 private: |
| 4525 LNumberTagD* instr_; | 4525 LNumberTagD* instr_; |
| 4526 }; | 4526 }; |
| 4527 | 4527 |
| 4528 Register reg = ToRegister(instr->result()); | 4528 Register reg = ToRegister(instr->result()); |
| 4529 | 4529 |
| 4530 // Put the value to the top of stack | 4530 // Put the value to the top of stack |
| 4531 X87Register src = ToX87Register(instr->value()); | 4531 X87Register src = ToX87Register(instr->value()); |
| 4532 X87LoadForUsage(src); | 4532 X87LoadForUsage(src); |
| 4533 | 4533 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4706 __ TaggedToI(input_reg, input_reg, | 4706 __ TaggedToI(input_reg, input_reg, |
| 4707 instr->hydrogen()->GetMinusZeroMode(), &bailout); | 4707 instr->hydrogen()->GetMinusZeroMode(), &bailout); |
| 4708 __ jmp(done); | 4708 __ jmp(done); |
| 4709 __ bind(&bailout); | 4709 __ bind(&bailout); |
| 4710 DeoptimizeIf(no_condition, instr->environment()); | 4710 DeoptimizeIf(no_condition, instr->environment()); |
| 4711 } | 4711 } |
| 4712 } | 4712 } |
| 4713 | 4713 |
| 4714 | 4714 |
| 4715 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4715 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4716 class DeferredTaggedToI V8_FINAL : public LDeferredCode { | 4716 class DeferredTaggedToI FINAL : public LDeferredCode { |
| 4717 public: | 4717 public: |
| 4718 DeferredTaggedToI(LCodeGen* codegen, | 4718 DeferredTaggedToI(LCodeGen* codegen, |
| 4719 LTaggedToI* instr, | 4719 LTaggedToI* instr, |
| 4720 const X87Stack& x87_stack) | 4720 const X87Stack& x87_stack) |
| 4721 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 4721 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 4722 virtual void Generate() V8_OVERRIDE { | 4722 virtual void Generate() OVERRIDE { |
| 4723 codegen()->DoDeferredTaggedToI(instr_, done()); | 4723 codegen()->DoDeferredTaggedToI(instr_, done()); |
| 4724 } | 4724 } |
| 4725 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4725 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4726 private: | 4726 private: |
| 4727 LTaggedToI* instr_; | 4727 LTaggedToI* instr_; |
| 4728 }; | 4728 }; |
| 4729 | 4729 |
| 4730 LOperand* input = instr->value(); | 4730 LOperand* input = instr->value(); |
| 4731 DCHECK(input->IsRegister()); | 4731 DCHECK(input->IsRegister()); |
| 4732 Register input_reg = ToRegister(input); | 4732 Register input_reg = ToRegister(input); |
| 4733 DCHECK(input_reg.is(ToRegister(instr->result()))); | 4733 DCHECK(input_reg.is(ToRegister(instr->result()))); |
| 4734 | 4734 |
| 4735 if (instr->hydrogen()->value()->representation().IsSmi()) { | 4735 if (instr->hydrogen()->value()->representation().IsSmi()) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4907 RecordSafepointWithRegisters( | 4907 RecordSafepointWithRegisters( |
| 4908 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 4908 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 4909 | 4909 |
| 4910 __ test(eax, Immediate(kSmiTagMask)); | 4910 __ test(eax, Immediate(kSmiTagMask)); |
| 4911 } | 4911 } |
| 4912 DeoptimizeIf(zero, instr->environment()); | 4912 DeoptimizeIf(zero, instr->environment()); |
| 4913 } | 4913 } |
| 4914 | 4914 |
| 4915 | 4915 |
| 4916 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 4916 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 4917 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 4917 class DeferredCheckMaps FINAL : public LDeferredCode { |
| 4918 public: | 4918 public: |
| 4919 DeferredCheckMaps(LCodeGen* codegen, | 4919 DeferredCheckMaps(LCodeGen* codegen, |
| 4920 LCheckMaps* instr, | 4920 LCheckMaps* instr, |
| 4921 Register object, | 4921 Register object, |
| 4922 const X87Stack& x87_stack) | 4922 const X87Stack& x87_stack) |
| 4923 : LDeferredCode(codegen, x87_stack), instr_(instr), object_(object) { | 4923 : LDeferredCode(codegen, x87_stack), instr_(instr), object_(object) { |
| 4924 SetExit(check_maps()); | 4924 SetExit(check_maps()); |
| 4925 } | 4925 } |
| 4926 virtual void Generate() V8_OVERRIDE { | 4926 virtual void Generate() OVERRIDE { |
| 4927 codegen()->DoDeferredInstanceMigration(instr_, object_); | 4927 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 4928 } | 4928 } |
| 4929 Label* check_maps() { return &check_maps_; } | 4929 Label* check_maps() { return &check_maps_; } |
| 4930 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4930 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4931 private: | 4931 private: |
| 4932 LCheckMaps* instr_; | 4932 LCheckMaps* instr_; |
| 4933 Label check_maps_; | 4933 Label check_maps_; |
| 4934 Register object_; | 4934 Register object_; |
| 4935 }; | 4935 }; |
| 4936 | 4936 |
| 4937 if (instr->hydrogen()->IsStabilityCheck()) { | 4937 if (instr->hydrogen()->IsStabilityCheck()) { |
| 4938 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); | 4938 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); |
| 4939 for (int i = 0; i < maps->size(); ++i) { | 4939 for (int i = 0; i < maps->size(); ++i) { |
| 4940 AddStabilityDependency(maps->at(i).handle()); | 4940 AddStabilityDependency(maps->at(i).handle()); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5110 UNREACHABLE(); | 5110 UNREACHABLE(); |
| 5111 } | 5111 } |
| 5112 | 5112 |
| 5113 | 5113 |
| 5114 void LCodeGen::DoConstructDouble(LConstructDouble* instr) { | 5114 void LCodeGen::DoConstructDouble(LConstructDouble* instr) { |
| 5115 UNREACHABLE(); | 5115 UNREACHABLE(); |
| 5116 } | 5116 } |
| 5117 | 5117 |
| 5118 | 5118 |
| 5119 void LCodeGen::DoAllocate(LAllocate* instr) { | 5119 void LCodeGen::DoAllocate(LAllocate* instr) { |
| 5120 class DeferredAllocate V8_FINAL : public LDeferredCode { | 5120 class DeferredAllocate FINAL : public LDeferredCode { |
| 5121 public: | 5121 public: |
| 5122 DeferredAllocate(LCodeGen* codegen, | 5122 DeferredAllocate(LCodeGen* codegen, |
| 5123 LAllocate* instr, | 5123 LAllocate* instr, |
| 5124 const X87Stack& x87_stack) | 5124 const X87Stack& x87_stack) |
| 5125 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5125 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 5126 virtual void Generate() V8_OVERRIDE { | 5126 virtual void Generate() OVERRIDE { |
| 5127 codegen()->DoDeferredAllocate(instr_); | 5127 codegen()->DoDeferredAllocate(instr_); |
| 5128 } | 5128 } |
| 5129 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5129 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 5130 private: | 5130 private: |
| 5131 LAllocate* instr_; | 5131 LAllocate* instr_; |
| 5132 }; | 5132 }; |
| 5133 | 5133 |
| 5134 DeferredAllocate* deferred = | 5134 DeferredAllocate* deferred = |
| 5135 new(zone()) DeferredAllocate(this, instr, x87_stack_); | 5135 new(zone()) DeferredAllocate(this, instr, x87_stack_); |
| 5136 | 5136 |
| 5137 Register result = ToRegister(instr->result()); | 5137 Register result = ToRegister(instr->result()); |
| 5138 Register temp = ToRegister(instr->temp()); | 5138 Register temp = ToRegister(instr->temp()); |
| 5139 | 5139 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5481 __ CallRuntime(Runtime::kStackGuard); | 5481 __ CallRuntime(Runtime::kStackGuard); |
| 5482 RecordSafepointWithLazyDeopt( | 5482 RecordSafepointWithLazyDeopt( |
| 5483 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5483 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 5484 DCHECK(instr->HasEnvironment()); | 5484 DCHECK(instr->HasEnvironment()); |
| 5485 LEnvironment* env = instr->environment(); | 5485 LEnvironment* env = instr->environment(); |
| 5486 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5486 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5487 } | 5487 } |
| 5488 | 5488 |
| 5489 | 5489 |
| 5490 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5490 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 5491 class DeferredStackCheck V8_FINAL : public LDeferredCode { | 5491 class DeferredStackCheck FINAL : public LDeferredCode { |
| 5492 public: | 5492 public: |
| 5493 DeferredStackCheck(LCodeGen* codegen, | 5493 DeferredStackCheck(LCodeGen* codegen, |
| 5494 LStackCheck* instr, | 5494 LStackCheck* instr, |
| 5495 const X87Stack& x87_stack) | 5495 const X87Stack& x87_stack) |
| 5496 : LDeferredCode(codegen, x87_stack), instr_(instr) { } | 5496 : LDeferredCode(codegen, x87_stack), instr_(instr) { } |
| 5497 virtual void Generate() V8_OVERRIDE { | 5497 virtual void Generate() OVERRIDE { |
| 5498 codegen()->DoDeferredStackCheck(instr_); | 5498 codegen()->DoDeferredStackCheck(instr_); |
| 5499 } | 5499 } |
| 5500 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5500 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 5501 private: | 5501 private: |
| 5502 LStackCheck* instr_; | 5502 LStackCheck* instr_; |
| 5503 }; | 5503 }; |
| 5504 | 5504 |
| 5505 DCHECK(instr->HasEnvironment()); | 5505 DCHECK(instr->HasEnvironment()); |
| 5506 LEnvironment* env = instr->environment(); | 5506 LEnvironment* env = instr->environment(); |
| 5507 // There is no LLazyBailout instruction for stack-checks. We have to | 5507 // There is no LLazyBailout instruction for stack-checks. We have to |
| 5508 // prepare for lazy deoptimization explicitly here. | 5508 // prepare for lazy deoptimization explicitly here. |
| 5509 if (instr->hydrogen()->is_function_entry()) { | 5509 if (instr->hydrogen()->is_function_entry()) { |
| 5510 // Perform stack overflow check. | 5510 // Perform stack overflow check. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5626 __ push(index); | 5626 __ push(index); |
| 5627 __ xor_(esi, esi); | 5627 __ xor_(esi, esi); |
| 5628 __ CallRuntime(Runtime::kLoadMutableDouble); | 5628 __ CallRuntime(Runtime::kLoadMutableDouble); |
| 5629 RecordSafepointWithRegisters( | 5629 RecordSafepointWithRegisters( |
| 5630 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); | 5630 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); |
| 5631 __ StoreToSafepointRegisterSlot(object, eax); | 5631 __ StoreToSafepointRegisterSlot(object, eax); |
| 5632 } | 5632 } |
| 5633 | 5633 |
| 5634 | 5634 |
| 5635 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5635 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 5636 class DeferredLoadMutableDouble V8_FINAL : public LDeferredCode { | 5636 class DeferredLoadMutableDouble FINAL : public LDeferredCode { |
| 5637 public: | 5637 public: |
| 5638 DeferredLoadMutableDouble(LCodeGen* codegen, | 5638 DeferredLoadMutableDouble(LCodeGen* codegen, |
| 5639 LLoadFieldByIndex* instr, | 5639 LLoadFieldByIndex* instr, |
| 5640 Register object, | 5640 Register object, |
| 5641 Register index, | 5641 Register index, |
| 5642 const X87Stack& x87_stack) | 5642 const X87Stack& x87_stack) |
| 5643 : LDeferredCode(codegen, x87_stack), | 5643 : LDeferredCode(codegen, x87_stack), |
| 5644 instr_(instr), | 5644 instr_(instr), |
| 5645 object_(object), | 5645 object_(object), |
| 5646 index_(index) { | 5646 index_(index) { |
| 5647 } | 5647 } |
| 5648 virtual void Generate() V8_OVERRIDE { | 5648 virtual void Generate() OVERRIDE { |
| 5649 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); | 5649 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); |
| 5650 } | 5650 } |
| 5651 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5651 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 5652 private: | 5652 private: |
| 5653 LLoadFieldByIndex* instr_; | 5653 LLoadFieldByIndex* instr_; |
| 5654 Register object_; | 5654 Register object_; |
| 5655 Register index_; | 5655 Register index_; |
| 5656 }; | 5656 }; |
| 5657 | 5657 |
| 5658 Register object = ToRegister(instr->object()); | 5658 Register object = ToRegister(instr->object()); |
| 5659 Register index = ToRegister(instr->index()); | 5659 Register index = ToRegister(instr->index()); |
| 5660 | 5660 |
| 5661 DeferredLoadMutableDouble* deferred; | 5661 DeferredLoadMutableDouble* deferred; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5702 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5702 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5703 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5703 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5704 } | 5704 } |
| 5705 | 5705 |
| 5706 | 5706 |
| 5707 #undef __ | 5707 #undef __ |
| 5708 | 5708 |
| 5709 } } // namespace v8::internal | 5709 } } // namespace v8::internal |
| 5710 | 5710 |
| 5711 #endif // V8_TARGET_ARCH_X87 | 5711 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |