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

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

Issue 8066002: Fast allocation of block contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/code-stubs.h » ('j') | src/code-stubs.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 __ mov(cp, r0); 182 __ mov(cp, r0);
183 __ pop(); 183 __ pop();
184 __ Ret(); 184 __ Ret();
185 185
186 // Need to collect. Call into runtime system. 186 // Need to collect. Call into runtime system.
187 __ bind(&gc); 187 __ bind(&gc);
188 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1); 188 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1);
189 } 189 }
190 190
191 191
192 void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
193 // Stack layout on entry:
194 //
195 // [sp]: function.
196 // [sp + kPointerSize]: serialized scope info
197
198 // Try to allocate the context in new space.
199 Label gc;
200 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
201 __ AllocateInNewSpace(FixedArray::SizeFor(length),
202 r0, r1, r2, &gc, TAG_OBJECT);
203
204 // Load the function from the stack.
205 __ ldr(r3, MemOperand(sp, 0));
206
207 // Load the serialized scope info from the stack.
208 __ ldr(r1, MemOperand(sp, 1 * kPointerSize));
209
210 // Setup the object header.
211 __ LoadRoot(r2, Heap::kBlockContextMapRootIndex);
212 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
213 __ mov(r2, Operand(Smi::FromInt(length)));
214 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset));
215
216 // Setup the fixed slots.
217 __ str(r3, ContextOperand(r0, Context::CLOSURE_INDEX));
218 __ str(cp, ContextOperand(r0, Context::PREVIOUS_INDEX));
219 __ str(r1, ContextOperand(r0, Context::EXTENSION_INDEX));
220
221 // Copy the global object from the previous context.
222 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_INDEX));
223 __ str(r1, ContextOperand(r0, Context::GLOBAL_INDEX));
224
225 // Initialize the rest of the slots to the hole value.
226 __ LoadRoot(r1, Heap::kTheHoleValueRootIndex);
227 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
228 __ str(r1, ContextOperand(r0, i));
229 }
230
231 // Remove the on-stack argument and return.
232 __ mov(cp, r0);
233 __ add(sp, sp, Operand(2 * kPointerSize));
234 __ Ret();
235
236 // Need to collect. Call into runtime system.
237 __ bind(&gc);
238 __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1);
239 }
240
241
192 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { 242 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
193 // Stack layout on entry: 243 // Stack layout on entry:
194 // 244 //
195 // [sp]: constant elements. 245 // [sp]: constant elements.
196 // [sp + kPointerSize]: literal index. 246 // [sp + kPointerSize]: literal index.
197 // [sp + (2 * kPointerSize)]: literals array. 247 // [sp + (2 * kPointerSize)]: literals array.
198 248
199 // All sizes here are multiples of kPointerSize. 249 // All sizes here are multiples of kPointerSize.
200 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; 250 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0;
201 int size = JSArray::kSize + elements_size; 251 int size = JSArray::kSize + elements_size;
(...skipping 6884 matching lines...) Expand 10 before | Expand all | Expand 10 after
7086 7136
7087 // Fall through when we need to inform the incremental marker. 7137 // Fall through when we need to inform the incremental marker.
7088 } 7138 }
7089 7139
7090 7140
7091 #undef __ 7141 #undef __
7092 7142
7093 } } // namespace v8::internal 7143 } } // namespace v8::internal
7094 7144
7095 #endif // V8_TARGET_ARCH_ARM 7145 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.h » ('j') | src/code-stubs.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698