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