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

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

Issue 6711027: [Isolates] Merge 7201:7258 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 void FastNewClosureStub::Generate(MacroAssembler* masm) { 64 void FastNewClosureStub::Generate(MacroAssembler* masm) {
65 // Create a new closure from the given function info in new 65 // Create a new closure from the given function info in new
66 // space. Set the context to the current context in esi. 66 // space. Set the context to the current context in esi.
67 Label gc; 67 Label gc;
68 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); 68 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT);
69 69
70 // Get the function info from the stack. 70 // Get the function info from the stack.
71 __ mov(edx, Operand(esp, 1 * kPointerSize)); 71 __ mov(edx, Operand(esp, 1 * kPointerSize));
72 72
73 int map_index = strict_mode_ == kStrictMode
74 ? Context::STRICT_MODE_FUNCTION_MAP_INDEX
75 : Context::FUNCTION_MAP_INDEX;
76
73 // Compute the function map in the current global context and set that 77 // Compute the function map in the current global context and set that
74 // as the map of the allocated object. 78 // as the map of the allocated object.
75 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 79 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
76 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset)); 80 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset));
77 __ mov(ecx, Operand(ecx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX))); 81 __ mov(ecx, Operand(ecx, Context::SlotOffset(map_index)));
78 __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx); 82 __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx);
79 83
80 // Initialize the rest of the function. We don't have to update the 84 // Initialize the rest of the function. We don't have to update the
81 // write barrier because the allocated object is in new space. 85 // write barrier because the allocated object is in new space.
82 __ mov(ebx, Immediate(FACTORY->empty_fixed_array())); 86 __ mov(ebx, Immediate(FACTORY->empty_fixed_array()));
83 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx); 87 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx);
84 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx); 88 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx);
85 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset), 89 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset),
86 Immediate(FACTORY->the_hole_value())); 90 Immediate(FACTORY->the_hole_value()));
87 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx); 91 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx);
(...skipping 3539 matching lines...) Expand 10 before | Expand all | Expand 10 after
3627 __ mov(Operand(esp, 2 * kPointerSize), edx); 3631 __ mov(Operand(esp, 2 * kPointerSize), edx);
3628 3632
3629 // Try the new space allocation. Start out with computing the size of 3633 // Try the new space allocation. Start out with computing the size of
3630 // the arguments object and the elements array. 3634 // the arguments object and the elements array.
3631 NearLabel add_arguments_object; 3635 NearLabel add_arguments_object;
3632 __ bind(&try_allocate); 3636 __ bind(&try_allocate);
3633 __ test(ecx, Operand(ecx)); 3637 __ test(ecx, Operand(ecx));
3634 __ j(zero, &add_arguments_object); 3638 __ j(zero, &add_arguments_object);
3635 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize)); 3639 __ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize));
3636 __ bind(&add_arguments_object); 3640 __ bind(&add_arguments_object);
3637 __ add(Operand(ecx), Immediate(Heap::kArgumentsObjectSize)); 3641 __ add(Operand(ecx), Immediate(GetArgumentsObjectSize()));
3638 3642
3639 // Do the allocation of both objects in one go. 3643 // Do the allocation of both objects in one go.
3640 __ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT); 3644 __ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT);
3641 3645
3642 // Get the arguments boilerplate from the current (global) context. 3646 // Get the arguments boilerplate from the current (global) context.
3643 int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX);
3644 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 3647 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
3645 __ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset)); 3648 __ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset));
3646 __ mov(edi, Operand(edi, offset)); 3649 __ mov(edi, Operand(edi,
3650 Context::SlotOffset(GetArgumentsBoilerplateIndex())));
3647 3651
3648 // Copy the JS object part. 3652 // Copy the JS object part.
3649 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { 3653 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) {
3650 __ mov(ebx, FieldOperand(edi, i)); 3654 __ mov(ebx, FieldOperand(edi, i));
3651 __ mov(FieldOperand(eax, i), ebx); 3655 __ mov(FieldOperand(eax, i), ebx);
3652 } 3656 }
3653 3657
3654 // Setup the callee in-object property. 3658 if (type_ == NEW_NON_STRICT) {
3655 STATIC_ASSERT(Heap::arguments_callee_index == 0); 3659 // Setup the callee in-object property.
3656 __ mov(ebx, Operand(esp, 3 * kPointerSize)); 3660 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1);
3657 __ mov(FieldOperand(eax, JSObject::kHeaderSize), ebx); 3661 __ mov(ebx, Operand(esp, 3 * kPointerSize));
3662 __ mov(FieldOperand(eax, JSObject::kHeaderSize +
3663 Heap::kArgumentsCalleeIndex * kPointerSize),
3664 ebx);
3665 }
3658 3666
3659 // Get the length (smi tagged) and set that as an in-object property too. 3667 // Get the length (smi tagged) and set that as an in-object property too.
3660 STATIC_ASSERT(Heap::arguments_length_index == 1); 3668 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
3661 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 3669 __ mov(ecx, Operand(esp, 1 * kPointerSize));
3662 __ mov(FieldOperand(eax, JSObject::kHeaderSize + kPointerSize), ecx); 3670 __ mov(FieldOperand(eax, JSObject::kHeaderSize +
3671 Heap::kArgumentsLengthIndex * kPointerSize),
3672 ecx);
3663 3673
3664 // If there are no actual arguments, we're done. 3674 // If there are no actual arguments, we're done.
3665 Label done; 3675 Label done;
3666 __ test(ecx, Operand(ecx)); 3676 __ test(ecx, Operand(ecx));
3667 __ j(zero, &done); 3677 __ j(zero, &done);
3668 3678
3669 // Get the parameters pointer from the stack. 3679 // Get the parameters pointer from the stack.
3670 __ mov(edx, Operand(esp, 2 * kPointerSize)); 3680 __ mov(edx, Operand(esp, 2 * kPointerSize));
3671 3681
3672 // Setup the elements pointer in the allocated arguments object and 3682 // Setup the elements pointer in the allocated arguments object and
3673 // initialize the header in the elements fixed array. 3683 // initialize the header in the elements fixed array.
3674 __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize)); 3684 __ lea(edi, Operand(eax, GetArgumentsObjectSize()));
3675 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); 3685 __ mov(FieldOperand(eax, JSObject::kElementsOffset), edi);
3676 __ mov(FieldOperand(edi, FixedArray::kMapOffset), 3686 __ mov(FieldOperand(edi, FixedArray::kMapOffset),
3677 Immediate(FACTORY->fixed_array_map())); 3687 Immediate(FACTORY->fixed_array_map()));
3688
3678 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); 3689 __ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx);
3679 // Untag the length for the loop below. 3690 // Untag the length for the loop below.
3680 __ SmiUntag(ecx); 3691 __ SmiUntag(ecx);
3681 3692
3682 // Copy the fixed array slots. 3693 // Copy the fixed array slots.
3683 NearLabel loop; 3694 NearLabel loop;
3684 __ bind(&loop); 3695 __ bind(&loop);
3685 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver. 3696 __ mov(ebx, Operand(edx, -1 * kPointerSize)); // Skip receiver.
3686 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx); 3697 __ mov(FieldOperand(edi, FixedArray::kHeaderSize), ebx);
3687 __ add(Operand(edi), Immediate(kPointerSize)); 3698 __ add(Operand(edi), Immediate(kPointerSize));
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after
6446 // Do a tail call to the rewritten stub. 6457 // Do a tail call to the rewritten stub.
6447 __ jmp(Operand(edi)); 6458 __ jmp(Operand(edi));
6448 } 6459 }
6449 6460
6450 6461
6451 #undef __ 6462 #undef __
6452 6463
6453 } } // namespace v8::internal 6464 } } // namespace v8::internal
6454 6465
6455 #endif // V8_TARGET_ARCH_IA32 6466 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698