| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "x64/lithium-codegen-x64.h" | 32 #include "x64/lithium-codegen-x64.h" |
| 33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
| 34 #include "stub-cache.h" | 34 #include "stub-cache.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 | 39 |
| 40 // When invoking builtins, we need to record the safepoint in the middle of | 40 // When invoking builtins, we need to record the safepoint in the middle of |
| 41 // the invoke instruction sequence generated by the macro assembler. | 41 // the invoke instruction sequence generated by the macro assembler. |
| 42 class SafepointGenerator : public CallWrapper { | 42 class SafepointGenerator V8_FINAL : public CallWrapper { |
| 43 public: | 43 public: |
| 44 SafepointGenerator(LCodeGen* codegen, | 44 SafepointGenerator(LCodeGen* codegen, |
| 45 LPointerMap* pointers, | 45 LPointerMap* pointers, |
| 46 Safepoint::DeoptMode mode) | 46 Safepoint::DeoptMode mode) |
| 47 : codegen_(codegen), | 47 : codegen_(codegen), |
| 48 pointers_(pointers), | 48 pointers_(pointers), |
| 49 deopt_mode_(mode) { } | 49 deopt_mode_(mode) { } |
| 50 virtual ~SafepointGenerator() { } | 50 virtual ~SafepointGenerator() {} |
| 51 | 51 |
| 52 virtual void BeforeCall(int call_size) const { | 52 virtual void BeforeCall(int call_size) const V8_OVERRIDE { |
| 53 codegen_->EnsureSpaceForLazyDeopt(Deoptimizer::patch_size() - call_size); | 53 codegen_->EnsureSpaceForLazyDeopt(Deoptimizer::patch_size() - call_size); |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void AfterCall() const { | 56 virtual void AfterCall() const V8_OVERRIDE { |
| 57 codegen_->RecordSafepoint(pointers_, deopt_mode_); | 57 codegen_->RecordSafepoint(pointers_, deopt_mode_); |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 LCodeGen* codegen_; | 61 LCodeGen* codegen_; |
| 62 LPointerMap* pointers_; | 62 LPointerMap* pointers_; |
| 63 Safepoint::DeoptMode deopt_mode_; | 63 Safepoint::DeoptMode deopt_mode_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 | 66 |
| (...skipping 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2459 __ j(zero, &true_value, Label::kNear); | 2459 __ j(zero, &true_value, Label::kNear); |
| 2460 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); | 2460 __ LoadRoot(ToRegister(instr->result()), Heap::kFalseValueRootIndex); |
| 2461 __ jmp(&done, Label::kNear); | 2461 __ jmp(&done, Label::kNear); |
| 2462 __ bind(&true_value); | 2462 __ bind(&true_value); |
| 2463 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); | 2463 __ LoadRoot(ToRegister(instr->result()), Heap::kTrueValueRootIndex); |
| 2464 __ bind(&done); | 2464 __ bind(&done); |
| 2465 } | 2465 } |
| 2466 | 2466 |
| 2467 | 2467 |
| 2468 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { | 2468 void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { |
| 2469 class DeferredInstanceOfKnownGlobal: public LDeferredCode { | 2469 class DeferredInstanceOfKnownGlobal V8_FINAL : public LDeferredCode { |
| 2470 public: | 2470 public: |
| 2471 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, | 2471 DeferredInstanceOfKnownGlobal(LCodeGen* codegen, |
| 2472 LInstanceOfKnownGlobal* instr) | 2472 LInstanceOfKnownGlobal* instr) |
| 2473 : LDeferredCode(codegen), instr_(instr) { } | 2473 : LDeferredCode(codegen), instr_(instr) { } |
| 2474 virtual void Generate() { | 2474 virtual void Generate() V8_OVERRIDE { |
| 2475 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2475 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
| 2476 } | 2476 } |
| 2477 virtual LInstruction* instr() { return instr_; } | 2477 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 2478 Label* map_check() { return &map_check_; } | 2478 Label* map_check() { return &map_check_; } |
| 2479 private: | 2479 private: |
| 2480 LInstanceOfKnownGlobal* instr_; | 2480 LInstanceOfKnownGlobal* instr_; |
| 2481 Label map_check_; | 2481 Label map_check_; |
| 2482 }; | 2482 }; |
| 2483 | 2483 |
| 2484 | 2484 |
| 2485 DeferredInstanceOfKnownGlobal* deferred; | 2485 DeferredInstanceOfKnownGlobal* deferred; |
| 2486 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2486 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
| 2487 | 2487 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3393 Label is_positive; | 3393 Label is_positive; |
| 3394 __ j(not_sign, &is_positive, Label::kNear); | 3394 __ j(not_sign, &is_positive, Label::kNear); |
| 3395 __ neg(input_reg); // Sets flags. | 3395 __ neg(input_reg); // Sets flags. |
| 3396 DeoptimizeIf(negative, instr->environment()); | 3396 DeoptimizeIf(negative, instr->environment()); |
| 3397 __ bind(&is_positive); | 3397 __ bind(&is_positive); |
| 3398 } | 3398 } |
| 3399 | 3399 |
| 3400 | 3400 |
| 3401 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3401 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
| 3402 // Class for deferred case. | 3402 // Class for deferred case. |
| 3403 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { | 3403 class DeferredMathAbsTaggedHeapNumber V8_FINAL : public LDeferredCode { |
| 3404 public: | 3404 public: |
| 3405 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3405 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
| 3406 : LDeferredCode(codegen), instr_(instr) { } | 3406 : LDeferredCode(codegen), instr_(instr) { } |
| 3407 virtual void Generate() { | 3407 virtual void Generate() V8_OVERRIDE { |
| 3408 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3408 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
| 3409 } | 3409 } |
| 3410 virtual LInstruction* instr() { return instr_; } | 3410 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 3411 private: | 3411 private: |
| 3412 LMathAbs* instr_; | 3412 LMathAbs* instr_; |
| 3413 }; | 3413 }; |
| 3414 | 3414 |
| 3415 ASSERT(instr->value()->Equals(instr->result())); | 3415 ASSERT(instr->value()->Equals(instr->result())); |
| 3416 Representation r = instr->hydrogen()->value()->representation(); | 3416 Representation r = instr->hydrogen()->value()->representation(); |
| 3417 | 3417 |
| 3418 if (r.IsDouble()) { | 3418 if (r.IsDouble()) { |
| 3419 XMMRegister scratch = xmm0; | 3419 XMMRegister scratch = xmm0; |
| 3420 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3420 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3625 __ CallStub(&stub); | 3625 __ CallStub(&stub); |
| 3626 } else { | 3626 } else { |
| 3627 ASSERT(exponent_type.IsDouble()); | 3627 ASSERT(exponent_type.IsDouble()); |
| 3628 MathPowStub stub(MathPowStub::DOUBLE); | 3628 MathPowStub stub(MathPowStub::DOUBLE); |
| 3629 __ CallStub(&stub); | 3629 __ CallStub(&stub); |
| 3630 } | 3630 } |
| 3631 } | 3631 } |
| 3632 | 3632 |
| 3633 | 3633 |
| 3634 void LCodeGen::DoRandom(LRandom* instr) { | 3634 void LCodeGen::DoRandom(LRandom* instr) { |
| 3635 class DeferredDoRandom: public LDeferredCode { | 3635 class DeferredDoRandom V8_FINAL : public LDeferredCode { |
| 3636 public: | 3636 public: |
| 3637 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) | 3637 DeferredDoRandom(LCodeGen* codegen, LRandom* instr) |
| 3638 : LDeferredCode(codegen), instr_(instr) { } | 3638 : LDeferredCode(codegen), instr_(instr) { } |
| 3639 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } | 3639 virtual void Generate() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } |
| 3640 virtual LInstruction* instr() { return instr_; } | 3640 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 3641 private: | 3641 private: |
| 3642 LRandom* instr_; | 3642 LRandom* instr_; |
| 3643 }; | 3643 }; |
| 3644 | 3644 |
| 3645 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); | 3645 DeferredDoRandom* deferred = new(zone()) DeferredDoRandom(this, instr); |
| 3646 | 3646 |
| 3647 // Having marked this instruction as a call we can use any | 3647 // Having marked this instruction as a call we can use any |
| 3648 // registers. | 3648 // registers. |
| 3649 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3649 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
| 3650 | 3650 |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4315 | 4315 |
| 4316 void LCodeGen::DoStringAdd(LStringAdd* instr) { | 4316 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
| 4317 EmitPushTaggedOperand(instr->left()); | 4317 EmitPushTaggedOperand(instr->left()); |
| 4318 EmitPushTaggedOperand(instr->right()); | 4318 EmitPushTaggedOperand(instr->right()); |
| 4319 StringAddStub stub(instr->hydrogen()->flags()); | 4319 StringAddStub stub(instr->hydrogen()->flags()); |
| 4320 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4320 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4321 } | 4321 } |
| 4322 | 4322 |
| 4323 | 4323 |
| 4324 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 4324 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 4325 class DeferredStringCharCodeAt: public LDeferredCode { | 4325 class DeferredStringCharCodeAt V8_FINAL : public LDeferredCode { |
| 4326 public: | 4326 public: |
| 4327 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 4327 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
| 4328 : LDeferredCode(codegen), instr_(instr) { } | 4328 : LDeferredCode(codegen), instr_(instr) { } |
| 4329 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } | 4329 virtual void Generate() V8_OVERRIDE { |
| 4330 virtual LInstruction* instr() { return instr_; } | 4330 codegen()->DoDeferredStringCharCodeAt(instr_); |
| 4331 } |
| 4332 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4331 private: | 4333 private: |
| 4332 LStringCharCodeAt* instr_; | 4334 LStringCharCodeAt* instr_; |
| 4333 }; | 4335 }; |
| 4334 | 4336 |
| 4335 DeferredStringCharCodeAt* deferred = | 4337 DeferredStringCharCodeAt* deferred = |
| 4336 new(zone()) DeferredStringCharCodeAt(this, instr); | 4338 new(zone()) DeferredStringCharCodeAt(this, instr); |
| 4337 | 4339 |
| 4338 StringCharLoadGenerator::Generate(masm(), | 4340 StringCharLoadGenerator::Generate(masm(), |
| 4339 ToRegister(instr->string()), | 4341 ToRegister(instr->string()), |
| 4340 ToRegister(instr->index()), | 4342 ToRegister(instr->index()), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4367 __ push(index); | 4369 __ push(index); |
| 4368 } | 4370 } |
| 4369 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); | 4371 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
| 4370 __ AssertSmi(rax); | 4372 __ AssertSmi(rax); |
| 4371 __ SmiToInteger32(rax, rax); | 4373 __ SmiToInteger32(rax, rax); |
| 4372 __ StoreToSafepointRegisterSlot(result, rax); | 4374 __ StoreToSafepointRegisterSlot(result, rax); |
| 4373 } | 4375 } |
| 4374 | 4376 |
| 4375 | 4377 |
| 4376 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4378 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
| 4377 class DeferredStringCharFromCode: public LDeferredCode { | 4379 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { |
| 4378 public: | 4380 public: |
| 4379 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4381 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
| 4380 : LDeferredCode(codegen), instr_(instr) { } | 4382 : LDeferredCode(codegen), instr_(instr) { } |
| 4381 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } | 4383 virtual void Generate() V8_OVERRIDE { |
| 4382 virtual LInstruction* instr() { return instr_; } | 4384 codegen()->DoDeferredStringCharFromCode(instr_); |
| 4385 } |
| 4386 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4383 private: | 4387 private: |
| 4384 LStringCharFromCode* instr_; | 4388 LStringCharFromCode* instr_; |
| 4385 }; | 4389 }; |
| 4386 | 4390 |
| 4387 DeferredStringCharFromCode* deferred = | 4391 DeferredStringCharFromCode* deferred = |
| 4388 new(zone()) DeferredStringCharFromCode(this, instr); | 4392 new(zone()) DeferredStringCharFromCode(this, instr); |
| 4389 | 4393 |
| 4390 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4394 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
| 4391 Register char_code = ToRegister(instr->char_code()); | 4395 Register char_code = ToRegister(instr->char_code()); |
| 4392 Register result = ToRegister(instr->result()); | 4396 Register result = ToRegister(instr->result()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4461 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4465 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4462 LOperand* input = instr->value(); | 4466 LOperand* input = instr->value(); |
| 4463 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4467 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
| 4464 Register reg = ToRegister(input); | 4468 Register reg = ToRegister(input); |
| 4465 | 4469 |
| 4466 __ Integer32ToSmi(reg, reg); | 4470 __ Integer32ToSmi(reg, reg); |
| 4467 } | 4471 } |
| 4468 | 4472 |
| 4469 | 4473 |
| 4470 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4474 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
| 4471 class DeferredNumberTagU: public LDeferredCode { | 4475 class DeferredNumberTagU V8_FINAL : public LDeferredCode { |
| 4472 public: | 4476 public: |
| 4473 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4477 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
| 4474 : LDeferredCode(codegen), instr_(instr) { } | 4478 : LDeferredCode(codegen), instr_(instr) { } |
| 4475 virtual void Generate() { | 4479 virtual void Generate() V8_OVERRIDE { |
| 4476 codegen()->DoDeferredNumberTagU(instr_); | 4480 codegen()->DoDeferredNumberTagU(instr_); |
| 4477 } | 4481 } |
| 4478 virtual LInstruction* instr() { return instr_; } | 4482 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4479 private: | 4483 private: |
| 4480 LNumberTagU* instr_; | 4484 LNumberTagU* instr_; |
| 4481 }; | 4485 }; |
| 4482 | 4486 |
| 4483 LOperand* input = instr->value(); | 4487 LOperand* input = instr->value(); |
| 4484 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4488 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
| 4485 Register reg = ToRegister(input); | 4489 Register reg = ToRegister(input); |
| 4486 | 4490 |
| 4487 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4491 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
| 4488 __ cmpl(reg, Immediate(Smi::kMaxValue)); | 4492 __ cmpl(reg, Immediate(Smi::kMaxValue)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4524 | 4528 |
| 4525 // Done. Put the value in xmm1 into the value of the allocated heap | 4529 // Done. Put the value in xmm1 into the value of the allocated heap |
| 4526 // number. | 4530 // number. |
| 4527 __ bind(&done); | 4531 __ bind(&done); |
| 4528 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm1); | 4532 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm1); |
| 4529 __ StoreToSafepointRegisterSlot(reg, reg); | 4533 __ StoreToSafepointRegisterSlot(reg, reg); |
| 4530 } | 4534 } |
| 4531 | 4535 |
| 4532 | 4536 |
| 4533 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4537 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 4534 class DeferredNumberTagD: public LDeferredCode { | 4538 class DeferredNumberTagD V8_FINAL : public LDeferredCode { |
| 4535 public: | 4539 public: |
| 4536 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4540 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 4537 : LDeferredCode(codegen), instr_(instr) { } | 4541 : LDeferredCode(codegen), instr_(instr) { } |
| 4538 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 4542 virtual void Generate() V8_OVERRIDE { |
| 4539 virtual LInstruction* instr() { return instr_; } | 4543 codegen()->DoDeferredNumberTagD(instr_); |
| 4544 } |
| 4545 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4540 private: | 4546 private: |
| 4541 LNumberTagD* instr_; | 4547 LNumberTagD* instr_; |
| 4542 }; | 4548 }; |
| 4543 | 4549 |
| 4544 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 4550 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
| 4545 Register reg = ToRegister(instr->result()); | 4551 Register reg = ToRegister(instr->result()); |
| 4546 Register tmp = ToRegister(instr->temp()); | 4552 Register tmp = ToRegister(instr->temp()); |
| 4547 | 4553 |
| 4548 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); | 4554 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); |
| 4549 if (FLAG_inline_new) { | 4555 if (FLAG_inline_new) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4691 __ movmskpd(input_reg, xmm0); | 4697 __ movmskpd(input_reg, xmm0); |
| 4692 __ andl(input_reg, Immediate(1)); | 4698 __ andl(input_reg, Immediate(1)); |
| 4693 DeoptimizeIf(not_zero, instr->environment()); | 4699 DeoptimizeIf(not_zero, instr->environment()); |
| 4694 } | 4700 } |
| 4695 } | 4701 } |
| 4696 __ bind(&done); | 4702 __ bind(&done); |
| 4697 } | 4703 } |
| 4698 | 4704 |
| 4699 | 4705 |
| 4700 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4706 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4701 class DeferredTaggedToI: public LDeferredCode { | 4707 class DeferredTaggedToI V8_FINAL : public LDeferredCode { |
| 4702 public: | 4708 public: |
| 4703 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4709 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
| 4704 : LDeferredCode(codegen), instr_(instr) { } | 4710 : LDeferredCode(codegen), instr_(instr) { } |
| 4705 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } | 4711 virtual void Generate() V8_OVERRIDE { |
| 4706 virtual LInstruction* instr() { return instr_; } | 4712 codegen()->DoDeferredTaggedToI(instr_); |
| 4713 } |
| 4714 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4707 private: | 4715 private: |
| 4708 LTaggedToI* instr_; | 4716 LTaggedToI* instr_; |
| 4709 }; | 4717 }; |
| 4710 | 4718 |
| 4711 LOperand* input = instr->value(); | 4719 LOperand* input = instr->value(); |
| 4712 ASSERT(input->IsRegister()); | 4720 ASSERT(input->IsRegister()); |
| 4713 ASSERT(input->Equals(instr->result())); | 4721 ASSERT(input->Equals(instr->result())); |
| 4714 | 4722 |
| 4715 Register input_reg = ToRegister(input); | 4723 Register input_reg = ToRegister(input); |
| 4716 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); | 4724 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4893 PushSafepointRegistersScope scope(this); | 4901 PushSafepointRegistersScope scope(this); |
| 4894 __ push(object); | 4902 __ push(object); |
| 4895 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 4903 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
| 4896 __ testq(rax, Immediate(kSmiTagMask)); | 4904 __ testq(rax, Immediate(kSmiTagMask)); |
| 4897 } | 4905 } |
| 4898 DeoptimizeIf(zero, instr->environment()); | 4906 DeoptimizeIf(zero, instr->environment()); |
| 4899 } | 4907 } |
| 4900 | 4908 |
| 4901 | 4909 |
| 4902 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 4910 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 4903 class DeferredCheckMaps: public LDeferredCode { | 4911 class DeferredCheckMaps V8_FINAL : public LDeferredCode { |
| 4904 public: | 4912 public: |
| 4905 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 4913 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 4906 : LDeferredCode(codegen), instr_(instr), object_(object) { | 4914 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 4907 SetExit(check_maps()); | 4915 SetExit(check_maps()); |
| 4908 } | 4916 } |
| 4909 virtual void Generate() { | 4917 virtual void Generate() V8_OVERRIDE { |
| 4910 codegen()->DoDeferredInstanceMigration(instr_, object_); | 4918 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 4911 } | 4919 } |
| 4912 Label* check_maps() { return &check_maps_; } | 4920 Label* check_maps() { return &check_maps_; } |
| 4913 virtual LInstruction* instr() { return instr_; } | 4921 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 4914 private: | 4922 private: |
| 4915 LCheckMaps* instr_; | 4923 LCheckMaps* instr_; |
| 4916 Label check_maps_; | 4924 Label check_maps_; |
| 4917 Register object_; | 4925 Register object_; |
| 4918 }; | 4926 }; |
| 4919 | 4927 |
| 4920 if (instr->hydrogen()->CanOmitMapChecks()) return; | 4928 if (instr->hydrogen()->CanOmitMapChecks()) return; |
| 4921 | 4929 |
| 4922 LOperand* input = instr->value(); | 4930 LOperand* input = instr->value(); |
| 4923 ASSERT(input->IsRegister()); | 4931 ASSERT(input->IsRegister()); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4993 // smi | 5001 // smi |
| 4994 __ bind(&is_smi); | 5002 __ bind(&is_smi); |
| 4995 __ SmiToInteger32(input_reg, input_reg); | 5003 __ SmiToInteger32(input_reg, input_reg); |
| 4996 __ ClampUint8(input_reg); | 5004 __ ClampUint8(input_reg); |
| 4997 | 5005 |
| 4998 __ bind(&done); | 5006 __ bind(&done); |
| 4999 } | 5007 } |
| 5000 | 5008 |
| 5001 | 5009 |
| 5002 void LCodeGen::DoAllocate(LAllocate* instr) { | 5010 void LCodeGen::DoAllocate(LAllocate* instr) { |
| 5003 class DeferredAllocate: public LDeferredCode { | 5011 class DeferredAllocate V8_FINAL : public LDeferredCode { |
| 5004 public: | 5012 public: |
| 5005 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5013 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
| 5006 : LDeferredCode(codegen), instr_(instr) { } | 5014 : LDeferredCode(codegen), instr_(instr) { } |
| 5007 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5015 virtual void Generate() V8_OVERRIDE { |
| 5008 virtual LInstruction* instr() { return instr_; } | 5016 codegen()->DoDeferredAllocate(instr_); |
| 5017 } |
| 5018 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 5009 private: | 5019 private: |
| 5010 LAllocate* instr_; | 5020 LAllocate* instr_; |
| 5011 }; | 5021 }; |
| 5012 | 5022 |
| 5013 DeferredAllocate* deferred = | 5023 DeferredAllocate* deferred = |
| 5014 new(zone()) DeferredAllocate(this, instr); | 5024 new(zone()) DeferredAllocate(this, instr); |
| 5015 | 5025 |
| 5016 Register result = ToRegister(instr->result()); | 5026 Register result = ToRegister(instr->result()); |
| 5017 Register temp = ToRegister(instr->temp()); | 5027 Register temp = ToRegister(instr->temp()); |
| 5018 | 5028 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5354 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 5364 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 5355 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5365 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
| 5356 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); | 5366 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); |
| 5357 ASSERT(instr->HasEnvironment()); | 5367 ASSERT(instr->HasEnvironment()); |
| 5358 LEnvironment* env = instr->environment(); | 5368 LEnvironment* env = instr->environment(); |
| 5359 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5369 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 5360 } | 5370 } |
| 5361 | 5371 |
| 5362 | 5372 |
| 5363 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5373 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 5364 class DeferredStackCheck: public LDeferredCode { | 5374 class DeferredStackCheck V8_FINAL : public LDeferredCode { |
| 5365 public: | 5375 public: |
| 5366 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5376 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
| 5367 : LDeferredCode(codegen), instr_(instr) { } | 5377 : LDeferredCode(codegen), instr_(instr) { } |
| 5368 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 5378 virtual void Generate() V8_OVERRIDE { |
| 5369 virtual LInstruction* instr() { return instr_; } | 5379 codegen()->DoDeferredStackCheck(instr_); |
| 5380 } |
| 5381 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } |
| 5370 private: | 5382 private: |
| 5371 LStackCheck* instr_; | 5383 LStackCheck* instr_; |
| 5372 }; | 5384 }; |
| 5373 | 5385 |
| 5374 ASSERT(instr->HasEnvironment()); | 5386 ASSERT(instr->HasEnvironment()); |
| 5375 LEnvironment* env = instr->environment(); | 5387 LEnvironment* env = instr->environment(); |
| 5376 // There is no LLazyBailout instruction for stack-checks. We have to | 5388 // There is no LLazyBailout instruction for stack-checks. We have to |
| 5377 // prepare for lazy deoptimization explicitly here. | 5389 // prepare for lazy deoptimization explicitly here. |
| 5378 if (instr->hydrogen()->is_function_entry()) { | 5390 if (instr->hydrogen()->is_function_entry()) { |
| 5379 // Perform stack overflow check. | 5391 // Perform stack overflow check. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5510 FixedArray::kHeaderSize - kPointerSize)); | 5522 FixedArray::kHeaderSize - kPointerSize)); |
| 5511 __ bind(&done); | 5523 __ bind(&done); |
| 5512 } | 5524 } |
| 5513 | 5525 |
| 5514 | 5526 |
| 5515 #undef __ | 5527 #undef __ |
| 5516 | 5528 |
| 5517 } } // namespace v8::internal | 5529 } } // namespace v8::internal |
| 5518 | 5530 |
| 5519 #endif // V8_TARGET_ARCH_X64 | 5531 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |