| 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 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3668 } else { | 3668 } else { |
| 3669 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3669 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| 3670 ParameterCount count(arity); | 3670 ParameterCount count(arity); |
| 3671 ParameterCount expected(formal_parameter_count); | 3671 ParameterCount expected(formal_parameter_count); |
| 3672 __ InvokeFunction( | 3672 __ InvokeFunction( |
| 3673 function, expected, count, CALL_FUNCTION, generator, call_kind); | 3673 function, expected, count, CALL_FUNCTION, generator, call_kind); |
| 3674 } | 3674 } |
| 3675 } | 3675 } |
| 3676 | 3676 |
| 3677 | 3677 |
| 3678 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { | |
| 3679 ASSERT(ToRegister(instr->result()).is(r0)); | |
| 3680 CallKnownFunction(instr->hydrogen()->function(), | |
| 3681 instr->hydrogen()->formal_parameter_count(), | |
| 3682 instr->arity(), | |
| 3683 instr, | |
| 3684 CALL_AS_METHOD, | |
| 3685 R1_UNINITIALIZED); | |
| 3686 } | |
| 3687 | |
| 3688 | |
| 3689 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3678 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
| 3690 ASSERT(instr->context() != NULL); | 3679 ASSERT(instr->context() != NULL); |
| 3691 ASSERT(ToRegister(instr->context()).is(cp)); | 3680 ASSERT(ToRegister(instr->context()).is(cp)); |
| 3692 Register input = ToRegister(instr->value()); | 3681 Register input = ToRegister(instr->value()); |
| 3693 Register result = ToRegister(instr->result()); | 3682 Register result = ToRegister(instr->result()); |
| 3694 Register scratch = scratch0(); | 3683 Register scratch = scratch0(); |
| 3695 | 3684 |
| 3696 // Deoptimize if not a heap number. | 3685 // Deoptimize if not a heap number. |
| 3697 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); | 3686 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3698 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3687 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3966 CallKnownFunction(known_function, | 3955 CallKnownFunction(known_function, |
| 3967 instr->hydrogen()->formal_parameter_count(), | 3956 instr->hydrogen()->formal_parameter_count(), |
| 3968 instr->arity(), | 3957 instr->arity(), |
| 3969 instr, | 3958 instr, |
| 3970 CALL_AS_METHOD, | 3959 CALL_AS_METHOD, |
| 3971 R1_CONTAINS_TARGET); | 3960 R1_CONTAINS_TARGET); |
| 3972 } | 3961 } |
| 3973 } | 3962 } |
| 3974 | 3963 |
| 3975 | 3964 |
| 3976 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 3965 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
| 3977 ASSERT(ToRegister(instr->context()).is(cp)); | |
| 3978 ASSERT(ToRegister(instr->result()).is(r0)); | 3966 ASSERT(ToRegister(instr->result()).is(r0)); |
| 3979 | 3967 |
| 3980 int arity = instr->arity(); | 3968 LPointerMap* pointers = instr->pointer_map(); |
| 3981 Handle<Code> ic = | 3969 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| 3982 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 3970 |
| 3983 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3971 if (instr->target()->IsConstantOperand()) { |
| 3972 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
| 3973 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
| 3974 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); |
| 3975 __ Call(code, RelocInfo::CODE_TARGET); |
| 3976 } else { |
| 3977 ASSERT(instr->target()->IsRegister()); |
| 3978 Register target = ToRegister(instr->target()); |
| 3979 generator.BeforeCall(__ CallSize(target)); |
| 3980 __ add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 3981 __ Call(target); |
| 3982 } |
| 3983 generator.AfterCall(); |
| 3984 } | 3984 } |
| 3985 | 3985 |
| 3986 | 3986 |
| 3987 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 3987 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
| 3988 ASSERT(ToRegister(instr->context()).is(cp)); | 3988 ASSERT(ToRegister(instr->function()).is(r1)); |
| 3989 ASSERT(ToRegister(instr->call_kind()).is(r5)); |
| 3989 ASSERT(ToRegister(instr->result()).is(r0)); | 3990 ASSERT(ToRegister(instr->result()).is(r0)); |
| 3990 | 3991 |
| 3991 int arity = instr->arity(); | 3992 if (instr->hydrogen()->pass_argument_count()) { |
| 3992 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | 3993 __ mov(r0, Operand(instr->arity())); |
| 3993 Handle<Code> ic = | 3994 } |
| 3994 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3995 |
| 3995 __ mov(r2, Operand(instr->name())); | 3996 // Change context. |
| 3996 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); | 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); |
| 3997 } | 4004 } |
| 3998 | 4005 |
| 3999 | 4006 |
| 4000 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 4007 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 4001 ASSERT(ToRegister(instr->context()).is(cp)); | 4008 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4002 ASSERT(ToRegister(instr->function()).is(r1)); | 4009 ASSERT(ToRegister(instr->function()).is(r1)); |
| 4003 ASSERT(ToRegister(instr->result()).is(r0)); | 4010 ASSERT(ToRegister(instr->result()).is(r0)); |
| 4004 | 4011 |
| 4005 int arity = instr->arity(); | 4012 int arity = instr->arity(); |
| 4006 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 4013 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4019 | 4026 |
| 4020 int arity = instr->arity(); | 4027 int arity = instr->arity(); |
| 4021 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | 4028 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; |
| 4022 Handle<Code> ic = | 4029 Handle<Code> ic = |
| 4023 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 4030 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); |
| 4024 __ mov(r2, Operand(instr->name())); | 4031 __ mov(r2, Operand(instr->name())); |
| 4025 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); | 4032 CallCode(ic, mode, instr, NEVER_INLINE_TARGET_ADDRESS); |
| 4026 } | 4033 } |
| 4027 | 4034 |
| 4028 | 4035 |
| 4029 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | |
| 4030 ASSERT(ToRegister(instr->result()).is(r0)); | |
| 4031 CallKnownFunction(instr->hydrogen()->target(), | |
| 4032 instr->hydrogen()->formal_parameter_count(), | |
| 4033 instr->arity(), | |
| 4034 instr, | |
| 4035 CALL_AS_FUNCTION, | |
| 4036 R1_UNINITIALIZED); | |
| 4037 } | |
| 4038 | |
| 4039 | |
| 4040 void LCodeGen::DoCallNew(LCallNew* instr) { | 4036 void LCodeGen::DoCallNew(LCallNew* instr) { |
| 4041 ASSERT(ToRegister(instr->context()).is(cp)); | 4037 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4042 ASSERT(ToRegister(instr->constructor()).is(r1)); | 4038 ASSERT(ToRegister(instr->constructor()).is(r1)); |
| 4043 ASSERT(ToRegister(instr->result()).is(r0)); | 4039 ASSERT(ToRegister(instr->result()).is(r0)); |
| 4044 | 4040 |
| 4045 __ mov(r0, Operand(instr->arity())); | 4041 __ mov(r0, Operand(instr->arity())); |
| 4046 // No cell in r2 for construct type feedback in optimized code | 4042 // No cell in r2 for construct type feedback in optimized code |
| 4047 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); | 4043 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); |
| 4048 __ mov(r2, Operand(undefined_value)); | 4044 __ mov(r2, Operand(undefined_value)); |
| 4049 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 4045 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5824 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5820 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5825 __ ldr(result, FieldMemOperand(scratch, | 5821 __ ldr(result, FieldMemOperand(scratch, |
| 5826 FixedArray::kHeaderSize - kPointerSize)); | 5822 FixedArray::kHeaderSize - kPointerSize)); |
| 5827 __ bind(&done); | 5823 __ bind(&done); |
| 5828 } | 5824 } |
| 5829 | 5825 |
| 5830 | 5826 |
| 5831 #undef __ | 5827 #undef __ |
| 5832 | 5828 |
| 5833 } } // namespace v8::internal | 5829 } } // namespace v8::internal |
| OLD | NEW |