OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 4015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4026 } | 4026 } |
4027 } | 4027 } |
4028 | 4028 |
4029 | 4029 |
4030 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4030 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4031 DCHECK(ToRegister(instr->context()).is(rsi)); | 4031 DCHECK(ToRegister(instr->context()).is(rsi)); |
4032 DCHECK(ToRegister(instr->function()).is(rdi)); | 4032 DCHECK(ToRegister(instr->function()).is(rdi)); |
4033 DCHECK(ToRegister(instr->result()).is(rax)); | 4033 DCHECK(ToRegister(instr->result()).is(rax)); |
4034 | 4034 |
4035 int arity = instr->arity(); | 4035 int arity = instr->arity(); |
4036 CallFunctionFlags flags = instr->hydrogen()->function_flags(); | 4036 CallFunctionStub stub(isolate(), arity, instr->hydrogen()->function_flags()); |
4037 if (instr->hydrogen()->HasVectorAndSlot()) { | 4037 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4038 Register slot_register = ToRegister(instr->temp_slot()); | |
4039 Register vector_register = ToRegister(instr->temp_vector()); | |
4040 DCHECK(slot_register.is(rdx)); | |
4041 DCHECK(vector_register.is(rbx)); | |
4042 | |
4043 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | |
4044 int index = vector->GetIndex(instr->hydrogen()->slot()); | |
4045 | |
4046 __ Move(vector_register, vector); | |
4047 __ Move(slot_register, Smi::FromInt(index)); | |
4048 | |
4049 CallICState::CallType call_type = | |
4050 (flags & CALL_AS_METHOD) ? CallICState::METHOD : CallICState::FUNCTION; | |
4051 | |
4052 Handle<Code> ic = | |
4053 CodeFactory::CallICInOptimizedCode(isolate(), arity, call_type).code(); | |
4054 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
4055 } else { | |
4056 CallFunctionStub stub(isolate(), arity, flags); | |
4057 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | |
4058 } | |
4059 } | 4038 } |
4060 | 4039 |
4061 | 4040 |
4062 void LCodeGen::DoCallNew(LCallNew* instr) { | 4041 void LCodeGen::DoCallNew(LCallNew* instr) { |
4063 DCHECK(ToRegister(instr->context()).is(rsi)); | 4042 DCHECK(ToRegister(instr->context()).is(rsi)); |
4064 DCHECK(ToRegister(instr->constructor()).is(rdi)); | 4043 DCHECK(ToRegister(instr->constructor()).is(rdi)); |
4065 DCHECK(ToRegister(instr->result()).is(rax)); | 4044 DCHECK(ToRegister(instr->result()).is(rax)); |
4066 | 4045 |
4067 __ Set(rax, instr->arity()); | 4046 __ Set(rax, instr->arity()); |
4068 // No cell in ebx for construct type feedback in optimized code | 4047 // No cell in ebx for construct type feedback in optimized code |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5929 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5908 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5930 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5909 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5931 } | 5910 } |
5932 | 5911 |
5933 | 5912 |
5934 #undef __ | 5913 #undef __ |
5935 | 5914 |
5936 } } // namespace v8::internal | 5915 } } // namespace v8::internal |
5937 | 5916 |
5938 #endif // V8_TARGET_ARCH_X64 | 5917 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |