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