OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 4053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4064 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 4064 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
4065 } | 4065 } |
4066 | 4066 |
4067 | 4067 |
4068 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4068 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
4069 DCHECK(ToRegister(instr->context()).is(cp)); | 4069 DCHECK(ToRegister(instr->context()).is(cp)); |
4070 DCHECK(ToRegister(instr->function()).is(a1)); | 4070 DCHECK(ToRegister(instr->function()).is(a1)); |
4071 DCHECK(ToRegister(instr->result()).is(v0)); | 4071 DCHECK(ToRegister(instr->result()).is(v0)); |
4072 | 4072 |
4073 int arity = instr->arity(); | 4073 int arity = instr->arity(); |
4074 CallFunctionStub stub(isolate(), arity, instr->hydrogen()->function_flags()); | 4074 CallFunctionFlags flags = instr->hydrogen()->function_flags(); |
4075 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4075 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4076 Register slot_register = ToRegister(instr->temp_slot()); |
| 4077 Register vector_register = ToRegister(instr->temp_vector()); |
| 4078 DCHECK(slot_register.is(a3)); |
| 4079 DCHECK(vector_register.is(a2)); |
| 4080 |
| 4081 AllowDeferredHandleDereference vector_structure_check; |
| 4082 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
| 4083 int index = vector->GetIndex(instr->hydrogen()->slot()); |
| 4084 |
| 4085 __ li(vector_register, vector); |
| 4086 __ li(slot_register, Operand(Smi::FromInt(index))); |
| 4087 |
| 4088 CallICState::CallType call_type = |
| 4089 (flags & CALL_AS_METHOD) ? CallICState::METHOD : CallICState::FUNCTION; |
| 4090 |
| 4091 Handle<Code> ic = |
| 4092 CodeFactory::CallICInOptimizedCode(isolate(), arity, call_type).code(); |
| 4093 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4094 } else { |
| 4095 CallFunctionStub stub(isolate(), arity, flags); |
| 4096 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 4097 } |
4076 } | 4098 } |
4077 | 4099 |
4078 | 4100 |
4079 void LCodeGen::DoCallNew(LCallNew* instr) { | 4101 void LCodeGen::DoCallNew(LCallNew* instr) { |
4080 DCHECK(ToRegister(instr->context()).is(cp)); | 4102 DCHECK(ToRegister(instr->context()).is(cp)); |
4081 DCHECK(ToRegister(instr->constructor()).is(a1)); | 4103 DCHECK(ToRegister(instr->constructor()).is(a1)); |
4082 DCHECK(ToRegister(instr->result()).is(v0)); | 4104 DCHECK(ToRegister(instr->result()).is(v0)); |
4083 | 4105 |
4084 __ li(a0, Operand(instr->arity())); | 4106 __ li(a0, Operand(instr->arity())); |
4085 // No cell in a2 for construct type feedback in optimized code | 4107 // No cell in a2 for construct type feedback in optimized code |
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5984 __ li(at, scope_info); | 6006 __ li(at, scope_info); |
5985 __ Push(at, ToRegister(instr->function())); | 6007 __ Push(at, ToRegister(instr->function())); |
5986 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6008 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5987 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6009 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5988 } | 6010 } |
5989 | 6011 |
5990 | 6012 |
5991 #undef __ | 6013 #undef __ |
5992 | 6014 |
5993 } } // namespace v8::internal | 6015 } } // namespace v8::internal |
OLD | NEW |