OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 | 170 |
171 static void InitializeArrayConstructorDescriptor( | 171 static void InitializeArrayConstructorDescriptor( |
172 Isolate* isolate, | 172 Isolate* isolate, |
173 CodeStubInterfaceDescriptor* descriptor, | 173 CodeStubInterfaceDescriptor* descriptor, |
174 int constant_stack_parameter_count) { | 174 int constant_stack_parameter_count) { |
175 // register state | 175 // register state |
176 // rax -- number of arguments | 176 // rax -- number of arguments |
177 // rdi -- function | 177 // rdi -- function |
178 // rbx -- type info cell with elements kind | 178 // rbx -- type info cell with elements kind |
179 static Register registers[] = { rdi, rbx }; | 179 static Register registers_variable_args[] = { rdi, rbx, rax }; |
180 descriptor->register_param_count_ = 2; | 180 static Register registers_no_args[] = { rdi, rbx }; |
181 if (constant_stack_parameter_count != 0) { | 181 |
| 182 if (constant_stack_parameter_count == 0) { |
| 183 descriptor->register_param_count_ = 2; |
| 184 descriptor->register_params_ = registers_no_args; |
| 185 } else { |
182 // stack param count needs (constructor pointer, and single argument) | 186 // stack param count needs (constructor pointer, and single argument) |
| 187 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
183 descriptor->stack_parameter_count_ = rax; | 188 descriptor->stack_parameter_count_ = rax; |
| 189 descriptor->register_param_count_ = 3; |
| 190 descriptor->register_params_ = registers_variable_args; |
184 } | 191 } |
| 192 |
185 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 193 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
186 descriptor->register_params_ = registers; | |
187 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 194 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
188 descriptor->deoptimization_handler_ = | 195 descriptor->deoptimization_handler_ = |
189 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; | 196 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; |
190 } | 197 } |
191 | 198 |
192 | 199 |
193 static void InitializeInternalArrayConstructorDescriptor( | 200 static void InitializeInternalArrayConstructorDescriptor( |
194 Isolate* isolate, | 201 Isolate* isolate, |
195 CodeStubInterfaceDescriptor* descriptor, | 202 CodeStubInterfaceDescriptor* descriptor, |
196 int constant_stack_parameter_count) { | 203 int constant_stack_parameter_count) { |
197 // register state | 204 // register state |
198 // rax -- number of arguments | 205 // rax -- number of arguments |
199 // rdi -- constructor function | 206 // rdi -- constructor function |
200 static Register registers[] = { rdi }; | 207 static Register registers_variable_args[] = { rdi, rax }; |
201 descriptor->register_param_count_ = 1; | 208 static Register registers_no_args[] = { rdi }; |
202 | 209 |
203 if (constant_stack_parameter_count != 0) { | 210 if (constant_stack_parameter_count == 0) { |
| 211 descriptor->register_param_count_ = 1; |
| 212 descriptor->register_params_ = registers_no_args; |
| 213 } else { |
204 // stack param count needs (constructor pointer, and single argument) | 214 // stack param count needs (constructor pointer, and single argument) |
| 215 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
205 descriptor->stack_parameter_count_ = rax; | 216 descriptor->stack_parameter_count_ = rax; |
| 217 descriptor->register_param_count_ = 2; |
| 218 descriptor->register_params_ = registers_variable_args; |
206 } | 219 } |
| 220 |
207 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 221 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
208 descriptor->register_params_ = registers; | |
209 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 222 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
210 descriptor->deoptimization_handler_ = | 223 descriptor->deoptimization_handler_ = |
211 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; | 224 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; |
212 } | 225 } |
213 | 226 |
214 | 227 |
215 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 228 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
216 Isolate* isolate, | 229 Isolate* isolate, |
217 CodeStubInterfaceDescriptor* descriptor) { | 230 CodeStubInterfaceDescriptor* descriptor) { |
218 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); | 231 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); |
(...skipping 5603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5822 __ bind(&fast_elements_case); | 5835 __ bind(&fast_elements_case); |
5823 GenerateCase(masm, FAST_ELEMENTS); | 5836 GenerateCase(masm, FAST_ELEMENTS); |
5824 } | 5837 } |
5825 | 5838 |
5826 | 5839 |
5827 #undef __ | 5840 #undef __ |
5828 | 5841 |
5829 } } // namespace v8::internal | 5842 } } // namespace v8::internal |
5830 | 5843 |
5831 #endif // V8_TARGET_ARCH_X64 | 5844 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |