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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 if (arguments != NULL) { | 265 if (arguments != NULL) { |
266 // Arguments object must be allocated after the context object, in | 266 // Arguments object must be allocated after the context object, in |
267 // case the "arguments" or ".arguments" variables are in the context. | 267 // case the "arguments" or ".arguments" variables are in the context. |
268 Comment cmnt(masm_, "[ Allocate arguments object"); | 268 Comment cmnt(masm_, "[ Allocate arguments object"); |
269 if (!function_in_register) { | 269 if (!function_in_register) { |
270 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 270 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
271 } | 271 } |
272 if (is_strict(language_mode()) || !has_simple_parameters()) { | 272 if (is_strict(language_mode()) || !has_simple_parameters()) { |
273 FastNewStrictArgumentsStub stub(isolate()); | 273 FastNewStrictArgumentsStub stub(isolate()); |
274 __ CallStub(&stub); | 274 __ CallStub(&stub); |
275 } else if (literal()->has_duplicate_parameters()) { | |
276 __ Push(edi); | |
277 __ CallRuntime(Runtime::kNewSloppyArguments_Generic); | |
278 } else { | 275 } else { |
279 FastNewSloppyArgumentsStub stub(isolate()); | 276 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); |
| 277 // Receiver is just before the parameters on the caller's stack. |
| 278 int num_parameters = info->scope()->num_parameters(); |
| 279 int offset = num_parameters * kPointerSize; |
| 280 __ mov(ArgumentsAccessNewDescriptor::parameter_count(), |
| 281 Immediate(Smi::FromInt(num_parameters))); |
| 282 __ lea(ArgumentsAccessNewDescriptor::parameter_pointer(), |
| 283 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 284 |
| 285 // Arguments to ArgumentsAccessStub: |
| 286 // function, parameter pointer, parameter count. |
| 287 // The stub will rewrite parameter pointer and parameter count if the |
| 288 // previous stack frame was an arguments adapter frame. |
| 289 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType( |
| 290 literal()->has_duplicate_parameters()); |
| 291 ArgumentsAccessStub stub(isolate(), type); |
280 __ CallStub(&stub); | 292 __ CallStub(&stub); |
281 } | 293 } |
282 | 294 |
283 SetVar(arguments, eax, ebx, edx); | 295 SetVar(arguments, eax, ebx, edx); |
284 } | 296 } |
285 | 297 |
286 if (FLAG_trace) { | 298 if (FLAG_trace) { |
287 __ CallRuntime(Runtime::kTraceEnter); | 299 __ CallRuntime(Runtime::kTraceEnter); |
288 } | 300 } |
289 | 301 |
(...skipping 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 Assembler::target_address_at(call_target_address, | 4519 Assembler::target_address_at(call_target_address, |
4508 unoptimized_code)); | 4520 unoptimized_code)); |
4509 return OSR_AFTER_STACK_CHECK; | 4521 return OSR_AFTER_STACK_CHECK; |
4510 } | 4522 } |
4511 | 4523 |
4512 | 4524 |
4513 } // namespace internal | 4525 } // namespace internal |
4514 } // namespace v8 | 4526 } // namespace v8 |
4515 | 4527 |
4516 #endif // V8_TARGET_ARCH_IA32 | 4528 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |