| 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 = is_generator_ |
| 167 ? Context::FUNCTION_MAP_INDEX | 167 ? ((language_mode_ == CLASSIC_MODE) |
| 168 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | 168 ? Context::GENERATOR_FUNCTION_MAP_INDEX |
| 169 : Context::STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX) |
| 170 : ((language_mode_ == CLASSIC_MODE) |
| 171 ? Context::FUNCTION_MAP_INDEX |
| 172 : Context::STRICT_MODE_FUNCTION_MAP_INDEX); |
| 169 | 173 |
| 170 // Compute the function map in the current native context and set that | 174 // Compute the function map in the current native context and set that |
| 171 // as the map of the allocated object. | 175 // as the map of the allocated object. |
| 172 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 176 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 173 __ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset)); | 177 __ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset)); |
| 174 __ mov(ebx, Operand(ecx, Context::SlotOffset(map_index))); | 178 __ mov(ebx, Operand(ecx, Context::SlotOffset(map_index))); |
| 175 __ mov(FieldOperand(eax, JSObject::kMapOffset), ebx); | 179 __ mov(FieldOperand(eax, JSObject::kMapOffset), ebx); |
| 176 | 180 |
| 177 // Initialize the rest of the function. We don't have to update the | 181 // Initialize the rest of the function. We don't have to update the |
| 178 // write barrier because the allocated object is in new space. | 182 // 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. | 7866 // Restore ecx. |
| 7863 __ pop(ecx); | 7867 __ pop(ecx); |
| 7864 __ ret(0); | 7868 __ ret(0); |
| 7865 } | 7869 } |
| 7866 | 7870 |
| 7867 #undef __ | 7871 #undef __ |
| 7868 | 7872 |
| 7869 } } // namespace v8::internal | 7873 } } // namespace v8::internal |
| 7870 | 7874 |
| 7871 #endif // V8_TARGET_ARCH_IA32 | 7875 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |