Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/crankshaft/x64/lithium-codegen-x64.cc

Issue 1609893003: [es6] Tail calls support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Support for CS and TF compilers added Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" 7 #include "src/crankshaft/x64/lithium-codegen-x64.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3723 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 __ InvokeFunction(rdi, no_reg, count, CALL_FUNCTION, generator); 3734 __ InvokeFunction(rdi, no_reg, count, CALL_FUNCTION, generator);
3735 } else { 3735 } else {
3736 CallKnownFunction(known_function, 3736 CallKnownFunction(known_function,
3737 instr->hydrogen()->formal_parameter_count(), 3737 instr->hydrogen()->formal_parameter_count(),
3738 instr->arity(), instr); 3738 instr->arity(), instr);
3739 } 3739 }
3740 } 3740 }
3741 3741
3742 3742
3743 void LCodeGen::DoCallFunction(LCallFunction* instr) { 3743 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3744 HCallFunction* hinstr = instr->hydrogen();
3744 DCHECK(ToRegister(instr->context()).is(rsi)); 3745 DCHECK(ToRegister(instr->context()).is(rsi));
3745 DCHECK(ToRegister(instr->function()).is(rdi)); 3746 DCHECK(ToRegister(instr->function()).is(rdi));
3746 DCHECK(ToRegister(instr->result()).is(rax)); 3747 DCHECK(ToRegister(instr->result()).is(rax));
3747 3748
3748 int arity = instr->arity(); 3749 int arity = instr->arity();
3749 ConvertReceiverMode mode = instr->hydrogen()->convert_mode(); 3750
3750 if (instr->hydrogen()->HasVectorAndSlot()) { 3751 ConvertReceiverMode mode = hinstr->convert_mode();
3752 TailCallMode tail_call_mode = hinstr->tail_call_mode();
3753 if (hinstr->HasVectorAndSlot()) {
3751 Register slot_register = ToRegister(instr->temp_slot()); 3754 Register slot_register = ToRegister(instr->temp_slot());
3752 Register vector_register = ToRegister(instr->temp_vector()); 3755 Register vector_register = ToRegister(instr->temp_vector());
3753 DCHECK(slot_register.is(rdx)); 3756 DCHECK(slot_register.is(rdx));
3754 DCHECK(vector_register.is(rbx)); 3757 DCHECK(vector_register.is(rbx));
3755 3758
3756 AllowDeferredHandleDereference vector_structure_check; 3759 AllowDeferredHandleDereference vector_structure_check;
3757 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); 3760 Handle<TypeFeedbackVector> vector = hinstr->feedback_vector();
3758 int index = vector->GetIndex(instr->hydrogen()->slot()); 3761 int index = vector->GetIndex(hinstr->slot());
3759 3762
3760 __ Move(vector_register, vector); 3763 __ Move(vector_register, vector);
3761 __ Move(slot_register, Smi::FromInt(index)); 3764 __ Move(slot_register, Smi::FromInt(index));
3762 3765
3763 Handle<Code> ic = 3766 // TODO(ishell): propagate correct TailCallMode
3764 CodeFactory::CallICInOptimizedCode(isolate(), arity, mode).code(); 3767 Handle<Code> ic = CodeFactory::CallICInOptimizedCode(isolate(), arity, mode,
3768 tail_call_mode)
3769 .code();
3765 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3770 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3766 } else { 3771 } else {
3767 __ Set(rax, arity); 3772 __ Set(rax, arity);
3768 CallCode(isolate()->builtins()->Call(mode), RelocInfo::CODE_TARGET, instr); 3773 CallCode(isolate()->builtins()->Call(mode, tail_call_mode),
3774 RelocInfo::CODE_TARGET, instr);
3769 } 3775 }
3770 } 3776 }
3771 3777
3772 3778
3773 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { 3779 void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
3774 DCHECK(ToRegister(instr->context()).is(rsi)); 3780 DCHECK(ToRegister(instr->context()).is(rsi));
3775 DCHECK(ToRegister(instr->constructor()).is(rdi)); 3781 DCHECK(ToRegister(instr->constructor()).is(rdi));
3776 DCHECK(ToRegister(instr->result()).is(rax)); 3782 DCHECK(ToRegister(instr->result()).is(rax));
3777 3783
3778 __ Set(rax, instr->arity()); 3784 __ Set(rax, instr->arity());
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
5662 RecordSafepoint(Safepoint::kNoLazyDeopt); 5668 RecordSafepoint(Safepoint::kNoLazyDeopt);
5663 } 5669 }
5664 5670
5665 5671
5666 #undef __ 5672 #undef __
5667 5673
5668 } // namespace internal 5674 } // namespace internal
5669 } // namespace v8 5675 } // namespace v8
5670 5676
5671 #endif // V8_TARGET_ARCH_X64 5677 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698