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::HasNewTarget has_new_target = | 284 ArgumentsAccessStub::HasNewTarget has_new_target = |
266 IsSubclassConstructor(info->function()->kind()) | 285 IsSubclassConstructor(info->function()->kind()) |
267 ? ArgumentsAccessStub::HAS_NEW_TARGET | 286 ? ArgumentsAccessStub::HAS_NEW_TARGET |
268 : ArgumentsAccessStub::NO_NEW_TARGET; | 287 : ArgumentsAccessStub::NO_NEW_TARGET; |
269 ArgumentsAccessStub::Type type; | 288 ArgumentsAccessStub::Type type; |
270 if (is_strict(language_mode())) { | 289 if (is_strict(language_mode()) || !is_simple_parameter_list()) { |
271 type = ArgumentsAccessStub::NEW_STRICT; | 290 type = ArgumentsAccessStub::NEW_STRICT; |
272 } else if (function()->has_duplicate_parameters()) { | 291 } else if (function()->has_duplicate_parameters()) { |
273 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 292 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
274 } else { | 293 } else { |
275 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 294 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
276 } | 295 } |
277 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 296 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
278 __ CallStub(&stub); | 297 __ CallStub(&stub); |
279 | 298 |
280 SetVar(arguments, r0, r1, r2); | 299 SetVar(arguments, r0, r1, r2); |
(...skipping 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 | 5500 |
5482 DCHECK(interrupt_address == | 5501 DCHECK(interrupt_address == |
5483 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5502 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5484 return OSR_AFTER_STACK_CHECK; | 5503 return OSR_AFTER_STACK_CHECK; |
5485 } | 5504 } |
5486 | 5505 |
5487 | 5506 |
5488 } } // namespace v8::internal | 5507 } } // namespace v8::internal |
5489 | 5508 |
5490 #endif // V8_TARGET_ARCH_ARM | 5509 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |