OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 __ lea(edx, Operand(edx, ecx, times_2, | 3320 __ lea(edx, Operand(edx, ecx, times_2, |
3321 StandardFrameConstants::kCallerSPOffset)); | 3321 StandardFrameConstants::kCallerSPOffset)); |
3322 __ mov(Operand(esp, 2 * kPointerSize), edx); | 3322 __ mov(Operand(esp, 2 * kPointerSize), edx); |
3323 | 3323 |
3324 __ bind(&runtime); | 3324 __ bind(&runtime); |
3325 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | 3325 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); |
3326 } | 3326 } |
3327 | 3327 |
3328 | 3328 |
3329 void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { | 3329 void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { |
| 3330 Isolate* isolate = masm->isolate(); |
| 3331 |
3330 // esp[0] : return address | 3332 // esp[0] : return address |
3331 // esp[4] : number of parameters (tagged) | 3333 // esp[4] : number of parameters (tagged) |
3332 // esp[8] : receiver displacement | 3334 // esp[8] : receiver displacement |
3333 // esp[12] : function | 3335 // esp[12] : function |
3334 | 3336 |
3335 // ebx = parameter count (tagged) | 3337 // ebx = parameter count (tagged) |
3336 __ mov(ebx, Operand(esp, 1 * kPointerSize)); | 3338 __ mov(ebx, Operand(esp, 1 * kPointerSize)); |
3337 | 3339 |
3338 // Check if the calling frame is an arguments adaptor frame. | 3340 // Check if the calling frame is an arguments adaptor frame. |
3339 // TODO(rossberg): Factor out some of the bits that are shared with the other | 3341 // TODO(rossberg): Factor out some of the bits that are shared with the other |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 // esp[12] = address of receiver argument | 3453 // esp[12] = address of receiver argument |
3452 // Free a register. | 3454 // Free a register. |
3453 __ push(eax); | 3455 __ push(eax); |
3454 | 3456 |
3455 // Initialize parameter map. If there are no mapped arguments, we're done. | 3457 // Initialize parameter map. If there are no mapped arguments, we're done. |
3456 Label skip_parameter_map; | 3458 Label skip_parameter_map; |
3457 __ test(ebx, ebx); | 3459 __ test(ebx, ebx); |
3458 __ j(zero, &skip_parameter_map); | 3460 __ j(zero, &skip_parameter_map); |
3459 | 3461 |
3460 __ mov(FieldOperand(edi, FixedArray::kMapOffset), | 3462 __ mov(FieldOperand(edi, FixedArray::kMapOffset), |
3461 Immediate(FACTORY->non_strict_arguments_elements_map())); | 3463 Immediate(isolate->factory()->non_strict_arguments_elements_map())); |
3462 __ lea(eax, Operand(ebx, reinterpret_cast<intptr_t>(Smi::FromInt(2)))); | 3464 __ lea(eax, Operand(ebx, reinterpret_cast<intptr_t>(Smi::FromInt(2)))); |
3463 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), eax); | 3465 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), eax); |
3464 __ mov(FieldOperand(edi, FixedArray::kHeaderSize + 0 * kPointerSize), esi); | 3466 __ mov(FieldOperand(edi, FixedArray::kHeaderSize + 0 * kPointerSize), esi); |
3465 __ lea(eax, Operand(edi, ebx, times_2, kParameterMapHeaderSize)); | 3467 __ lea(eax, Operand(edi, ebx, times_2, kParameterMapHeaderSize)); |
3466 __ mov(FieldOperand(edi, FixedArray::kHeaderSize + 1 * kPointerSize), eax); | 3468 __ mov(FieldOperand(edi, FixedArray::kHeaderSize + 1 * kPointerSize), eax); |
3467 | 3469 |
3468 // Copy the parameter slots and the holes in the arguments. | 3470 // Copy the parameter slots and the holes in the arguments. |
3469 // We need to fill in mapped_parameter_count slots. They index the context, | 3471 // We need to fill in mapped_parameter_count slots. They index the context, |
3470 // where parameters are stored in reverse order, at | 3472 // where parameters are stored in reverse order, at |
3471 // MIN_CONTEXT_SLOTS .. MIN_CONTEXT_SLOTS+parameter_count-1 | 3473 // MIN_CONTEXT_SLOTS .. MIN_CONTEXT_SLOTS+parameter_count-1 |
3472 // The mapped parameter thus need to get indices | 3474 // The mapped parameter thus need to get indices |
3473 // MIN_CONTEXT_SLOTS+parameter_count-1 .. | 3475 // MIN_CONTEXT_SLOTS+parameter_count-1 .. |
3474 // MIN_CONTEXT_SLOTS+parameter_count-mapped_parameter_count | 3476 // MIN_CONTEXT_SLOTS+parameter_count-mapped_parameter_count |
3475 // We loop from right to left. | 3477 // We loop from right to left. |
3476 Label parameters_loop, parameters_test; | 3478 Label parameters_loop, parameters_test; |
3477 __ push(ecx); | 3479 __ push(ecx); |
3478 __ mov(eax, Operand(esp, 2 * kPointerSize)); | 3480 __ mov(eax, Operand(esp, 2 * kPointerSize)); |
3479 __ mov(ebx, Immediate(Smi::FromInt(Context::MIN_CONTEXT_SLOTS))); | 3481 __ mov(ebx, Immediate(Smi::FromInt(Context::MIN_CONTEXT_SLOTS))); |
3480 __ add(ebx, Operand(esp, 4 * kPointerSize)); | 3482 __ add(ebx, Operand(esp, 4 * kPointerSize)); |
3481 __ sub(ebx, eax); | 3483 __ sub(ebx, eax); |
3482 __ mov(ecx, FACTORY->the_hole_value()); | 3484 __ mov(ecx, isolate->factory()->the_hole_value()); |
3483 __ mov(edx, edi); | 3485 __ mov(edx, edi); |
3484 __ lea(edi, Operand(edi, eax, times_2, kParameterMapHeaderSize)); | 3486 __ lea(edi, Operand(edi, eax, times_2, kParameterMapHeaderSize)); |
3485 // eax = loop variable (tagged) | 3487 // eax = loop variable (tagged) |
3486 // ebx = mapping index (tagged) | 3488 // ebx = mapping index (tagged) |
3487 // ecx = the hole value | 3489 // ecx = the hole value |
3488 // edx = address of parameter map (tagged) | 3490 // edx = address of parameter map (tagged) |
3489 // edi = address of backing store (tagged) | 3491 // edi = address of backing store (tagged) |
3490 // esp[0] = argument count (tagged) | 3492 // esp[0] = argument count (tagged) |
3491 // esp[4] = address of new object (tagged) | 3493 // esp[4] = address of new object (tagged) |
3492 // esp[8] = mapped parameter count (tagged) | 3494 // esp[8] = mapped parameter count (tagged) |
(...skipping 14 matching lines...) Expand all Loading... |
3507 __ bind(&skip_parameter_map); | 3509 __ bind(&skip_parameter_map); |
3508 | 3510 |
3509 // ecx = argument count (tagged) | 3511 // ecx = argument count (tagged) |
3510 // edi = address of backing store (tagged) | 3512 // edi = address of backing store (tagged) |
3511 // esp[0] = address of new object (tagged) | 3513 // esp[0] = address of new object (tagged) |
3512 // esp[4] = mapped parameter count (tagged) | 3514 // esp[4] = mapped parameter count (tagged) |
3513 // esp[12] = parameter count (tagged) | 3515 // esp[12] = parameter count (tagged) |
3514 // esp[16] = address of receiver argument | 3516 // esp[16] = address of receiver argument |
3515 // Copy arguments header and remaining slots (if there are any). | 3517 // Copy arguments header and remaining slots (if there are any). |
3516 __ mov(FieldOperand(edi, FixedArray::kMapOffset), | 3518 __ mov(FieldOperand(edi, FixedArray::kMapOffset), |
3517 Immediate(FACTORY->fixed_array_map())); | 3519 Immediate(isolate->factory()->fixed_array_map())); |
3518 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); | 3520 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); |
3519 | 3521 |
3520 Label arguments_loop, arguments_test; | 3522 Label arguments_loop, arguments_test; |
3521 __ mov(ebx, Operand(esp, 1 * kPointerSize)); | 3523 __ mov(ebx, Operand(esp, 1 * kPointerSize)); |
3522 __ mov(edx, Operand(esp, 4 * kPointerSize)); | 3524 __ mov(edx, Operand(esp, 4 * kPointerSize)); |
3523 __ sub(edx, ebx); // Is there a smarter way to do negative scaling? | 3525 __ sub(edx, ebx); // Is there a smarter way to do negative scaling? |
3524 __ sub(edx, ebx); | 3526 __ sub(edx, ebx); |
3525 __ jmp(&arguments_test, Label::kNear); | 3527 __ jmp(&arguments_test, Label::kNear); |
3526 | 3528 |
3527 __ bind(&arguments_loop); | 3529 __ bind(&arguments_loop); |
(...skipping 15 matching lines...) Expand all Loading... |
3543 | 3545 |
3544 // Do the runtime call to allocate the arguments object. | 3546 // Do the runtime call to allocate the arguments object. |
3545 __ bind(&runtime); | 3547 __ bind(&runtime); |
3546 __ pop(eax); // Remove saved parameter count. | 3548 __ pop(eax); // Remove saved parameter count. |
3547 __ mov(Operand(esp, 1 * kPointerSize), ecx); // Patch argument count. | 3549 __ mov(Operand(esp, 1 * kPointerSize), ecx); // Patch argument count. |
3548 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | 3550 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); |
3549 } | 3551 } |
3550 | 3552 |
3551 | 3553 |
3552 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { | 3554 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
| 3555 Isolate* isolate = masm->isolate(); |
| 3556 |
3553 // esp[0] : return address | 3557 // esp[0] : return address |
3554 // esp[4] : number of parameters | 3558 // esp[4] : number of parameters |
3555 // esp[8] : receiver displacement | 3559 // esp[8] : receiver displacement |
3556 // esp[12] : function | 3560 // esp[12] : function |
3557 | 3561 |
3558 // Check if the calling frame is an arguments adaptor frame. | 3562 // Check if the calling frame is an arguments adaptor frame. |
3559 Label adaptor_frame, try_allocate, runtime; | 3563 Label adaptor_frame, try_allocate, runtime; |
3560 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 3564 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
3561 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); | 3565 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); |
3562 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3566 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3613 __ j(zero, &done, Label::kNear); | 3617 __ j(zero, &done, Label::kNear); |
3614 | 3618 |
3615 // Get the parameters pointer from the stack. | 3619 // Get the parameters pointer from the stack. |
3616 __ mov(edx, Operand(esp, 2 * kPointerSize)); | 3620 __ mov(edx, Operand(esp, 2 * kPointerSize)); |
3617 | 3621 |
3618 // Set up the elements pointer in the allocated arguments object and | 3622 // Set up the elements pointer in the allocated arguments object and |
3619 // initialize the header in the elements fixed array. | 3623 // initialize the header in the elements fixed array. |
3620 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSizeStrict)); | 3624 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSizeStrict)); |
3621 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); | 3625 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); |
3622 __ mov(FieldOperand(edi, FixedArray::kMapOffset), | 3626 __ mov(FieldOperand(edi, FixedArray::kMapOffset), |
3623 Immediate(FACTORY->fixed_array_map())); | 3627 Immediate(isolate->factory()->fixed_array_map())); |
3624 | 3628 |
3625 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); | 3629 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); |
3626 // Untag the length for the loop below. | 3630 // Untag the length for the loop below. |
3627 __ SmiUntag(ecx); | 3631 __ SmiUntag(ecx); |
3628 | 3632 |
3629 // Copy the fixed array slots. | 3633 // Copy the fixed array slots. |
3630 Label loop; | 3634 Label loop; |
3631 __ bind(&loop); | 3635 __ bind(&loop); |
3632 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver. | 3636 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver. |
3633 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx); | 3637 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx); |
(...skipping 4288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7922 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 7926 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
7923 } | 7927 } |
7924 } | 7928 } |
7925 | 7929 |
7926 | 7930 |
7927 #undef __ | 7931 #undef __ |
7928 | 7932 |
7929 } } // namespace v8::internal | 7933 } } // namespace v8::internal |
7930 | 7934 |
7931 #endif // V8_TARGET_ARCH_IA32 | 7935 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |