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 V8_FINAL : public CallWrapper { | 42 class SafepointGenerator : 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 V8_OVERRIDE { | 52 virtual void BeforeCall(int call_size) const { |
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 V8_OVERRIDE { | 56 virtual void AfterCall() const { |
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 V8_FINAL : public LDeferredCode { | 2469 class DeferredInstanceOfKnownGlobal: 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() V8_OVERRIDE { | 2474 virtual void Generate() { |
2475 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); | 2475 codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_); |
2476 } | 2476 } |
2477 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 2477 virtual LInstruction* instr() { 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 V8_FINAL : public LDeferredCode { | 3403 class DeferredMathAbsTaggedHeapNumber: 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() V8_OVERRIDE { | 3407 virtual void Generate() { |
3408 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); | 3408 codegen()->DoDeferredMathAbsTaggedHeapNumber(instr_); |
3409 } | 3409 } |
3410 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3410 virtual LInstruction* instr() { 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 V8_FINAL : public LDeferredCode { | 3635 class DeferredDoRandom: 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() V8_OVERRIDE { codegen()->DoDeferredRandom(instr_); } | 3639 virtual void Generate() { codegen()->DoDeferredRandom(instr_); } |
3640 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 3640 virtual LInstruction* instr() { 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 V8_FINAL : public LDeferredCode { | 4325 class DeferredStringCharCodeAt: 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() V8_OVERRIDE { | 4329 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } |
4330 codegen()->DoDeferredStringCharCodeAt(instr_); | 4330 virtual LInstruction* instr() { return instr_; } |
4331 } | |
4332 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4333 private: | 4331 private: |
4334 LStringCharCodeAt* instr_; | 4332 LStringCharCodeAt* instr_; |
4335 }; | 4333 }; |
4336 | 4334 |
4337 DeferredStringCharCodeAt* deferred = | 4335 DeferredStringCharCodeAt* deferred = |
4338 new(zone()) DeferredStringCharCodeAt(this, instr); | 4336 new(zone()) DeferredStringCharCodeAt(this, instr); |
4339 | 4337 |
4340 StringCharLoadGenerator::Generate(masm(), | 4338 StringCharLoadGenerator::Generate(masm(), |
4341 ToRegister(instr->string()), | 4339 ToRegister(instr->string()), |
4342 ToRegister(instr->index()), | 4340 ToRegister(instr->index()), |
(...skipping 26 matching lines...) Expand all Loading... |
4369 __ push(index); | 4367 __ push(index); |
4370 } | 4368 } |
4371 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); | 4369 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, instr); |
4372 __ AssertSmi(rax); | 4370 __ AssertSmi(rax); |
4373 __ SmiToInteger32(rax, rax); | 4371 __ SmiToInteger32(rax, rax); |
4374 __ StoreToSafepointRegisterSlot(result, rax); | 4372 __ StoreToSafepointRegisterSlot(result, rax); |
4375 } | 4373 } |
4376 | 4374 |
4377 | 4375 |
4378 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4376 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4379 class DeferredStringCharFromCode V8_FINAL : public LDeferredCode { | 4377 class DeferredStringCharFromCode: public LDeferredCode { |
4380 public: | 4378 public: |
4381 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4379 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4382 : LDeferredCode(codegen), instr_(instr) { } | 4380 : LDeferredCode(codegen), instr_(instr) { } |
4383 virtual void Generate() V8_OVERRIDE { | 4381 virtual void Generate() { codegen()->DoDeferredStringCharFromCode(instr_); } |
4384 codegen()->DoDeferredStringCharFromCode(instr_); | 4382 virtual LInstruction* instr() { return instr_; } |
4385 } | |
4386 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4387 private: | 4383 private: |
4388 LStringCharFromCode* instr_; | 4384 LStringCharFromCode* instr_; |
4389 }; | 4385 }; |
4390 | 4386 |
4391 DeferredStringCharFromCode* deferred = | 4387 DeferredStringCharFromCode* deferred = |
4392 new(zone()) DeferredStringCharFromCode(this, instr); | 4388 new(zone()) DeferredStringCharFromCode(this, instr); |
4393 | 4389 |
4394 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); | 4390 ASSERT(instr->hydrogen()->value()->representation().IsInteger32()); |
4395 Register char_code = ToRegister(instr->char_code()); | 4391 Register char_code = ToRegister(instr->char_code()); |
4396 Register result = ToRegister(instr->result()); | 4392 Register result = ToRegister(instr->result()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4465 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4461 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4466 LOperand* input = instr->value(); | 4462 LOperand* input = instr->value(); |
4467 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4463 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4468 Register reg = ToRegister(input); | 4464 Register reg = ToRegister(input); |
4469 | 4465 |
4470 __ Integer32ToSmi(reg, reg); | 4466 __ Integer32ToSmi(reg, reg); |
4471 } | 4467 } |
4472 | 4468 |
4473 | 4469 |
4474 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4470 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
4475 class DeferredNumberTagU V8_FINAL : public LDeferredCode { | 4471 class DeferredNumberTagU: public LDeferredCode { |
4476 public: | 4472 public: |
4477 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) | 4473 DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) |
4478 : LDeferredCode(codegen), instr_(instr) { } | 4474 : LDeferredCode(codegen), instr_(instr) { } |
4479 virtual void Generate() V8_OVERRIDE { | 4475 virtual void Generate() { |
4480 codegen()->DoDeferredNumberTagU(instr_); | 4476 codegen()->DoDeferredNumberTagU(instr_); |
4481 } | 4477 } |
4482 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4478 virtual LInstruction* instr() { return instr_; } |
4483 private: | 4479 private: |
4484 LNumberTagU* instr_; | 4480 LNumberTagU* instr_; |
4485 }; | 4481 }; |
4486 | 4482 |
4487 LOperand* input = instr->value(); | 4483 LOperand* input = instr->value(); |
4488 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4484 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4489 Register reg = ToRegister(input); | 4485 Register reg = ToRegister(input); |
4490 | 4486 |
4491 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4487 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
4492 __ cmpl(reg, Immediate(Smi::kMaxValue)); | 4488 __ cmpl(reg, Immediate(Smi::kMaxValue)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4528 | 4524 |
4529 // Done. Put the value in xmm1 into the value of the allocated heap | 4525 // Done. Put the value in xmm1 into the value of the allocated heap |
4530 // number. | 4526 // number. |
4531 __ bind(&done); | 4527 __ bind(&done); |
4532 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm1); | 4528 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm1); |
4533 __ StoreToSafepointRegisterSlot(reg, reg); | 4529 __ StoreToSafepointRegisterSlot(reg, reg); |
4534 } | 4530 } |
4535 | 4531 |
4536 | 4532 |
4537 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4533 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
4538 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 4534 class DeferredNumberTagD: public LDeferredCode { |
4539 public: | 4535 public: |
4540 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4536 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
4541 : LDeferredCode(codegen), instr_(instr) { } | 4537 : LDeferredCode(codegen), instr_(instr) { } |
4542 virtual void Generate() V8_OVERRIDE { | 4538 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
4543 codegen()->DoDeferredNumberTagD(instr_); | 4539 virtual LInstruction* instr() { return instr_; } |
4544 } | |
4545 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4546 private: | 4540 private: |
4547 LNumberTagD* instr_; | 4541 LNumberTagD* instr_; |
4548 }; | 4542 }; |
4549 | 4543 |
4550 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 4544 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
4551 Register reg = ToRegister(instr->result()); | 4545 Register reg = ToRegister(instr->result()); |
4552 Register tmp = ToRegister(instr->temp()); | 4546 Register tmp = ToRegister(instr->temp()); |
4553 | 4547 |
4554 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); | 4548 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); |
4555 if (FLAG_inline_new) { | 4549 if (FLAG_inline_new) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4697 __ movmskpd(input_reg, xmm0); | 4691 __ movmskpd(input_reg, xmm0); |
4698 __ andl(input_reg, Immediate(1)); | 4692 __ andl(input_reg, Immediate(1)); |
4699 DeoptimizeIf(not_zero, instr->environment()); | 4693 DeoptimizeIf(not_zero, instr->environment()); |
4700 } | 4694 } |
4701 } | 4695 } |
4702 __ bind(&done); | 4696 __ bind(&done); |
4703 } | 4697 } |
4704 | 4698 |
4705 | 4699 |
4706 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4700 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4707 class DeferredTaggedToI V8_FINAL : public LDeferredCode { | 4701 class DeferredTaggedToI: public LDeferredCode { |
4708 public: | 4702 public: |
4709 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4703 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4710 : LDeferredCode(codegen), instr_(instr) { } | 4704 : LDeferredCode(codegen), instr_(instr) { } |
4711 virtual void Generate() V8_OVERRIDE { | 4705 virtual void Generate() { codegen()->DoDeferredTaggedToI(instr_); } |
4712 codegen()->DoDeferredTaggedToI(instr_); | 4706 virtual LInstruction* instr() { return instr_; } |
4713 } | |
4714 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
4715 private: | 4707 private: |
4716 LTaggedToI* instr_; | 4708 LTaggedToI* instr_; |
4717 }; | 4709 }; |
4718 | 4710 |
4719 LOperand* input = instr->value(); | 4711 LOperand* input = instr->value(); |
4720 ASSERT(input->IsRegister()); | 4712 ASSERT(input->IsRegister()); |
4721 ASSERT(input->Equals(instr->result())); | 4713 ASSERT(input->Equals(instr->result())); |
4722 | 4714 |
4723 Register input_reg = ToRegister(input); | 4715 Register input_reg = ToRegister(input); |
4724 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); | 4716 DeferredTaggedToI* deferred = new(zone()) DeferredTaggedToI(this, instr); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4901 PushSafepointRegistersScope scope(this); | 4893 PushSafepointRegistersScope scope(this); |
4902 __ push(object); | 4894 __ push(object); |
4903 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); | 4895 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
4904 __ testq(rax, Immediate(kSmiTagMask)); | 4896 __ testq(rax, Immediate(kSmiTagMask)); |
4905 } | 4897 } |
4906 DeoptimizeIf(zero, instr->environment()); | 4898 DeoptimizeIf(zero, instr->environment()); |
4907 } | 4899 } |
4908 | 4900 |
4909 | 4901 |
4910 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 4902 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
4911 class DeferredCheckMaps V8_FINAL : public LDeferredCode { | 4903 class DeferredCheckMaps: public LDeferredCode { |
4912 public: | 4904 public: |
4913 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) | 4905 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
4914 : LDeferredCode(codegen), instr_(instr), object_(object) { | 4906 : LDeferredCode(codegen), instr_(instr), object_(object) { |
4915 SetExit(check_maps()); | 4907 SetExit(check_maps()); |
4916 } | 4908 } |
4917 virtual void Generate() V8_OVERRIDE { | 4909 virtual void Generate() { |
4918 codegen()->DoDeferredInstanceMigration(instr_, object_); | 4910 codegen()->DoDeferredInstanceMigration(instr_, object_); |
4919 } | 4911 } |
4920 Label* check_maps() { return &check_maps_; } | 4912 Label* check_maps() { return &check_maps_; } |
4921 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | 4913 virtual LInstruction* instr() { return instr_; } |
4922 private: | 4914 private: |
4923 LCheckMaps* instr_; | 4915 LCheckMaps* instr_; |
4924 Label check_maps_; | 4916 Label check_maps_; |
4925 Register object_; | 4917 Register object_; |
4926 }; | 4918 }; |
4927 | 4919 |
4928 if (instr->hydrogen()->CanOmitMapChecks()) return; | 4920 if (instr->hydrogen()->CanOmitMapChecks()) return; |
4929 | 4921 |
4930 LOperand* input = instr->value(); | 4922 LOperand* input = instr->value(); |
4931 ASSERT(input->IsRegister()); | 4923 ASSERT(input->IsRegister()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5001 // smi | 4993 // smi |
5002 __ bind(&is_smi); | 4994 __ bind(&is_smi); |
5003 __ SmiToInteger32(input_reg, input_reg); | 4995 __ SmiToInteger32(input_reg, input_reg); |
5004 __ ClampUint8(input_reg); | 4996 __ ClampUint8(input_reg); |
5005 | 4997 |
5006 __ bind(&done); | 4998 __ bind(&done); |
5007 } | 4999 } |
5008 | 5000 |
5009 | 5001 |
5010 void LCodeGen::DoAllocate(LAllocate* instr) { | 5002 void LCodeGen::DoAllocate(LAllocate* instr) { |
5011 class DeferredAllocate V8_FINAL : public LDeferredCode { | 5003 class DeferredAllocate: public LDeferredCode { |
5012 public: | 5004 public: |
5013 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5005 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5014 : LDeferredCode(codegen), instr_(instr) { } | 5006 : LDeferredCode(codegen), instr_(instr) { } |
5015 virtual void Generate() V8_OVERRIDE { | 5007 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } |
5016 codegen()->DoDeferredAllocate(instr_); | 5008 virtual LInstruction* instr() { return instr_; } |
5017 } | |
5018 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5019 private: | 5009 private: |
5020 LAllocate* instr_; | 5010 LAllocate* instr_; |
5021 }; | 5011 }; |
5022 | 5012 |
5023 DeferredAllocate* deferred = | 5013 DeferredAllocate* deferred = |
5024 new(zone()) DeferredAllocate(this, instr); | 5014 new(zone()) DeferredAllocate(this, instr); |
5025 | 5015 |
5026 Register result = ToRegister(instr->result()); | 5016 Register result = ToRegister(instr->result()); |
5027 Register temp = ToRegister(instr->temp()); | 5017 Register temp = ToRegister(instr->temp()); |
5028 | 5018 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5364 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 5354 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
5365 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | 5355 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); |
5366 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); | 5356 RecordSafepointWithLazyDeopt(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0); |
5367 ASSERT(instr->HasEnvironment()); | 5357 ASSERT(instr->HasEnvironment()); |
5368 LEnvironment* env = instr->environment(); | 5358 LEnvironment* env = instr->environment(); |
5369 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5359 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5370 } | 5360 } |
5371 | 5361 |
5372 | 5362 |
5373 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 5363 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
5374 class DeferredStackCheck V8_FINAL : public LDeferredCode { | 5364 class DeferredStackCheck: public LDeferredCode { |
5375 public: | 5365 public: |
5376 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 5366 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
5377 : LDeferredCode(codegen), instr_(instr) { } | 5367 : LDeferredCode(codegen), instr_(instr) { } |
5378 virtual void Generate() V8_OVERRIDE { | 5368 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
5379 codegen()->DoDeferredStackCheck(instr_); | 5369 virtual LInstruction* instr() { return instr_; } |
5380 } | |
5381 virtual LInstruction* instr() V8_OVERRIDE { return instr_; } | |
5382 private: | 5370 private: |
5383 LStackCheck* instr_; | 5371 LStackCheck* instr_; |
5384 }; | 5372 }; |
5385 | 5373 |
5386 ASSERT(instr->HasEnvironment()); | 5374 ASSERT(instr->HasEnvironment()); |
5387 LEnvironment* env = instr->environment(); | 5375 LEnvironment* env = instr->environment(); |
5388 // There is no LLazyBailout instruction for stack-checks. We have to | 5376 // There is no LLazyBailout instruction for stack-checks. We have to |
5389 // prepare for lazy deoptimization explicitly here. | 5377 // prepare for lazy deoptimization explicitly here. |
5390 if (instr->hydrogen()->is_function_entry()) { | 5378 if (instr->hydrogen()->is_function_entry()) { |
5391 // Perform stack overflow check. | 5379 // Perform stack overflow check. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5522 FixedArray::kHeaderSize - kPointerSize)); | 5510 FixedArray::kHeaderSize - kPointerSize)); |
5523 __ bind(&done); | 5511 __ bind(&done); |
5524 } | 5512 } |
5525 | 5513 |
5526 | 5514 |
5527 #undef __ | 5515 #undef __ |
5528 | 5516 |
5529 } } // namespace v8::internal | 5517 } } // namespace v8::internal |
5530 | 5518 |
5531 #endif // V8_TARGET_ARCH_X64 | 5519 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |