| 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/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/ia32/lithium-codegen-ia32.h" | 13 #include "src/ia32/lithium-codegen-ia32.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 // When invoking builtins, we need to record the safepoint in the middle of | 18 // When invoking builtins, we need to record the safepoint in the middle of |
| 19 // the invoke instruction sequence generated by the macro assembler. | 19 // the invoke instruction sequence generated by the macro assembler. |
| 20 class SafepointGenerator V8_FINAL : public CallWrapper { | 20 class SafepointGenerator FINAL : public CallWrapper { |
| 21 public: | 21 public: |
| 22 SafepointGenerator(LCodeGen* codegen, | 22 SafepointGenerator(LCodeGen* codegen, |
| 23 LPointerMap* pointers, | 23 LPointerMap* pointers, |
| 24 Safepoint::DeoptMode mode) | 24 Safepoint::DeoptMode mode) |
| 25 : codegen_(codegen), | 25 : codegen_(codegen), |
| 26 pointers_(pointers), | 26 pointers_(pointers), |
| 27 deopt_mode_(mode) {} | 27 deopt_mode_(mode) {} |
| 28 virtual ~SafepointGenerator() {} | 28 virtual ~SafepointGenerator() {} |
| 29 | 29 |
| 30 virtual void BeforeCall(int call_size) const V8_OVERRIDE {} | 30 virtual void BeforeCall(int call_size) const OVERRIDE {} |
| 31 | 31 |
| 32 virtual void AfterCall() const V8_OVERRIDE { | 32 virtual void AfterCall() const OVERRIDE { |
| 33 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 33 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
| 34 } | 34 } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 LCodeGen* codegen_; | 37 LCodeGen* codegen_; |
| 38 LPointerMap* pointers_; | 38 LPointerMap* pointers_; |
| 39 Safepoint::DeoptMode deopt_mode_; | 39 Safepoint::DeoptMode deopt_mode_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 | 42 |
| (...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 __ j(zero, &true_value, Label::kNear); | 2618 __ j(zero, &true_value, Label::kNear); |
| 2619 __ mov(ToRegister(instr->result()), factory()->false_value()); | 2619 __ mov(ToRegister(instr->result()), factory()->false_value()); |
| 2620 __ jmp(&done, Label::kNear); | 2620 __ jmp(&done, Label::kNear); |
| 2621 __ bind(&true_value); | 2621 __ bind(&true_value); |
| 2622 __ mov(ToRegister(instr->result()), factory()->true_value()); | 2622 __ mov(ToRegister(instr->result()), factory()->true_value()); |
| 2623 __ bind(&done); | 2623 __ bind(&done); |
| 2624 } | 2624 } |
| 2625 | 2625 |
| 2626 | 2626 |
| 2627 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2627 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| 2628 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { | 2628 class DeferredInstanceOfKnownGlobal FINAL : public LDeferredCode { |
| 2629 public: | 2629 public: |
| 2630 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2630 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
| 2631 LInstanceOfKnownGlobal* instr) | 2631 LInstanceOfKnownGlobal* instr) |
| 2632 : LDeferredCode(codegen), instr_(instr) { } | 2632 : LDeferredCode(codegen), instr_(instr) { } |
| 2633 virtual void Generate() V8_OVERRIDE { | 2633 virtual void Generate() OVERRIDE { |
| 2634 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2634 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
| 2635 } | 2635 } |
| 2636 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 2636 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 2637 Label* map_check() { return &map_check_; } | 2637 Label* map_check() { return &map_check_; } |
| 2638 private: | 2638 private: |
| 2639 LInstanceOfKnownGlobal* instr_; | 2639 LInstanceOfKnownGlobal* instr_; |
| 2640 Label map_check_; | 2640 Label map_check_; |
| 2641 }; | 2641 }; |
| 2642 | 2642 |
| 2643 DeferredInstanceOfKnownGlobal* deferred; | 2643 DeferredInstanceOfKnownGlobal* deferred; |
| 2644 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2644 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
| 2645 | 2645 |
| 2646 Label done, false_result; | 2646 Label done, false_result; |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3548 Label is_positive; | 3548 Label is_positive; |
| 3549 __ j(not_sign, &is_positive, Label::kNear); | 3549 __ j(not_sign, &is_positive, Label::kNear); |
| 3550 __ neg(input_reg); // Sets flags. | 3550 __ neg(input_reg); // Sets flags. |
| 3551 DeoptimizeIf(negative, instr->environment()); | 3551 DeoptimizeIf(negative, instr->environment()); |
| 3552 __ bind(&is_positive); | 3552 __ bind(&is_positive); |
| 3553 } | 3553 } |
| 3554 | 3554 |
| 3555 | 3555 |
| 3556 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3556 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
| 3557 // Class for deferred case. | 3557 // Class for deferred case. |
| 3558 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { | 3558 class DeferredMathAbsTaggedHeapNumber FINAL : public LDeferredCode { |
| 3559 public: | 3559 public: |
| 3560 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, | 3560 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, |
| 3561 LMathAbs* instr) | 3561 LMathAbs* instr) |
| 3562 : LDeferredCode(codegen), instr_(instr) { } | 3562 : LDeferredCode(codegen), instr_(instr) { } |
| 3563 virtual void Generate() V8_OVERRIDE { | 3563 virtual void Generate() OVERRIDE { |
| 3564 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3564 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
| 3565 } | 3565 } |
| 3566 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3566 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 3567 private: | 3567 private: |
| 3568 LMathAbs* instr_; | 3568 LMathAbs* instr_; |
| 3569 }; | 3569 }; |
| 3570 | 3570 |
| 3571 DCHECK(instr->value()->Equals(instr->result())); | 3571 DCHECK(instr->value()->Equals(instr->result())); |
| 3572 Representation r = instr->hydrogen()->value()->representation(); | 3572 Representation r = instr->hydrogen()->value()->representation(); |
| 3573 | 3573 |
| 3574 if (r.IsDouble()) { | 3574 if (r.IsDouble()) { |
| 3575 XMMRegister scratch = double_scratch0(); | 3575 XMMRegister scratch = double_scratch0(); |
| 3576 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3576 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4304 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); | 4304 TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); |
| 4305 __ CallStub(&stub); | 4305 __ CallStub(&stub); |
| 4306 RecordSafepointWithLazyDeopt(instr, | 4306 RecordSafepointWithLazyDeopt(instr, |
| 4307 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 4307 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 4308 } | 4308 } |
| 4309 __ bind(¬_applicable); | 4309 __ bind(¬_applicable); |
| 4310 } | 4310 } |
| 4311 | 4311 |
| 4312 | 4312 |
| 4313 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4313 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 4314 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { | 4314 class DeferredStringCharCodeAt FINAL : public LDeferredCode { |
| 4315 public: | 4315 public: |
| 4316 DeferredStringCharCodeAt(LCodeGen* codegen, | 4316 DeferredStringCharCodeAt(LCodeGen* codegen, |
| 4317 LStringCharCodeAt* instr) | 4317 LStringCharCodeAt* instr) |
| 4318 : LDeferredCode(codegen), instr_(instr) { } | 4318 : LDeferredCode(codegen), instr_(instr) { } |
| 4319 virtual void Generate() V8_OVERRIDE { | 4319 virtual void Generate() OVERRIDE { |
| 4320 codegen()->DoDeferredStringCharCodeAt(instr_); | 4320 codegen()->DoDeferredStringCharCodeAt(instr_); |
| 4321 } | 4321 } |
| 4322 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4322 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4323 private: | 4323 private: |
| 4324 LStringCharCodeAt* instr_; | 4324 LStringCharCodeAt* instr_; |
| 4325 }; | 4325 }; |
| 4326 | 4326 |
| 4327 DeferredStringCharCodeAt* deferred = | 4327 DeferredStringCharCodeAt* deferred = |
| 4328 new(zone()) DeferredStringCharCodeAt(this, instr); | 4328 new(zone()) DeferredStringCharCodeAt(this, instr); |
| 4329 | 4329 |
| 4330 StringCharLoadGenerator::Generate(masm(), | 4330 StringCharLoadGenerator::Generate(masm(), |
| 4331 factory(), | 4331 factory(), |
| 4332 ToRegister(instr->string()), | 4332 ToRegister(instr->string()), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4362 } | 4362 } |
| 4363 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, | 4363 CallRuntimeFromDeferred(Runtime::kStringCharCodeAtRT, 2, |
| 4364 instr, instr->context()); | 4364 instr, instr->context()); |
| 4365 __ AssertSmi(eax); | 4365 __ AssertSmi(eax); |
| 4366 __ SmiUntag(eax); | 4366 __ SmiUntag(eax); |
| 4367 __ StoreToSafepointRegisterSlot(result, eax); | 4367 __ StoreToSafepointRegisterSlot(result, eax); |
| 4368 } | 4368 } |
| 4369 | 4369 |
| 4370 | 4370 |
| 4371 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4371 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
| 4372 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { | 4372 class DeferredStringCharFromCode FINAL : public LDeferredCode { |
| 4373 public: | 4373 public: |
| 4374 DeferredStringCharFromCode(LCodeGen* codegen, | 4374 DeferredStringCharFromCode(LCodeGen* codegen, |
| 4375 LStringCharFromCode* instr) | 4375 LStringCharFromCode* instr) |
| 4376 : LDeferredCode(codegen), instr_(instr) { } | 4376 : LDeferredCode(codegen), instr_(instr) { } |
| 4377 virtual void Generate() V8_OVERRIDE { | 4377 virtual void Generate() OVERRIDE { |
| 4378 codegen()->DoDeferredStringCharFromCode(instr_); | 4378 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4379 } | 4379 } |
| 4380 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4380 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4381 private: | 4381 private: |
| 4382 LStringCharFromCode* instr_; | 4382 LStringCharFromCode* instr_; |
| 4383 }; | 4383 }; |
| 4384 | 4384 |
| 4385 DeferredStringCharFromCode* deferred = | 4385 DeferredStringCharFromCode* deferred = |
| 4386 new(zone()) DeferredStringCharFromCode(this, instr); | 4386 new(zone()) DeferredStringCharFromCode(this, instr); |
| 4387 | 4387 |
| 4388 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); | 4388 DCHECK(instr->hydrogen()->value()->representation().IsInteger32()); |
| 4389 Register char_code = ToRegister(instr->char_code()); | 4389 Register char_code = ToRegister(instr->char_code()); |
| 4390 Register result = ToRegister(instr->result()); | 4390 Register result = ToRegister(instr->result()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4440 | 4440 |
| 4441 | 4441 |
| 4442 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4442 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
| 4443 LOperand* input = instr->value(); | 4443 LOperand* input = instr->value(); |
| 4444 LOperand* output = instr->result(); | 4444 LOperand* output = instr->result(); |
| 4445 __ LoadUint32(ToDoubleRegister(output), ToRegister(input)); | 4445 __ LoadUint32(ToDoubleRegister(output), ToRegister(input)); |
| 4446 } | 4446 } |
| 4447 | 4447 |
| 4448 | 4448 |
| 4449 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4449 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4450 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4450 class DeferredNumberTagI FINAL : public LDeferredCode { |
| 4451 public: | 4451 public: |
| 4452 DeferredNumberTagI(LCodeGen* codegen, | 4452 DeferredNumberTagI(LCodeGen* codegen, |
| 4453 LNumberTagI* instr) | 4453 LNumberTagI* instr) |
| 4454 : LDeferredCode(codegen), instr_(instr) { } | 4454 : LDeferredCode(codegen), instr_(instr) { } |
| 4455 virtual void Generate() V8_OVERRIDE { | 4455 virtual void Generate() OVERRIDE { |
| 4456 codegen()->DoDeferredNumberTagIU( | 4456 codegen()->DoDeferredNumberTagIU( |
| 4457 instr_, instr_->value(), instr_->temp(), SIGNED_INT32); | 4457 instr_, instr_->value(), instr_->temp(), SIGNED_INT32); |
| 4458 } | 4458 } |
| 4459 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4459 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4460 private: | 4460 private: |
| 4461 LNumberTagI* instr_; | 4461 LNumberTagI* instr_; |
| 4462 }; | 4462 }; |
| 4463 | 4463 |
| 4464 LOperand* input = instr->value(); | 4464 LOperand* input = instr->value(); |
| 4465 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4465 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 4466 Register reg = ToRegister(input); | 4466 Register reg = ToRegister(input); |
| 4467 | 4467 |
| 4468 DeferredNumberTagI* deferred = | 4468 DeferredNumberTagI* deferred = |
| 4469 new(zone()) DeferredNumberTagI(this, instr); | 4469 new(zone()) DeferredNumberTagI(this, instr); |
| 4470 __ SmiTag(reg); | 4470 __ SmiTag(reg); |
| 4471 __ j(overflow, deferred->entry()); | 4471 __ j(overflow, deferred->entry()); |
| 4472 __ bind(deferred->exit()); | 4472 __ bind(deferred->exit()); |
| 4473 } | 4473 } |
| 4474 | 4474 |
| 4475 | 4475 |
| 4476 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4476 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
| 4477 class DeferredNumberTagU V8_FINAL : public LDeferredCode { | 4477 class DeferredNumberTagU FINAL : public LDeferredCode { |
| 4478 public: | 4478 public: |
| 4479 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4479 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
| 4480 : LDeferredCode(codegen), instr_(instr) { } | 4480 : LDeferredCode(codegen), instr_(instr) { } |
| 4481 virtual void Generate() V8_OVERRIDE { | 4481 virtual void Generate() OVERRIDE { |
| 4482 codegen()->DoDeferredNumberTagIU( | 4482 codegen()->DoDeferredNumberTagIU( |
| 4483 instr_, instr_->value(), instr_->temp(), UNSIGNED_INT32); | 4483 instr_, instr_->value(), instr_->temp(), UNSIGNED_INT32); |
| 4484 } | 4484 } |
| 4485 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4485 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4486 private: | 4486 private: |
| 4487 LNumberTagU* instr_; | 4487 LNumberTagU* instr_; |
| 4488 }; | 4488 }; |
| 4489 | 4489 |
| 4490 LOperand* input = instr->value(); | 4490 LOperand* input = instr->value(); |
| 4491 DCHECK(input->IsRegister() && input->Equals(instr->result())); | 4491 DCHECK(input->IsRegister() && input->Equals(instr->result())); |
| 4492 Register reg = ToRegister(input); | 4492 Register reg = ToRegister(input); |
| 4493 | 4493 |
| 4494 DeferredNumberTagU* deferred = | 4494 DeferredNumberTagU* deferred = |
| 4495 new(zone()) DeferredNumberTagU(this, instr); | 4495 new(zone()) DeferredNumberTagU(this, instr); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4549 } | 4549 } |
| 4550 | 4550 |
| 4551 // Done. Put the value in xmm_scratch into the value of the allocated heap | 4551 // Done. Put the value in xmm_scratch into the value of the allocated heap |
| 4552 // number. | 4552 // number. |
| 4553 __ bind(&done); | 4553 __ bind(&done); |
| 4554 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm_scratch); | 4554 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm_scratch); |
| 4555 } | 4555 } |
| 4556 | 4556 |
| 4557 | 4557 |
| 4558 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4558 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 4559 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 4559 class DeferredNumberTagD FINAL : public LDeferredCode { |
| 4560 public: | 4560 public: |
| 4561 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4561 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 4562 : LDeferredCode(codegen), instr_(instr) { } | 4562 : LDeferredCode(codegen), instr_(instr) { } |
| 4563 virtual void Generate() V8_OVERRIDE { | 4563 virtual void Generate() OVERRIDE { |
| 4564 codegen()->DoDeferredNumberTagD(instr_); | 4564 codegen()->DoDeferredNumberTagD(instr_); |
| 4565 } | 4565 } |
| 4566 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4566 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4567 private: | 4567 private: |
| 4568 LNumberTagD* instr_; | 4568 LNumberTagD* instr_; |
| 4569 }; | 4569 }; |
| 4570 | 4570 |
| 4571 Register reg = ToRegister(instr->result()); | 4571 Register reg = ToRegister(instr->result()); |
| 4572 | 4572 |
| 4573 DeferredNumberTagD* deferred = | 4573 DeferredNumberTagD* deferred = |
| 4574 new(zone()) DeferredNumberTagD(this, instr); | 4574 new(zone()) DeferredNumberTagD(this, instr); |
| 4575 if (FLAG_inline_new) { | 4575 if (FLAG_inline_new) { |
| 4576 Register tmp = ToRegister(instr->temp()); | 4576 Register tmp = ToRegister(instr->temp()); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4741 __ TaggedToI(input_reg, input_reg, scratch, | 4741 __ TaggedToI(input_reg, input_reg, scratch, |
| 4742 instr->hydrogen()->GetMinusZeroMode(), &bailout); | 4742 instr->hydrogen()->GetMinusZeroMode(), &bailout); |
| 4743 __ jmp(done); | 4743 __ jmp(done); |
| 4744 __ bind(&bailout); | 4744 __ bind(&bailout); |
| 4745 DeoptimizeIf(no_condition, instr->environment()); | 4745 DeoptimizeIf(no_condition, instr->environment()); |
| 4746 } | 4746 } |
| 4747 } | 4747 } |
| 4748 | 4748 |
| 4749 | 4749 |
| 4750 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4750 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4751 class DeferredTaggedToI V8_FINAL : public LDeferredCode { | 4751 class DeferredTaggedToI FINAL : public LDeferredCode { |
| 4752 public: | 4752 public: |
| 4753 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4753 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
| 4754 : LDeferredCode(codegen), instr_(instr) { } | 4754 : LDeferredCode(codegen), instr_(instr) { } |
| 4755 virtual void Generate() V8_OVERRIDE { | 4755 virtual void Generate() OVERRIDE { |
| 4756 codegen()->DoDeferredTaggedToI(instr_, done()); | 4756 codegen()->DoDeferredTaggedToI(instr_, done()); |
| 4757 } | 4757 } |
| 4758 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4758 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4759 private: | 4759 private: |
| 4760 LTaggedToI* instr_; | 4760 LTaggedToI* instr_; |
| 4761 }; | 4761 }; |
| 4762 | 4762 |
| 4763 LOperand* input = instr->value(); | 4763 LOperand* input = instr->value(); |
| 4764 DCHECK(input->IsRegister()); | 4764 DCHECK(input->IsRegister()); |
| 4765 Register input_reg = ToRegister(input); | 4765 Register input_reg = ToRegister(input); |
| 4766 DCHECK(input_reg.is(ToRegister(instr->result()))); | 4766 DCHECK(input_reg.is(ToRegister(instr->result()))); |
| 4767 | 4767 |
| 4768 if (instr->hydrogen()->value()->representation().IsSmi()) { | 4768 if (instr->hydrogen()->value()->representation().IsSmi()) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4940 RecordSafepointWithRegisters( | 4940 RecordSafepointWithRegisters( |
| 4941 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); | 4941 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 4942 | 4942 |
| 4943 __ test(eax, Immediate(kSmiTagMask)); | 4943 __ test(eax, Immediate(kSmiTagMask)); |
| 4944 } | 4944 } |
| 4945 DeoptimizeIf(zero, instr->environment()); | 4945 DeoptimizeIf(zero, instr->environment()); |
| 4946 } | 4946 } |
| 4947 | 4947 |
| 4948 | 4948 |
| 4949 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 4949 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 4950 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 4950 class DeferredCheckMaps FINAL : public LDeferredCode { |
| 4951 public: | 4951 public: |
| 4952 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 4952 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 4953 : LDeferredCode(codegen), instr_(instr), object_(object) { | 4953 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 4954 SetExit(check_maps()); | 4954 SetExit(check_maps()); |
| 4955 } | 4955 } |
| 4956 virtual void Generate() V8_OVERRIDE { | 4956 virtual void Generate() OVERRIDE { |
| 4957 codegen()->DoDeferredInstanceMigration(instr_, object_); | 4957 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 4958 } | 4958 } |
| 4959 Label* check_maps() { return &check_maps_; } | 4959 Label* check_maps() { return &check_maps_; } |
| 4960 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4960 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 4961 private: | 4961 private: |
| 4962 LCheckMaps* instr_; | 4962 LCheckMaps* instr_; |
| 4963 Label check_maps_; | 4963 Label check_maps_; |
| 4964 Register object_; | 4964 Register object_; |
| 4965 }; | 4965 }; |
| 4966 | 4966 |
| 4967 if (instr->hydrogen()->IsStabilityCheck()) { | 4967 if (instr->hydrogen()->IsStabilityCheck()) { |
| 4968 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); | 4968 const UniqueSet<Map>* maps = instr->hydrogen()->maps(); |
| 4969 for (int i = 0; i < maps->size(); ++i) { | 4969 for (int i = 0; i < maps->size(); ++i) { |
| 4970 AddStabilityDependency(maps->at(i).handle()); | 4970 AddStabilityDependency(maps->at(i).handle()); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5083 XMMRegister xmm_scratch = double_scratch0(); | 5083 XMMRegister xmm_scratch = double_scratch0(); |
| 5084 __ movd(result_reg, hi_reg); | 5084 __ movd(result_reg, hi_reg); |
| 5085 __ psllq(result_reg, 32); | 5085 __ psllq(result_reg, 32); |
| 5086 __ movd(xmm_scratch, lo_reg); | 5086 __ movd(xmm_scratch, lo_reg); |
| 5087 __ orps(result_reg, xmm_scratch); | 5087 __ orps(result_reg, xmm_scratch); |
| 5088 } | 5088 } |
| 5089 } | 5089 } |
| 5090 | 5090 |
| 5091 | 5091 |
| 5092 void LCodeGen::DoAllocate(LAllocate* instr) { | 5092 void LCodeGen::DoAllocate(LAllocate* instr) { |
| 5093 class DeferredAllocate V8_FINAL : public LDeferredCode { | 5093 class DeferredAllocate FINAL : public LDeferredCode { |
| 5094 public: | 5094 public: |
| 5095 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5095 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
| 5096 : LDeferredCode(codegen), instr_(instr) { } | 5096 : LDeferredCode(codegen), instr_(instr) { } |
| 5097 virtual void Generate() V8_OVERRIDE { | 5097 virtual void Generate() OVERRIDE { |
| 5098 codegen()->DoDeferredAllocate(instr_); | 5098 codegen()->DoDeferredAllocate(instr_); |
| 5099 } | 5099 } |
| 5100 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5100 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 5101 private: | 5101 private: |
| 5102 LAllocate* instr_; | 5102 LAllocate* instr_; |
| 5103 }; | 5103 }; |
| 5104 | 5104 |
| 5105 DeferredAllocate* deferred = new(zone()) DeferredAllocate(this, instr); | 5105 DeferredAllocate* deferred = new(zone()) DeferredAllocate(this, instr); |
| 5106 | 5106 |
| 5107 Register result = ToRegister(instr->result()); | 5107 Register result = ToRegister(instr->result()); |
| 5108 Register temp = ToRegister(instr->temp()); | 5108 Register temp = ToRegister(instr->temp()); |
| 5109 | 5109 |
| 5110 // Allocate memory for the object. | 5110 // Allocate memory for the object. |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5451 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5451 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
| 5452 RecordSafepointWithLazyDeopt( | 5452 RecordSafepointWithLazyDeopt( |
| 5453 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 5453 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 5454 DCHECK(instr->HasEnvironment()); | 5454 DCHECK(instr->HasEnvironment()); |
| 5455 LEnvironment* env = instr->environment(); | 5455 LEnvironment* env = instr->environment(); |
| 5456 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5456 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5457 } | 5457 } |
| 5458 | 5458 |
| 5459 | 5459 |
| 5460 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5460 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 5461 class DeferredStackCheck V8_FINAL : public LDeferredCode { | 5461 class DeferredStackCheck FINAL : public LDeferredCode { |
| 5462 public: | 5462 public: |
| 5463 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5463 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
| 5464 : LDeferredCode(codegen), instr_(instr) { } | 5464 : LDeferredCode(codegen), instr_(instr) { } |
| 5465 virtual void Generate() V8_OVERRIDE { | 5465 virtual void Generate() OVERRIDE { |
| 5466 codegen()->DoDeferredStackCheck(instr_); | 5466 codegen()->DoDeferredStackCheck(instr_); |
| 5467 } | 5467 } |
| 5468 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5468 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 5469 private: | 5469 private: |
| 5470 LStackCheck* instr_; | 5470 LStackCheck* instr_; |
| 5471 }; | 5471 }; |
| 5472 | 5472 |
| 5473 DCHECK(instr->HasEnvironment()); | 5473 DCHECK(instr->HasEnvironment()); |
| 5474 LEnvironment* env = instr->environment(); | 5474 LEnvironment* env = instr->environment(); |
| 5475 // There is no LLazyBailout instruction for stack-checks. We have to | 5475 // There is no LLazyBailout instruction for stack-checks. We have to |
| 5476 // prepare for lazy deoptimization explicitly here. | 5476 // prepare for lazy deoptimization explicitly here. |
| 5477 if (instr->hydrogen()->is_function_entry()) { | 5477 if (instr->hydrogen()->is_function_entry()) { |
| 5478 // Perform stack overflow check. | 5478 // Perform stack overflow check. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5594 __ push(index); | 5594 __ push(index); |
| 5595 __ xor_(esi, esi); | 5595 __ xor_(esi, esi); |
| 5596 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); | 5596 __ CallRuntimeSaveDoubles(Runtime::kLoadMutableDouble); |
| 5597 RecordSafepointWithRegisters( | 5597 RecordSafepointWithRegisters( |
| 5598 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); | 5598 instr->pointer_map(), 2, Safepoint::kNoLazyDeopt); |
| 5599 __ StoreToSafepointRegisterSlot(object, eax); | 5599 __ StoreToSafepointRegisterSlot(object, eax); |
| 5600 } | 5600 } |
| 5601 | 5601 |
| 5602 | 5602 |
| 5603 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5603 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 5604 class DeferredLoadMutableDouble V8_FINAL : public LDeferredCode { | 5604 class DeferredLoadMutableDouble FINAL : public LDeferredCode { |
| 5605 public: | 5605 public: |
| 5606 DeferredLoadMutableDouble(LCodeGen* codegen, | 5606 DeferredLoadMutableDouble(LCodeGen* codegen, |
| 5607 LLoadFieldByIndex* instr, | 5607 LLoadFieldByIndex* instr, |
| 5608 Register object, | 5608 Register object, |
| 5609 Register index) | 5609 Register index) |
| 5610 : LDeferredCode(codegen), | 5610 : LDeferredCode(codegen), |
| 5611 instr_(instr), | 5611 instr_(instr), |
| 5612 object_(object), | 5612 object_(object), |
| 5613 index_(index) { | 5613 index_(index) { |
| 5614 } | 5614 } |
| 5615 virtual void Generate() V8_OVERRIDE { | 5615 virtual void Generate() OVERRIDE { |
| 5616 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); | 5616 codegen()->DoDeferredLoadMutableDouble(instr_, object_, index_); |
| 5617 } | 5617 } |
| 5618 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 5618 virtual LInstruction* instr() OVERRIDE { return instr_; } |
| 5619 private: | 5619 private: |
| 5620 LLoadFieldByIndex* instr_; | 5620 LLoadFieldByIndex* instr_; |
| 5621 Register object_; | 5621 Register object_; |
| 5622 Register index_; | 5622 Register index_; |
| 5623 }; | 5623 }; |
| 5624 | 5624 |
| 5625 Register object = ToRegister(instr->object()); | 5625 Register object = ToRegister(instr->object()); |
| 5626 Register index = ToRegister(instr->index()); | 5626 Register index = ToRegister(instr->index()); |
| 5627 | 5627 |
| 5628 DeferredLoadMutableDouble* deferred; | 5628 DeferredLoadMutableDouble* deferred; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5669 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5669 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5670 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5670 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5671 } | 5671 } |
| 5672 | 5672 |
| 5673 | 5673 |
| 5674 #undef __ | 5674 #undef __ |
| 5675 | 5675 |
| 5676 } } // namespace v8::internal | 5676 } } // namespace v8::internal |
| 5677 | 5677 |
| 5678 #endif // V8_TARGET_ARCH_IA32 | 5678 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |