| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3923 __ Jump(lr); | 3923 __ Jump(lr); |
| 3924 | 3924 |
| 3925 // Slow-case: Handle non-smi or out-of-bounds access to arguments | 3925 // Slow-case: Handle non-smi or out-of-bounds access to arguments |
| 3926 // by calling the runtime system. | 3926 // by calling the runtime system. |
| 3927 __ bind(&slow); | 3927 __ bind(&slow); |
| 3928 __ push(r1); | 3928 __ push(r1); |
| 3929 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); | 3929 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); |
| 3930 } | 3930 } |
| 3931 | 3931 |
| 3932 | 3932 |
| 3933 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { | |
| 3934 UNIMPLEMENTED(); | |
| 3935 } | |
| 3936 | |
| 3937 | |
| 3938 void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { | |
| 3939 UNIMPLEMENTED(); | |
| 3940 } | |
| 3941 | |
| 3942 | |
| 3943 void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) { | 3933 void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) { |
| 3944 // sp[0] : number of parameters | 3934 // sp[0] : number of parameters |
| 3945 // sp[4] : receiver displacement | 3935 // sp[4] : receiver displacement |
| 3946 // sp[8] : function | 3936 // sp[8] : function |
| 3947 | 3937 |
| 3948 // Check if the calling frame is an arguments adaptor frame. | 3938 // Check if the calling frame is an arguments adaptor frame. |
| 3939 Label runtime; |
| 3940 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 3941 __ ldr(r2, MemOperand(r3, StandardFrameConstants::kContextOffset)); |
| 3942 __ cmp(r2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 3943 __ b(ne, &runtime); |
| 3944 |
| 3945 // Patch the arguments.length and the parameters pointer in the current frame. |
| 3946 __ ldr(r2, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 3947 __ str(r2, MemOperand(sp, 0 * kPointerSize)); |
| 3948 __ add(r3, r3, Operand(r2, LSL, 1)); |
| 3949 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 3950 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
| 3951 |
| 3952 __ bind(&runtime); |
| 3953 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); |
| 3954 } |
| 3955 |
| 3956 |
| 3957 void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { |
| 3958 // Stack layout: |
| 3959 // sp[0] : number of parameters (tagged) |
| 3960 // sp[4] : address of receiver argument |
| 3961 // sp[8] : function |
| 3962 // Registers used over whole function: |
| 3963 // r6 : allocated object (tagged) |
| 3964 // r9 : mapped parameter count (tagged) |
| 3965 |
| 3966 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
| 3967 // r1 = parameter count (tagged) |
| 3968 |
| 3969 // Check if the calling frame is an arguments adaptor frame. |
| 3970 Label runtime; |
| 3971 Label adaptor_frame, try_allocate; |
| 3972 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 3973 __ ldr(r2, MemOperand(r3, StandardFrameConstants::kContextOffset)); |
| 3974 __ cmp(r2, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 3975 __ b(eq, &adaptor_frame); |
| 3976 |
| 3977 // No adaptor, parameter count = argument count. |
| 3978 __ mov(r2, r1); |
| 3979 __ b(&try_allocate); |
| 3980 |
| 3981 // We have an adaptor frame. Patch the parameters pointer. |
| 3982 __ bind(&adaptor_frame); |
| 3983 __ ldr(r2, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 3984 __ add(r3, r3, Operand(r2, LSL, 1)); |
| 3985 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 3986 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
| 3987 |
| 3988 // r1 = parameter count (tagged) |
| 3989 // r2 = argument count (tagged) |
| 3990 // Compute the mapped parameter count = min(r1, r2) in r1. |
| 3991 __ cmp(r1, Operand(r2)); |
| 3992 __ mov(r1, Operand(r2), LeaveCC, gt); |
| 3993 |
| 3994 __ bind(&try_allocate); |
| 3995 |
| 3996 // Compute the sizes of backing store, parameter map, and arguments object. |
| 3997 // 1. Parameter map, has 2 extra words containing context and backing store. |
| 3998 const int kParameterMapHeaderSize = |
| 3999 FixedArray::kHeaderSize + 2 * kPointerSize; |
| 4000 // If there are no mapped parameters, we do not need the parameter_map. |
| 4001 __ cmp(r1, Operand(Smi::FromInt(0))); |
| 4002 __ mov(r9, Operand(0), LeaveCC, eq); |
| 4003 __ mov(r9, Operand(r1, LSL, 1), LeaveCC, ne); |
| 4004 __ add(r9, r9, Operand(kParameterMapHeaderSize), LeaveCC, ne); |
| 4005 |
| 4006 // 2. Backing store. |
| 4007 __ add(r9, r9, Operand(r2, LSL, 1)); |
| 4008 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); |
| 4009 |
| 4010 // 3. Arguments object. |
| 4011 __ add(r9, r9, Operand(Heap::kArgumentsObjectSize)); |
| 4012 |
| 4013 // Do the allocation of all three objects in one go. |
| 4014 __ AllocateInNewSpace(r9, r0, r3, r4, &runtime, TAG_OBJECT); |
| 4015 |
| 4016 // r0 = address of new object(s) (tagged) |
| 4017 // r2 = argument count (tagged) |
| 4018 // Get the arguments boilerplate from the current (global) context into r4. |
| 4019 const int kNormalOffset = |
| 4020 Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX); |
| 4021 const int kAliasedOffset = |
| 4022 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); |
| 4023 |
| 4024 __ ldr(r4, MemOperand(r8, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4025 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); |
| 4026 __ cmp(r1, Operand(0)); |
| 4027 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); |
| 4028 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); |
| 4029 |
| 4030 // r0 = address of new object (tagged) |
| 4031 // r1 = mapped parameter count (tagged) |
| 4032 // r2 = argument count (tagged) |
| 4033 // r4 = address of boilerplate object (tagged) |
| 4034 // Copy the JS object part. |
| 4035 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { |
| 4036 __ ldr(r3, FieldMemOperand(r4, i)); |
| 4037 __ str(r3, FieldMemOperand(r0, i)); |
| 4038 } |
| 4039 |
| 4040 // Setup the callee in-object property. |
| 4041 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
| 4042 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); |
| 4043 const int kCalleeOffset = JSObject::kHeaderSize + |
| 4044 Heap::kArgumentsCalleeIndex * kPointerSize; |
| 4045 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); |
| 4046 |
| 4047 // Use the length (smi tagged) and set that as an in-object property too. |
| 4048 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 4049 const int kLengthOffset = JSObject::kHeaderSize + |
| 4050 Heap::kArgumentsLengthIndex * kPointerSize; |
| 4051 __ str(r2, FieldMemOperand(r0, kLengthOffset)); |
| 4052 |
| 4053 // Setup the elements pointer in the allocated arguments object. |
| 4054 // If we allocated a parameter map, r4 will point there, otherwise |
| 4055 // it will point to the backing store. |
| 4056 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); |
| 4057 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 4058 |
| 4059 // r0 = address of new object (tagged) |
| 4060 // r1 = mapped parameter count (tagged) |
| 4061 // r2 = argument count (tagged) |
| 4062 // r4 = address of parameter map or backing store (tagged) |
| 4063 // Initialize parameter map. If there are no mapped arguments, we're done. |
| 4064 Label skip_parameter_map; |
| 4065 __ cmp(r1, Operand(Smi::FromInt(0))); |
| 4066 // Move backing store address to r3, because it is |
| 4067 // expected there when filling in the unmapped arguments. |
| 4068 __ mov(r3, r4, LeaveCC, eq); |
| 4069 __ b(eq, &skip_parameter_map); |
| 4070 |
| 4071 __ LoadRoot(r6, Heap::kNonStrictArgumentsElementsMapRootIndex); |
| 4072 __ str(r6, FieldMemOperand(r4, FixedArray::kMapOffset)); |
| 4073 __ add(r6, r1, Operand(Smi::FromInt(2))); |
| 4074 __ str(r6, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 4075 __ str(r8, FieldMemOperand(r4, FixedArray::kHeaderSize + 0 * kPointerSize)); |
| 4076 __ add(r6, r4, Operand(r1, LSL, 1)); |
| 4077 __ add(r6, r6, Operand(kParameterMapHeaderSize)); |
| 4078 __ str(r6, FieldMemOperand(r4, FixedArray::kHeaderSize + 1 * kPointerSize)); |
| 4079 |
| 4080 // Copy the parameter slots and the holes in the arguments. |
| 4081 // We need to fill in mapped_parameter_count slots. They index the context, |
| 4082 // where parameters are stored in reverse order, at |
| 4083 // MIN_CONTEXT_SLOTS .. MIN_CONTEXT_SLOTS+parameter_count-1 |
| 4084 // The mapped parameter thus need to get indices |
| 4085 // MIN_CONTEXT_SLOTS+parameter_count-1 .. |
| 4086 // MIN_CONTEXT_SLOTS+parameter_count-mapped_parameter_count |
| 4087 // We loop from right to left. |
| 4088 Label parameters_loop, parameters_test; |
| 4089 __ mov(r6, r1); |
| 4090 __ ldr(r9, MemOperand(sp, 0 * kPointerSize)); |
| 4091 __ add(r9, r9, Operand(Smi::FromInt(Context::MIN_CONTEXT_SLOTS))); |
| 4092 __ sub(r9, r9, Operand(r1)); |
| 4093 __ LoadRoot(r7, Heap::kTheHoleValueRootIndex); |
| 4094 __ add(r3, r4, Operand(r6, LSL, 1)); |
| 4095 __ add(r3, r3, Operand(kParameterMapHeaderSize)); |
| 4096 |
| 4097 // r6 = loop variable (tagged) |
| 4098 // r1 = mapping index (tagged) |
| 4099 // r3 = address of backing store (tagged) |
| 4100 // r4 = address of parameter map (tagged) |
| 4101 // r5 = temporary scratch (a.o., for address calculation) |
| 4102 // r7 = the hole value |
| 4103 __ jmp(¶meters_test); |
| 4104 |
| 4105 __ bind(¶meters_loop); |
| 4106 __ sub(r6, r6, Operand(Smi::FromInt(1))); |
| 4107 __ mov(r5, Operand(r6, LSL, 1)); |
| 4108 __ add(r5, r5, Operand(kParameterMapHeaderSize - kHeapObjectTag)); |
| 4109 __ str(r9, MemOperand(r4, r5)); |
| 4110 __ sub(r5, r5, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize)); |
| 4111 __ str(r7, MemOperand(r3, r5)); |
| 4112 __ add(r9, r9, Operand(Smi::FromInt(1))); |
| 4113 __ bind(¶meters_test); |
| 4114 __ cmp(r6, Operand(Smi::FromInt(0))); |
| 4115 __ b(ne, ¶meters_loop); |
| 4116 |
| 4117 __ bind(&skip_parameter_map); |
| 4118 // r2 = argument count (tagged) |
| 4119 // r3 = address of backing store (tagged) |
| 4120 // r5 = scratch |
| 4121 // Copy arguments header and remaining slots (if there are any). |
| 4122 __ LoadRoot(r5, Heap::kFixedArrayMapRootIndex); |
| 4123 __ str(r5, FieldMemOperand(r3, FixedArray::kMapOffset)); |
| 4124 __ str(r2, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
| 4125 |
| 4126 Label arguments_loop, arguments_test; |
| 4127 __ mov(r9, r1); |
| 4128 __ ldr(r4, MemOperand(sp, 1 * kPointerSize)); |
| 4129 __ sub(r4, r4, Operand(r9, LSL, 1)); |
| 4130 __ jmp(&arguments_test); |
| 4131 |
| 4132 __ bind(&arguments_loop); |
| 4133 __ sub(r4, r4, Operand(kPointerSize)); |
| 4134 __ ldr(r6, MemOperand(r4, 0)); |
| 4135 __ add(r5, r3, Operand(r9, LSL, 1)); |
| 4136 __ str(r6, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
| 4137 __ add(r9, r9, Operand(Smi::FromInt(1))); |
| 4138 |
| 4139 __ bind(&arguments_test); |
| 4140 __ cmp(r9, Operand(r2)); |
| 4141 __ b(lt, &arguments_loop); |
| 4142 |
| 4143 // Return and remove the on-stack parameters. |
| 4144 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 4145 __ Ret(); |
| 4146 |
| 4147 // Do the runtime call to allocate the arguments object. |
| 4148 // r2 = argument count (taggged) |
| 4149 __ bind(&runtime); |
| 4150 __ str(r2, MemOperand(sp, 0 * kPointerSize)); // Patch argument count. |
| 4151 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); |
| 4152 } |
| 4153 |
| 4154 |
| 4155 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
| 4156 // sp[0] : number of parameters |
| 4157 // sp[4] : receiver displacement |
| 4158 // sp[8] : function |
| 4159 // Check if the calling frame is an arguments adaptor frame. |
| 3949 Label adaptor_frame, try_allocate, runtime; | 4160 Label adaptor_frame, try_allocate, runtime; |
| 3950 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4161 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 3951 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); | 4162 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); |
| 3952 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4163 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 3953 __ b(eq, &adaptor_frame); | 4164 __ b(eq, &adaptor_frame); |
| 3954 | 4165 |
| 3955 // Get the length from the frame. | 4166 // Get the length from the frame. |
| 3956 __ ldr(r1, MemOperand(sp, 0)); | 4167 __ ldr(r1, MemOperand(sp, 0)); |
| 3957 __ b(&try_allocate); | 4168 __ b(&try_allocate); |
| 3958 | 4169 |
| 3959 // Patch the arguments.length and the parameters pointer. | 4170 // Patch the arguments.length and the parameters pointer. |
| 3960 __ bind(&adaptor_frame); | 4171 __ bind(&adaptor_frame); |
| 3961 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4172 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 3962 __ str(r1, MemOperand(sp, 0)); | 4173 __ str(r1, MemOperand(sp, 0)); |
| 3963 __ add(r3, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); | 4174 __ add(r3, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 3964 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); | 4175 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 3965 __ str(r3, MemOperand(sp, 1 * kPointerSize)); | 4176 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
| 3966 | 4177 |
| 3967 // Try the new space allocation. Start out with computing the size | 4178 // Try the new space allocation. Start out with computing the size |
| 3968 // of the arguments object and the elements array in words. | 4179 // of the arguments object and the elements array in words. |
| 3969 Label add_arguments_object; | 4180 Label add_arguments_object; |
| 3970 __ bind(&try_allocate); | 4181 __ bind(&try_allocate); |
| 3971 if (type_ == NEW_NON_STRICT_SLOW || type_ == NEW_NON_STRICT_FAST) { | 4182 __ cmp(r1, Operand(0, RelocInfo::NONE)); |
| 3972 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | 4183 __ b(eq, &add_arguments_object); |
| 3973 } else { | 4184 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); |
| 3974 __ cmp(r1, Operand(0, RelocInfo::NONE)); | 4185 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); |
| 3975 __ b(eq, &add_arguments_object); | 4186 __ bind(&add_arguments_object); |
| 3976 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); | 4187 __ add(r1, r1, Operand(Heap::kArgumentsObjectSizeStrict / kPointerSize)); |
| 3977 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); | |
| 3978 __ bind(&add_arguments_object); | |
| 3979 __ add(r1, r1, Operand(Heap::kArgumentsObjectSizeStrict / kPointerSize)); | |
| 3980 | 4188 |
| 3981 // Do the allocation of both objects in one go. | 4189 // Do the allocation of both objects in one go. |
| 3982 __ AllocateInNewSpace( | 4190 __ AllocateInNewSpace(r1, |
| 3983 r1, | 4191 r0, |
| 3984 r0, | 4192 r2, |
| 3985 r2, | 4193 r3, |
| 3986 r3, | 4194 &runtime, |
| 3987 &runtime, | 4195 static_cast<AllocationFlags>(TAG_OBJECT | |
| 3988 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 4196 SIZE_IN_WORDS)); |
| 3989 | 4197 |
| 3990 // Get the arguments boilerplate from the current (global) context. | 4198 // Get the arguments boilerplate from the current (global) context. |
| 3991 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4199 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 3992 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); | 4200 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset)); |
| 3993 __ ldr(r4, MemOperand(r4, Context::SlotOffset( | 4201 __ ldr(r4, MemOperand(r4, Context::SlotOffset( |
| 3994 Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX))); | 4202 Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX))); |
| 3995 | 4203 |
| 3996 // Copy the JS object part. | 4204 // Copy the JS object part. |
| 3997 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); | 4205 __ CopyFields(r0, r4, r3.bit(), JSObject::kHeaderSize / kPointerSize); |
| 3998 | 4206 |
| 3999 if (type_ == NEW_NON_STRICT_SLOW || type_ == NEW_NON_STRICT_FAST) { | 4207 // Get the length (smi tagged) and set that as an in-object property too. |
| 4000 // Setup the callee in-object property. | 4208 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
| 4001 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 4209 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
| 4002 __ ldr(r3, MemOperand(sp, 2 * kPointerSize)); | 4210 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + |
| 4003 const int kCalleeOffset = JSObject::kHeaderSize + | 4211 Heap::kArgumentsLengthIndex * kPointerSize)); |
| 4004 Heap::kArgumentsCalleeIndex * kPointerSize; | |
| 4005 __ str(r3, FieldMemOperand(r0, kCalleeOffset)); | |
| 4006 } | |
| 4007 | 4212 |
| 4008 // Get the length (smi tagged) and set that as an in-object property too. | 4213 // If there are no actual arguments, we're done. |
| 4009 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 4214 Label done; |
| 4010 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 4215 __ cmp(r1, Operand(0, RelocInfo::NONE)); |
| 4011 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | 4216 __ b(eq, &done); |
| 4012 Heap::kArgumentsLengthIndex * kPointerSize)); | |
| 4013 | 4217 |
| 4014 // If there are no actual arguments, we're done. | 4218 // Get the parameters pointer from the stack. |
| 4015 Label done; | 4219 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
| 4016 __ cmp(r1, Operand(0, RelocInfo::NONE)); | |
| 4017 __ b(eq, &done); | |
| 4018 | 4220 |
| 4019 // Get the parameters pointer from the stack. | 4221 // Setup the elements pointer in the allocated arguments object and |
| 4020 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 4222 // initialize the header in the elements fixed array. |
| 4223 __ add(r4, r0, Operand(Heap::kArgumentsObjectSizeStrict)); |
| 4224 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 4225 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
| 4226 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); |
| 4227 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| 4228 // Untag the length for the loop. |
| 4229 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); |
| 4021 | 4230 |
| 4022 // Setup the elements pointer in the allocated arguments object and | 4231 // Copy the fixed array slots. |
| 4023 // initialize the header in the elements fixed array. | 4232 Label loop; |
| 4024 __ add(r4, r0, Operand(Heap::kArgumentsObjectSizeStrict)); | 4233 // Setup r4 to point to the first array slot. |
| 4025 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 4234 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 4026 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 4235 __ bind(&loop); |
| 4027 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | 4236 // Pre-decrement r2 with kPointerSize on each iteration. |
| 4028 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 4237 // Pre-decrement in order to skip receiver. |
| 4029 // Untag the length for the loop. | 4238 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); |
| 4030 __ mov(r1, Operand(r1, LSR, kSmiTagSize)); | 4239 // Post-increment r4 with kPointerSize on each iteration. |
| 4240 __ str(r3, MemOperand(r4, kPointerSize, PostIndex)); |
| 4241 __ sub(r1, r1, Operand(1)); |
| 4242 __ cmp(r1, Operand(0, RelocInfo::NONE)); |
| 4243 __ b(ne, &loop); |
| 4031 | 4244 |
| 4032 // Copy the fixed array slots. | 4245 // Return and remove the on-stack parameters. |
| 4033 Label loop; | 4246 __ bind(&done); |
| 4034 // Setup r4 to point to the first array slot. | 4247 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 4035 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 4248 __ Ret(); |
| 4036 __ bind(&loop); | |
| 4037 // Pre-decrement r2 with kPointerSize on each iteration. | |
| 4038 // Pre-decrement in order to skip receiver. | |
| 4039 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | |
| 4040 // Post-increment r4 with kPointerSize on each iteration. | |
| 4041 __ str(r3, MemOperand(r4, kPointerSize, PostIndex)); | |
| 4042 __ sub(r1, r1, Operand(1)); | |
| 4043 __ cmp(r1, Operand(0, RelocInfo::NONE)); | |
| 4044 __ b(ne, &loop); | |
| 4045 | 4249 |
| 4046 // Return and remove the on-stack parameters. | 4250 // Do the runtime call to allocate the arguments object. |
| 4047 __ bind(&done); | 4251 __ bind(&runtime); |
| 4048 __ add(sp, sp, Operand(3 * kPointerSize)); | 4252 __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1); |
| 4049 __ Ret(); | |
| 4050 | |
| 4051 // Do the runtime call to allocate the arguments object. | |
| 4052 __ bind(&runtime); | |
| 4053 __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1); | |
| 4054 } | |
| 4055 } | 4253 } |
| 4056 | 4254 |
| 4057 | 4255 |
| 4058 void RegExpExecStub::Generate(MacroAssembler* masm) { | 4256 void RegExpExecStub::Generate(MacroAssembler* masm) { |
| 4059 // Just jump directly to runtime if native RegExp is not selected at compile | 4257 // Just jump directly to runtime if native RegExp is not selected at compile |
| 4060 // time or if regexp entry in generated code is turned off runtime switch or | 4258 // time or if regexp entry in generated code is turned off runtime switch or |
| 4061 // at compilation. | 4259 // at compilation. |
| 4062 #ifdef V8_INTERPRETED_REGEXP | 4260 #ifdef V8_INTERPRETED_REGEXP |
| 4063 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 4261 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); |
| 4064 #else // V8_INTERPRETED_REGEXP | 4262 #else // V8_INTERPRETED_REGEXP |
| (...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6417 __ mov(result, Operand(0)); | 6615 __ mov(result, Operand(0)); |
| 6418 __ Ret(); | 6616 __ Ret(); |
| 6419 } | 6617 } |
| 6420 | 6618 |
| 6421 | 6619 |
| 6422 #undef __ | 6620 #undef __ |
| 6423 | 6621 |
| 6424 } } // namespace v8::internal | 6622 } } // namespace v8::internal |
| 6425 | 6623 |
| 6426 #endif // V8_TARGET_ARCH_ARM | 6624 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |