Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 6698015: Implement strict mode arguments caller/callee. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Kevin's feedback. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 __ mov(Operand(esp, 2 * kPointerSize), edx); 3621 __ mov(Operand(esp, 2 * kPointerSize), edx);
3622 3622
3623 // Try the new space allocation. Start out with computing the size of 3623 // Try the new space allocation. Start out with computing the size of
3624 // the arguments object and the elements array. 3624 // the arguments object and the elements array.
3625 NearLabel add_arguments_object; 3625 NearLabel add_arguments_object;
3626 __ bind(&try_allocate); 3626 __ bind(&try_allocate);
3627 __ test(ecx, Operand(ecx)); 3627 __ test(ecx, Operand(ecx));
3628 __ j(zero, &add_arguments_object); 3628 __ j(zero, &add_arguments_object);
3629 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize)); 3629 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize));
3630 __ bind(&add_arguments_object); 3630 __ bind(&add_arguments_object);
3631 __ add(Operand(ecx), Immediate(Heap::kArgumentsObjectSize)); 3631 __ add(Operand(ecx), Immediate(GetArgumentsObjectSize()));
3632 3632
3633 // Do the allocation of both objects in one go. 3633 // Do the allocation of both objects in one go.
3634 __ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT); 3634 __ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT);
3635 3635
3636 // Get the arguments boilerplate from the current (global) context. 3636 // Get the arguments boilerplate from the current (global) context.
3637 int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX);
3638 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 3637 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
3639 __ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset)); 3638 __ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset));
3640 __ mov(edi, Operand(edi, offset)); 3639 __ mov(edi, Operand(edi,
3640 Context::SlotOffset(GetArgumentsBoilerplateIndex())));
3641 3641
3642 // Copy the JS object part. 3642 // Copy the JS object part.
3643 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { 3643 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) {
3644 __ mov(ebx, FieldOperand(edi, i)); 3644 __ mov(ebx, FieldOperand(edi, i));
3645 __ mov(FieldOperand(eax, i), ebx); 3645 __ mov(FieldOperand(eax, i), ebx);
3646 } 3646 }
3647 3647
3648 // Setup the callee in-object property. 3648 if (type_ == NEW_NON_STRICT) {
3649 STATIC_ASSERT(Heap::arguments_callee_index == 0); 3649 // Setup the callee in-object property.
3650 __ mov(ebx, Operand(esp, 3 * kPointerSize)); 3650 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1);
3651 __ mov(FieldOperand(eax, JSObject::kHeaderSize), ebx); 3651 __ mov(ebx, Operand(esp, 3 * kPointerSize));
3652 __ mov(FieldOperand(eax, JSObject::kHeaderSize +
3653 Heap::kArgumentsCalleeIndex * kPointerSize),
3654 ebx);
3655 }
3652 3656
3653 // Get the length (smi tagged) and set that as an in-object property too. 3657 // Get the length (smi tagged) and set that as an in-object property too.
3654 STATIC_ASSERT(Heap::arguments_length_index == 1); 3658 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
3655 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 3659 __ mov(ecx, Operand(esp, 1 * kPointerSize));
3656 __ mov(FieldOperand(eax, JSObject::kHeaderSize + kPointerSize), ecx); 3660 __ mov(FieldOperand(eax, JSObject::kHeaderSize +
3661 Heap::kArgumentsLengthIndex * kPointerSize),
3662 ecx);
3657 3663
3658 // If there are no actual arguments, we're done. 3664 // If there are no actual arguments, we're done.
3659 Label done; 3665 Label done;
3660 __ test(ecx, Operand(ecx)); 3666 __ test(ecx, Operand(ecx));
3661 __ j(zero, &done); 3667 __ j(zero, &done);
3662 3668
3663 // Get the parameters pointer from the stack. 3669 // Get the parameters pointer from the stack.
3664 __ mov(edx, Operand(esp, 2 * kPointerSize)); 3670 __ mov(edx, Operand(esp, 2 * kPointerSize));
3665 3671
3666 // Setup the elements pointer in the allocated arguments object and 3672 // Setup the elements pointer in the allocated arguments object and
3667 // initialize the header in the elements fixed array. 3673 // initialize the header in the elements fixed array.
3668 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize)); 3674 __ lea(edi, Operand(eax, GetArgumentsObjectSize()));
3669 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); 3675 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi);
3670 __ mov(FieldOperand(edi, FixedArray::kMapOffset), 3676 __ mov(FieldOperand(edi, FixedArray::kMapOffset),
3671 Immediate(Factory::fixed_array_map())); 3677 Immediate(Factory::fixed_array_map()));
3678
3672 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); 3679 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx);
3673 // Untag the length for the loop below. 3680 // Untag the length for the loop below.
3674 __ SmiUntag(ecx); 3681 __ SmiUntag(ecx);
3675 3682
3676 // Copy the fixed array slots. 3683 // Copy the fixed array slots.
3677 NearLabel loop; 3684 NearLabel loop;
3678 __ bind(&loop); 3685 __ bind(&loop);
3679 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver. 3686 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver.
3680 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx); 3687 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx);
3681 __ add(Operand(edi), Immediate(kPointerSize)); 3688 __ add(Operand(edi), Immediate(kPointerSize));
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after
6425 // Do a tail call to the rewritten stub. 6432 // Do a tail call to the rewritten stub.
6426 __ jmp(Operand(edi)); 6433 __ jmp(Operand(edi));
6427 } 6434 }
6428 6435
6429 6436
6430 #undef __ 6437 #undef __
6431 6438
6432 } } // namespace v8::internal 6439 } } // namespace v8::internal
6433 6440
6434 #endif // V8_TARGET_ARCH_IA32 6441 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698