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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 Counters* counters = masm->isolate()->counters(); | 151 Counters* counters = masm->isolate()->counters(); |
152 | 152 |
153 Label gc; | 153 Label gc; |
154 __ Allocate(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); | 154 __ Allocate(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); |
155 | 155 |
156 __ IncrementCounter(counters->fast_new_closure_total(), 1); | 156 __ IncrementCounter(counters->fast_new_closure_total(), 1); |
157 | 157 |
158 // Get the function info from the stack. | 158 // Get the function info from the stack. |
159 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); | 159 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); |
160 | 160 |
161 int map_index = (language_mode_ == CLASSIC_MODE) | 161 int map_index = Context::FunctionMapIndex(language_mode_, is_generator_); |
162 ? Context::FUNCTION_MAP_INDEX | |
163 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | |
164 | 162 |
165 // Compute the function map in the current native context and set that | 163 // Compute the function map in the current native context and set that |
166 // as the map of the allocated object. | 164 // as the map of the allocated object. |
167 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 165 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
168 __ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset)); | 166 __ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset)); |
169 __ movq(rbx, Operand(rcx, Context::SlotOffset(map_index))); | 167 __ movq(rbx, Operand(rcx, Context::SlotOffset(map_index))); |
170 __ movq(FieldOperand(rax, JSObject::kMapOffset), rbx); | 168 __ movq(FieldOperand(rax, JSObject::kMapOffset), rbx); |
171 | 169 |
172 // Initialize the rest of the function. We don't have to update the | 170 // Initialize the rest of the function. We don't have to update the |
173 // write barrier because the allocated object is in new space. | 171 // write barrier because the allocated object is in new space. |
(...skipping 6682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6856 #endif | 6854 #endif |
6857 | 6855 |
6858 __ Ret(); | 6856 __ Ret(); |
6859 } | 6857 } |
6860 | 6858 |
6861 #undef __ | 6859 #undef __ |
6862 | 6860 |
6863 } } // namespace v8::internal | 6861 } } // namespace v8::internal |
6864 | 6862 |
6865 #endif // V8_TARGET_ARCH_X64 | 6863 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |