OLD | NEW |
---|---|
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 Loading... | |
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 // If this block context is nested in the global context we get a smi | |
217 // sentinel instead of a function. The block context should get the | |
218 // canonical empty function of the global context as its closure which | |
219 // we still have to look up. | |
220 Label after_sentinel; | |
221 __ JumpIfNotSmi(r3, &after_sentinel); | |
danno
2011/10/06 14:44:08
Make a debug check for zero?
Steven
2011/10/06 16:02:40
Done.
| |
222 __ ldr(r3, GlobalObjectOperand()); | |
223 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalContextOffset)); | |
224 __ ldr(r3, ContextOperand(r3, Context::CLOSURE_INDEX)); | |
225 __ bind(&after_sentinel); | |
226 | |
227 // Setup the fixed slots. | |
228 __ str(r3, ContextOperand(r0, Context::CLOSURE_INDEX)); | |
229 __ str(cp, ContextOperand(r0, Context::PREVIOUS_INDEX)); | |
230 __ str(r1, ContextOperand(r0, Context::EXTENSION_INDEX)); | |
231 | |
232 // Copy the global object from the previous context. | |
233 __ ldr(r1, ContextOperand(cp, Context::GLOBAL_INDEX)); | |
234 __ str(r1, ContextOperand(r0, Context::GLOBAL_INDEX)); | |
235 | |
236 // Initialize the rest of the slots to the hole value. | |
237 __ LoadRoot(r1, Heap::kTheHoleValueRootIndex); | |
238 for (int i = 0; i < slots_; i++) { | |
239 __ str(r1, ContextOperand(r0, i + Context::MIN_CONTEXT_SLOTS)); | |
240 } | |
241 | |
242 // Remove the on-stack argument and return. | |
243 __ mov(cp, r0); | |
244 __ add(sp, sp, Operand(2 * kPointerSize)); | |
245 __ Ret(); | |
246 | |
247 // Need to collect. Call into runtime system. | |
248 __ bind(&gc); | |
249 __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); | |
250 } | |
251 | |
252 | |
192 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { | 253 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
193 // Stack layout on entry: | 254 // Stack layout on entry: |
194 // | 255 // |
195 // [sp]: constant elements. | 256 // [sp]: constant elements. |
196 // [sp + kPointerSize]: literal index. | 257 // [sp + kPointerSize]: literal index. |
197 // [sp + (2 * kPointerSize)]: literals array. | 258 // [sp + (2 * kPointerSize)]: literals array. |
198 | 259 |
199 // All sizes here are multiples of kPointerSize. | 260 // All sizes here are multiples of kPointerSize. |
200 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; | 261 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; |
201 int size = JSArray::kSize + elements_size; | 262 int size = JSArray::kSize + elements_size; |
(...skipping 6884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7086 | 7147 |
7087 // Fall through when we need to inform the incremental marker. | 7148 // Fall through when we need to inform the incremental marker. |
7088 } | 7149 } |
7089 | 7150 |
7090 | 7151 |
7091 #undef __ | 7152 #undef __ |
7092 | 7153 |
7093 } } // namespace v8::internal | 7154 } } // namespace v8::internal |
7094 | 7155 |
7095 #endif // V8_TARGET_ARCH_ARM | 7156 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |