OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } else if (FLAG_debug_code) { | 233 } else if (FLAG_debug_code) { |
234 Label done; | 234 Label done; |
235 __ JumpIfInNewSpace(cp, r0, &done); | 235 __ JumpIfInNewSpace(cp, r0, &done); |
236 __ Abort(kExpectedNewSpaceObject); | 236 __ Abort(kExpectedNewSpaceObject); |
237 __ bind(&done); | 237 __ bind(&done); |
238 } | 238 } |
239 } | 239 } |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
| 243 // Possibly allocate RestParameters |
| 244 int rest_index; |
| 245 Variable* rest_param = scope()->rest_parameter(&rest_index); |
| 246 if (rest_param) { |
| 247 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
| 248 |
| 249 int num_parameters = info->scope()->num_parameters(); |
| 250 int offset = num_parameters * kPointerSize; |
| 251 __ add(r3, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
| 252 __ mov(r2, Operand(Smi::FromInt(num_parameters))); |
| 253 __ mov(r1, Operand(Smi::FromInt(rest_index))); |
| 254 __ Push(r3, r2, r1); |
| 255 |
| 256 RestParamAccessStub stub(isolate()); |
| 257 __ CallStub(&stub); |
| 258 |
| 259 SetVar(rest_param, r0, r1, r2); |
| 260 } |
| 261 |
243 Variable* arguments = scope()->arguments(); | 262 Variable* arguments = scope()->arguments(); |
244 if (arguments != NULL) { | 263 if (arguments != NULL) { |
245 // Function uses arguments object. | 264 // Function uses arguments object. |
246 Comment cmnt(masm_, "[ Allocate arguments object"); | 265 Comment cmnt(masm_, "[ Allocate arguments object"); |
247 if (!function_in_register) { | 266 if (!function_in_register) { |
248 // Load this again, if it's used by the local context below. | 267 // Load this again, if it's used by the local context below. |
249 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 268 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
250 } else { | 269 } else { |
251 __ mov(r3, r1); | 270 __ mov(r3, r1); |
252 } | 271 } |
253 // Receiver is just before the parameters on the caller's stack. | 272 // Receiver is just before the parameters on the caller's stack. |
254 int num_parameters = info->scope()->num_parameters(); | 273 int num_parameters = info->scope()->num_parameters(); |
255 int offset = num_parameters * kPointerSize; | 274 int offset = num_parameters * kPointerSize; |
256 __ add(r2, fp, | 275 __ add(r2, fp, |
257 Operand(StandardFrameConstants::kCallerSPOffset + offset)); | 276 Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
258 __ mov(r1, Operand(Smi::FromInt(num_parameters))); | 277 __ mov(r1, Operand(Smi::FromInt(num_parameters))); |
259 __ Push(r3, r2, r1); | 278 __ Push(r3, r2, r1); |
260 | 279 |
261 // Arguments to ArgumentsAccessStub: | 280 // Arguments to ArgumentsAccessStub: |
262 // function, receiver address, parameter count. | 281 // function, receiver address, parameter count. |
263 // The stub will rewrite receiever and parameter count if the previous | 282 // The stub will rewrite receiever and parameter count if the previous |
264 // stack frame was an arguments adapter frame. | 283 // stack frame was an arguments adapter frame. |
265 ArgumentsAccessStub::Type type; | 284 ArgumentsAccessStub::Type type; |
266 if (is_strict(language_mode())) { | 285 if (is_strict(language_mode()) || !is_simmple_parameter_list()) { |
267 type = ArgumentsAccessStub::NEW_STRICT; | 286 type = ArgumentsAccessStub::NEW_STRICT; |
268 } else if (function()->has_duplicate_parameters()) { | 287 } else if (function()->has_duplicate_parameters()) { |
269 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 288 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
270 } else { | 289 } else { |
271 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 290 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
272 } | 291 } |
273 ArgumentsAccessStub stub(isolate(), type); | 292 ArgumentsAccessStub stub(isolate(), type); |
274 __ CallStub(&stub); | 293 __ CallStub(&stub); |
275 | 294 |
276 SetVar(arguments, r0, r1, r2); | 295 SetVar(arguments, r0, r1, r2); |
(...skipping 5149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5426 | 5445 |
5427 DCHECK(interrupt_address == | 5446 DCHECK(interrupt_address == |
5428 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5447 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5429 return OSR_AFTER_STACK_CHECK; | 5448 return OSR_AFTER_STACK_CHECK; |
5430 } | 5449 } |
5431 | 5450 |
5432 | 5451 |
5433 } } // namespace v8::internal | 5452 } } // namespace v8::internal |
5434 | 5453 |
5435 #endif // V8_TARGET_ARCH_ARM | 5454 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |