OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3663 } else { | 3663 } else { |
3664 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3664 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3665 ParameterCount count(arity); | 3665 ParameterCount count(arity); |
3666 ParameterCount expected(formal_parameter_count); | 3666 ParameterCount expected(formal_parameter_count); |
3667 __ InvokeFunction( | 3667 __ InvokeFunction( |
3668 function, expected, count, CALL_FUNCTION, generator, call_kind); | 3668 function, expected, count, CALL_FUNCTION, generator, call_kind); |
3669 } | 3669 } |
3670 } | 3670 } |
3671 | 3671 |
3672 | 3672 |
3673 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { | |
3674 ASSERT(ToRegister(instr->result()).is(r0)); | |
3675 CallKnownFunction(instr->hydrogen()->function(), | |
3676 instr->hydrogen()->formal_parameter_count(), | |
3677 instr->arity(), | |
3678 instr, | |
3679 CALL_AS_METHOD, | |
3680 R1_UNINITIALIZED); | |
3681 } | |
3682 | |
3683 | |
3684 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3673 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
3685 ASSERT(instr->context() != NULL); | 3674 ASSERT(instr->context() != NULL); |
3686 ASSERT(ToRegister(instr->context()).is(cp)); | 3675 ASSERT(ToRegister(instr->context()).is(cp)); |
3687 Register input = ToRegister(instr->value()); | 3676 Register input = ToRegister(instr->value()); |
3688 Register result = ToRegister(instr->result()); | 3677 Register result = ToRegister(instr->result()); |
3689 Register scratch = scratch0(); | 3678 Register scratch = scratch0(); |
3690 | 3679 |
3691 // Deoptimize if not a heap number. | 3680 // Deoptimize if not a heap number. |
3692 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); | 3681 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
3693 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3682 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3959 CallKnownFunction(known_function, | 3948 CallKnownFunction(known_function, |
3960 instr->hydrogen()->formal_parameter_count(), | 3949 instr->hydrogen()->formal_parameter_count(), |
3961 instr->arity(), | 3950 instr->arity(), |
3962 instr, | 3951 instr, |
3963 CALL_AS_METHOD, | 3952 CALL_AS_METHOD, |
3964 R1_CONTAINS_TARGET); | 3953 R1_CONTAINS_TARGET); |
3965 } | 3954 } |
3966 } | 3955 } |
3967 | 3956 |
3968 | 3957 |
3969 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 3958 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
3970 ASSERT(ToRegister(instr->context()).is(cp)); | |
3971 ASSERT(ToRegister(instr->result()).is(r0)); | 3959 ASSERT(ToRegister(instr->result()).is(r0)); |
3972 | 3960 |
3973 int arity = instr->arity(); | 3961 LPointerMap* pointers = instr->pointer_map(); |
3974 Handle<Code> ic = | 3962 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3975 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 3963 |
3976 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3964 if (instr->target()->IsConstantOperand()) { |
3965 LConstantOperand* target = LConstantOperand::cast(instr->target()); | |
3966 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | |
3967 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); | |
3968 PlatformCallInterfaceDescriptor* armCallDesc = | |
Toon Verwaest
2014/01/03 07:14:07
What about just "call_descriptor ="? It's quite ob
| |
3969 instr->descriptor()->platform_specific_descriptor(); | |
Toon Verwaest
2014/01/03 07:14:07
4-space indent
| |
3970 __ Call(code, RelocInfo::CODE_TARGET, TypeFeedbackId::None(), al, | |
3971 armCallDesc->storage_mode()); | |
3972 } else { | |
3973 ASSERT(instr->target()->IsRegister()); | |
3974 Register target = ToRegister(instr->target()); | |
3975 generator.BeforeCall(__ CallSize(target)); | |
3976 __ add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
3977 __ Call(target); | |
3978 } | |
3979 generator.AfterCall(); | |
3977 } | 3980 } |
3978 | 3981 |
3979 | 3982 |
3980 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 3983 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3981 ASSERT(ToRegister(instr->context()).is(cp)); | 3984 ASSERT(ToRegister(instr->function()).is(r1)); |
3985 ASSERT(ToRegister(instr->call_kind()).is(r5)); | |
3982 ASSERT(ToRegister(instr->result()).is(r0)); | 3986 ASSERT(ToRegister(instr->result()).is(r0)); |
3983 | 3987 |
3984 int arity = instr->arity(); | 3988 if (instr->hydrogen()->pass_argument_count()) { |
3985 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | 3989 __ mov(r0, Operand(instr->arity())); |
3986 Handle<Code> ic = | 3990 } |
3987 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3991 |
3988 __ mov(r2, Operand(instr->name())); | 3992 // Change context. |
3989 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); | 3993 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
3994 | |
3995 // Load the code entry address | |
3996 __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | |
3997 __ Call(ip); | |
3998 | |
3999 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | |
3990 } | 4000 } |
3991 | 4001 |
3992 | 4002 |
3993 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4003 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
3994 ASSERT(ToRegister(instr->context()).is(cp)); | 4004 ASSERT(ToRegister(instr->context()).is(cp)); |
3995 ASSERT(ToRegister(instr->function()).is(r1)); | 4005 ASSERT(ToRegister(instr->function()).is(r1)); |
3996 ASSERT(ToRegister(instr->result()).is(r0)); | 4006 ASSERT(ToRegister(instr->result()).is(r0)); |
3997 | 4007 |
3998 int arity = instr->arity(); | 4008 int arity = instr->arity(); |
3999 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4009 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
(...skipping 12 matching lines...) Expand all Loading... | |
4012 | 4022 |
4013 int arity = instr->arity(); | 4023 int arity = instr->arity(); |
4014 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4024 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
4015 Handle<Code> ic = | 4025 Handle<Code> ic = |
4016 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4026 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); |
4017 __ mov(r2, Operand(instr->name())); | 4027 __ mov(r2, Operand(instr->name())); |
4018 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); | 4028 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); |
4019 } | 4029 } |
4020 | 4030 |
4021 | 4031 |
4022 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | |
4023 ASSERT(ToRegister(instr->result()).is(r0)); | |
4024 CallKnownFunction(instr->hydrogen()->target(), | |
4025 instr->hydrogen()->formal_parameter_count(), | |
4026 instr->arity(), | |
4027 instr, | |
4028 CALL_AS_FUNCTION, | |
4029 R1_UNINITIALIZED); | |
4030 } | |
4031 | |
4032 | |
4033 void LCodeGen::DoCallNew(LCallNew* instr) { | 4032 void LCodeGen::DoCallNew(LCallNew* instr) { |
4034 ASSERT(ToRegister(instr->context()).is(cp)); | 4033 ASSERT(ToRegister(instr->context()).is(cp)); |
4035 ASSERT(ToRegister(instr->constructor()).is(r1)); | 4034 ASSERT(ToRegister(instr->constructor()).is(r1)); |
4036 ASSERT(ToRegister(instr->result()).is(r0)); | 4035 ASSERT(ToRegister(instr->result()).is(r0)); |
4037 | 4036 |
4038 __ mov(r0, Operand(instr->arity())); | 4037 __ mov(r0, Operand(instr->arity())); |
4039 // No cell in r2 for construct type feedback in optimized code | 4038 // No cell in r2 for construct type feedback in optimized code |
4040 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); | 4039 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); |
4041 __ mov(r2, Operand(undefined_value)); | 4040 __ mov(r2, Operand(undefined_value)); |
4042 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 4041 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5817 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5816 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5818 __ ldr(result, FieldMemOperand(scratch, | 5817 __ ldr(result, FieldMemOperand(scratch, |
5819 FixedArray::kHeaderSize - kPointerSize)); | 5818 FixedArray::kHeaderSize - kPointerSize)); |
5820 __ bind(&done); | 5819 __ bind(&done); |
5821 } | 5820 } |
5822 | 5821 |
5823 | 5822 |
5824 #undef __ | 5823 #undef __ |
5825 | 5824 |
5826 } } // namespace v8::internal | 5825 } } // namespace v8::internal |
OLD | NEW |