| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 256 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 257 } | 257 } |
| 258 FastNewRestParameterStub stub(isolate()); | 258 FastNewRestParameterStub stub(isolate()); |
| 259 __ CallStub(&stub); | 259 __ CallStub(&stub); |
| 260 function_in_register = false; | 260 function_in_register = false; |
| 261 SetVar(rest_param, eax, ebx, edx); | 261 SetVar(rest_param, eax, ebx, edx); |
| 262 } | 262 } |
| 263 | 263 |
| 264 Variable* arguments = scope()->arguments(); | 264 Variable* arguments = scope()->arguments(); |
| 265 if (arguments != NULL) { | 265 if (arguments != NULL) { |
| 266 // Function uses arguments object. | 266 // Arguments object must be allocated after the context object, in |
| 267 // case the "arguments" or ".arguments" variables are in the context. |
| 267 Comment cmnt(masm_, "[ Allocate arguments object"); | 268 Comment cmnt(masm_, "[ Allocate arguments object"); |
| 268 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); | |
| 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 // Receiver is just before the parameters on the caller's stack. | 272 if (is_strict(language_mode()) || !has_simple_parameters()) { |
| 273 int num_parameters = info->scope()->num_parameters(); | 273 FastNewStrictArgumentsStub stub(isolate()); |
| 274 int offset = num_parameters * kPointerSize; | 274 __ CallStub(&stub); |
| 275 __ mov(ArgumentsAccessNewDescriptor::parameter_count(), | 275 } else { |
| 276 Immediate(Smi::FromInt(num_parameters))); | 276 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); |
| 277 __ lea(ArgumentsAccessNewDescriptor::parameter_pointer(), | 277 // Receiver is just before the parameters on the caller's stack. |
| 278 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); | 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)); |
| 279 | 284 |
| 280 // Arguments to ArgumentsAccessStub: | 285 // Arguments to ArgumentsAccessStub: |
| 281 // function, parameter pointer, parameter count. | 286 // function, parameter pointer, parameter count. |
| 282 // The stub will rewrite parameter pointer and parameter count if the | 287 // The stub will rewrite parameter pointer and parameter count if the |
| 283 // previous stack frame was an arguments adapter frame. | 288 // previous stack frame was an arguments adapter frame. |
| 284 bool is_unmapped = is_strict(language_mode()) || !has_simple_parameters(); | 289 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType( |
| 285 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType( | 290 literal()->has_duplicate_parameters()); |
| 286 is_unmapped, literal()->has_duplicate_parameters()); | 291 ArgumentsAccessStub stub(isolate(), type); |
| 287 ArgumentsAccessStub stub(isolate(), type); | 292 __ CallStub(&stub); |
| 288 __ CallStub(&stub); | 293 } |
| 289 | 294 |
| 290 SetVar(arguments, eax, ebx, edx); | 295 SetVar(arguments, eax, ebx, edx); |
| 291 } | 296 } |
| 292 | 297 |
| 293 if (FLAG_trace) { | 298 if (FLAG_trace) { |
| 294 __ CallRuntime(Runtime::kTraceEnter); | 299 __ CallRuntime(Runtime::kTraceEnter); |
| 295 } | 300 } |
| 296 | 301 |
| 297 // Visit the declarations and body unless there is an illegal | 302 // Visit the declarations and body unless there is an illegal |
| 298 // redeclaration. | 303 // redeclaration. |
| (...skipping 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4576 Assembler::target_address_at(call_target_address, | 4581 Assembler::target_address_at(call_target_address, |
| 4577 unoptimized_code)); | 4582 unoptimized_code)); |
| 4578 return OSR_AFTER_STACK_CHECK; | 4583 return OSR_AFTER_STACK_CHECK; |
| 4579 } | 4584 } |
| 4580 | 4585 |
| 4581 | 4586 |
| 4582 } // namespace internal | 4587 } // namespace internal |
| 4583 } // namespace v8 | 4588 } // namespace v8 |
| 4584 | 4589 |
| 4585 #endif // V8_TARGET_ARCH_IA32 | 4590 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |