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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 Counters* counters = masm->isolate()->counters(); | 156 Counters* counters = masm->isolate()->counters(); |
157 | 157 |
158 Label gc; | 158 Label gc; |
159 __ Allocate(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); | 159 __ Allocate(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); |
160 | 160 |
161 __ IncrementCounter(counters->fast_new_closure_total(), 1); | 161 __ IncrementCounter(counters->fast_new_closure_total(), 1); |
162 | 162 |
163 // Get the function info from the stack. | 163 // Get the function info from the stack. |
164 __ mov(edx, Operand(esp, 1 * kPointerSize)); | 164 __ mov(edx, Operand(esp, 1 * kPointerSize)); |
165 | 165 |
166 int map_index = (language_mode_ == CLASSIC_MODE) | 166 int map_index = Context::FunctionMapIndex(language_mode_, is_generator_); |
167 ? Context::FUNCTION_MAP_INDEX | |
168 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | |
169 | 167 |
170 // Compute the function map in the current native context and set that | 168 // Compute the function map in the current native context and set that |
171 // as the map of the allocated object. | 169 // as the map of the allocated object. |
172 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 170 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
173 __ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset)); | 171 __ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset)); |
174 __ mov(ebx, Operand(ecx, Context::SlotOffset(map_index))); | 172 __ mov(ebx, Operand(ecx, Context::SlotOffset(map_index))); |
175 __ mov(FieldOperand(eax, JSObject::kMapOffset), ebx); | 173 __ mov(FieldOperand(eax, JSObject::kMapOffset), ebx); |
176 | 174 |
177 // Initialize the rest of the function. We don't have to update the | 175 // Initialize the rest of the function. We don't have to update the |
178 // write barrier because the allocated object is in new space. | 176 // write barrier because the allocated object is in new space. |
(...skipping 7683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7862 // Restore ecx. | 7860 // Restore ecx. |
7863 __ pop(ecx); | 7861 __ pop(ecx); |
7864 __ ret(0); | 7862 __ ret(0); |
7865 } | 7863 } |
7866 | 7864 |
7867 #undef __ | 7865 #undef __ |
7868 | 7866 |
7869 } } // namespace v8::internal | 7867 } } // namespace v8::internal |
7870 | 7868 |
7871 #endif // V8_TARGET_ARCH_IA32 | 7869 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |