OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 6756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6767 __ mov(FieldOperand(eax, HeapObject::kMapOffset), Factory::context_map()); | 6767 __ mov(FieldOperand(eax, HeapObject::kMapOffset), Factory::context_map()); |
6768 __ mov(FieldOperand(eax, Array::kLengthOffset), Immediate(length)); | 6768 __ mov(FieldOperand(eax, Array::kLengthOffset), Immediate(length)); |
6769 | 6769 |
6770 // Setup the fixed slots. | 6770 // Setup the fixed slots. |
6771 __ xor_(ebx, Operand(ebx)); // Set to NULL. | 6771 __ xor_(ebx, Operand(ebx)); // Set to NULL. |
6772 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); | 6772 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); |
6773 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); | 6773 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); |
6774 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx); | 6774 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx); |
6775 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); | 6775 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); |
6776 | 6776 |
6777 // Copy the global object from the surrounding context. | 6777 // Copy the global object from the surrounding context. We go through the |
6778 __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 6778 // context in the function (ecx) to match the allocation behavior we have |
| 6779 // in the runtime system (see Heap::AllocateFunctionContext). |
| 6780 __ mov(ebx, FieldOperand(ecx, JSFunction::kContextOffset)); |
| 6781 __ mov(ebx, Operand(ebx, Context::SlotOffset(Context::GLOBAL_INDEX))); |
6779 __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx); | 6782 __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx); |
6780 | 6783 |
6781 // Initialize the rest of the slots to undefined. | 6784 // Initialize the rest of the slots to undefined. |
6782 __ mov(ebx, Factory::undefined_value()); | 6785 __ mov(ebx, Factory::undefined_value()); |
6783 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { | 6786 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { |
6784 __ mov(Operand(eax, Context::SlotOffset(i)), ebx); | 6787 __ mov(Operand(eax, Context::SlotOffset(i)), ebx); |
6785 } | 6788 } |
6786 | 6789 |
6787 // Return and remove the on-stack parameter. | 6790 // Return and remove the on-stack parameter. |
6788 __ mov(esi, Operand(eax)); | 6791 __ mov(esi, Operand(eax)); |
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8959 __ add(Operand(dest), Immediate(2)); | 8962 __ add(Operand(dest), Immediate(2)); |
8960 } | 8963 } |
8961 __ sub(Operand(count), Immediate(1)); | 8964 __ sub(Operand(count), Immediate(1)); |
8962 __ j(not_zero, &loop); | 8965 __ j(not_zero, &loop); |
8963 } | 8966 } |
8964 | 8967 |
8965 | 8968 |
8966 #undef __ | 8969 #undef __ |
8967 | 8970 |
8968 } } // namespace v8::internal | 8971 } } // namespace v8::internal |
OLD | NEW |