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