Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 13192004: arrange to create prototypes for generators (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Allow fast closure creation for generators Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698