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 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3669 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 3669 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3670 } else { | 3670 } else { |
3671 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3671 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3672 ParameterCount count(arity); | 3672 ParameterCount count(arity); |
3673 ParameterCount expected(formal_parameter_count); | 3673 ParameterCount expected(formal_parameter_count); |
3674 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); | 3674 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); |
3675 } | 3675 } |
3676 } | 3676 } |
3677 | 3677 |
3678 | 3678 |
3679 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { | |
3680 ASSERT(ToRegister(instr->result()).is(r0)); | |
3681 CallKnownFunction(instr->hydrogen()->function(), | |
3682 instr->hydrogen()->formal_parameter_count(), | |
3683 instr->arity(), | |
3684 instr, | |
3685 R1_UNINITIALIZED); | |
3686 } | |
3687 | |
3688 | |
3689 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3679 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
3690 ASSERT(instr->context() != NULL); | 3680 ASSERT(instr->context() != NULL); |
3691 ASSERT(ToRegister(instr->context()).is(cp)); | 3681 ASSERT(ToRegister(instr->context()).is(cp)); |
3692 Register input = ToRegister(instr->value()); | 3682 Register input = ToRegister(instr->value()); |
3693 Register result = ToRegister(instr->result()); | 3683 Register result = ToRegister(instr->result()); |
3694 Register scratch = scratch0(); | 3684 Register scratch = scratch0(); |
3695 | 3685 |
3696 // Deoptimize if not a heap number. | 3686 // Deoptimize if not a heap number. |
3697 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); | 3687 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
3698 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3688 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3963 } else { | 3953 } else { |
3964 CallKnownFunction(known_function, | 3954 CallKnownFunction(known_function, |
3965 instr->hydrogen()->formal_parameter_count(), | 3955 instr->hydrogen()->formal_parameter_count(), |
3966 instr->arity(), | 3956 instr->arity(), |
3967 instr, | 3957 instr, |
3968 R1_CONTAINS_TARGET); | 3958 R1_CONTAINS_TARGET); |
3969 } | 3959 } |
3970 } | 3960 } |
3971 | 3961 |
3972 | 3962 |
3973 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 3963 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
3974 ASSERT(ToRegister(instr->context()).is(cp)); | |
3975 ASSERT(ToRegister(instr->result()).is(r0)); | 3964 ASSERT(ToRegister(instr->result()).is(r0)); |
3976 | 3965 |
3977 int arity = instr->arity(); | 3966 LPointerMap* pointers = instr->pointer_map(); |
3978 Handle<Code> ic = | 3967 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3979 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 3968 |
3980 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3969 if (instr->target()->IsConstantOperand()) { |
| 3970 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
| 3971 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
| 3972 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); |
| 3973 PlatformCallInterfaceDescriptor* call_descriptor = |
| 3974 instr->descriptor()->platform_specific_descriptor(); |
| 3975 __ Call(code, RelocInfo::CODE_TARGET, TypeFeedbackId::None(), al, |
| 3976 call_descriptor->storage_mode()); |
| 3977 } else { |
| 3978 ASSERT(instr->target()->IsRegister()); |
| 3979 Register target = ToRegister(instr->target()); |
| 3980 generator.BeforeCall(__ CallSize(target)); |
| 3981 __ add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 3982 __ Call(target); |
| 3983 } |
| 3984 generator.AfterCall(); |
3981 } | 3985 } |
3982 | 3986 |
3983 | 3987 |
3984 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 3988 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
3985 ASSERT(ToRegister(instr->context()).is(cp)); | 3989 ASSERT(ToRegister(instr->function()).is(r1)); |
3986 ASSERT(ToRegister(instr->result()).is(r0)); | 3990 ASSERT(ToRegister(instr->result()).is(r0)); |
3987 | 3991 |
3988 int arity = instr->arity(); | 3992 if (instr->hydrogen()->pass_argument_count()) { |
3989 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity); | 3993 __ mov(r0, Operand(instr->arity())); |
3990 __ mov(r2, Operand(instr->name())); | 3994 } |
3991 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3995 |
| 3996 // Change context. |
| 3997 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 3998 |
| 3999 // Load the code entry address |
| 4000 __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 4001 __ Call(ip); |
| 4002 |
| 4003 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
3992 } | 4004 } |
3993 | 4005 |
3994 | 4006 |
3995 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4007 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
3996 ASSERT(ToRegister(instr->context()).is(cp)); | 4008 ASSERT(ToRegister(instr->context()).is(cp)); |
3997 ASSERT(ToRegister(instr->function()).is(r1)); | 4009 ASSERT(ToRegister(instr->function()).is(r1)); |
3998 ASSERT(ToRegister(instr->result()).is(r0)); | 4010 ASSERT(ToRegister(instr->result()).is(r0)); |
3999 | 4011 |
4000 int arity = instr->arity(); | 4012 int arity = instr->arity(); |
4001 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4013 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
4002 if (instr->hydrogen()->IsTailCall()) { | 4014 if (instr->hydrogen()->IsTailCall()) { |
4003 if (NeedsEagerFrame()) __ mov(sp, fp); | 4015 if (NeedsEagerFrame()) __ mov(sp, fp); |
4004 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 4016 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
4005 } else { | 4017 } else { |
4006 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 4018 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
4007 } | 4019 } |
4008 } | 4020 } |
4009 | 4021 |
4010 | 4022 |
4011 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | |
4012 ASSERT(ToRegister(instr->result()).is(r0)); | |
4013 CallKnownFunction(instr->hydrogen()->target(), | |
4014 instr->hydrogen()->formal_parameter_count(), | |
4015 instr->arity(), | |
4016 instr, | |
4017 R1_UNINITIALIZED); | |
4018 } | |
4019 | |
4020 | |
4021 void LCodeGen::DoCallNew(LCallNew* instr) { | 4023 void LCodeGen::DoCallNew(LCallNew* instr) { |
4022 ASSERT(ToRegister(instr->context()).is(cp)); | 4024 ASSERT(ToRegister(instr->context()).is(cp)); |
4023 ASSERT(ToRegister(instr->constructor()).is(r1)); | 4025 ASSERT(ToRegister(instr->constructor()).is(r1)); |
4024 ASSERT(ToRegister(instr->result()).is(r0)); | 4026 ASSERT(ToRegister(instr->result()).is(r0)); |
4025 | 4027 |
4026 __ mov(r0, Operand(instr->arity())); | 4028 __ mov(r0, Operand(instr->arity())); |
4027 // No cell in r2 for construct type feedback in optimized code | 4029 // No cell in r2 for construct type feedback in optimized code |
4028 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); | 4030 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); |
4029 __ mov(r2, Operand(undefined_value)); | 4031 __ mov(r2, Operand(undefined_value)); |
4030 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 4032 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5800 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5802 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5801 __ ldr(result, FieldMemOperand(scratch, | 5803 __ ldr(result, FieldMemOperand(scratch, |
5802 FixedArray::kHeaderSize - kPointerSize)); | 5804 FixedArray::kHeaderSize - kPointerSize)); |
5803 __ bind(&done); | 5805 __ bind(&done); |
5804 } | 5806 } |
5805 | 5807 |
5806 | 5808 |
5807 #undef __ | 5809 #undef __ |
5808 | 5810 |
5809 } } // namespace v8::internal | 5811 } } // namespace v8::internal |
OLD | NEW |