OLD | NEW |
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 Factory* factory = masm->isolate()->factory(); | 131 Factory* factory = masm->isolate()->factory(); |
132 __ mov(FieldOperand(eax, HeapObject::kMapOffset), | 132 __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
133 factory->function_context_map()); | 133 factory->function_context_map()); |
134 __ mov(FieldOperand(eax, Context::kLengthOffset), | 134 __ mov(FieldOperand(eax, Context::kLengthOffset), |
135 Immediate(Smi::FromInt(length))); | 135 Immediate(Smi::FromInt(length))); |
136 | 136 |
137 // Setup the fixed slots. | 137 // Setup the fixed slots. |
138 __ Set(ebx, Immediate(0)); // Set to NULL. | 138 __ Set(ebx, Immediate(0)); // Set to NULL. |
139 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); | 139 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); |
140 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); | 140 __ mov(Operand(eax, Context::SlotOffset(Context::FCONTEXT_INDEX)), eax); |
141 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx); | 141 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), esi); |
142 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); | 142 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); |
143 | 143 |
144 // Copy the global object from the surrounding context. We go through the | 144 // Copy the global object from the previous context. |
145 // context in the function (ecx) to match the allocation behavior we have | 145 __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
146 // in the runtime system (see Heap::AllocateFunctionContext). | |
147 __ mov(ebx, FieldOperand(ecx, JSFunction::kContextOffset)); | |
148 __ mov(ebx, Operand(ebx, Context::SlotOffset(Context::GLOBAL_INDEX))); | |
149 __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx); | 146 __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx); |
150 | 147 |
151 // Initialize the rest of the slots to undefined. | 148 // Initialize the rest of the slots to undefined. |
152 __ mov(ebx, factory->undefined_value()); | 149 __ mov(ebx, factory->undefined_value()); |
153 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { | 150 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { |
154 __ mov(Operand(eax, Context::SlotOffset(i)), ebx); | 151 __ mov(Operand(eax, Context::SlotOffset(i)), ebx); |
155 } | 152 } |
156 | 153 |
157 // Return and remove the on-stack parameter. | 154 // Return and remove the on-stack parameter. |
158 __ mov(esi, Operand(eax)); | 155 __ mov(esi, Operand(eax)); |
(...skipping 6034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6193 __ Drop(1); | 6190 __ Drop(1); |
6194 __ ret(2 * kPointerSize); | 6191 __ ret(2 * kPointerSize); |
6195 } | 6192 } |
6196 | 6193 |
6197 | 6194 |
6198 #undef __ | 6195 #undef __ |
6199 | 6196 |
6200 } } // namespace v8::internal | 6197 } } // namespace v8::internal |
6201 | 6198 |
6202 #endif // V8_TARGET_ARCH_IA32 | 6199 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |