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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Create a new closure from the given function info in new | 121 // Create a new closure from the given function info in new |
122 // space. Set the context to the current context in cp. | 122 // space. Set the context to the current context in cp. |
123 Counters* counters = masm->isolate()->counters(); | 123 Counters* counters = masm->isolate()->counters(); |
124 | 124 |
125 Label gc; | 125 Label gc; |
126 | 126 |
127 // Pop the function info from the stack. | 127 // Pop the function info from the stack. |
128 __ pop(r3); | 128 __ pop(r3); |
129 | 129 |
130 // Attempt to allocate new JSFunction in new space. | 130 // Attempt to allocate new JSFunction in new space. |
131 __ AllocateInNewSpace(JSFunction::kSize, | 131 __ Allocate(JSFunction::kSize, r0, r1, r2, &gc, TAG_OBJECT); |
132 r0, | |
133 r1, | |
134 r2, | |
135 &gc, | |
136 TAG_OBJECT); | |
137 | 132 |
138 __ IncrementCounter(counters->fast_new_closure_total(), 1, r6, r7); | 133 __ IncrementCounter(counters->fast_new_closure_total(), 1, r6, r7); |
139 | 134 |
140 int map_index = (language_mode_ == CLASSIC_MODE) | 135 int map_index = (language_mode_ == CLASSIC_MODE) |
141 ? Context::FUNCTION_MAP_INDEX | 136 ? Context::FUNCTION_MAP_INDEX |
142 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | 137 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; |
143 | 138 |
144 // Compute the function map in the current native context and set that | 139 // Compute the function map in the current native context and set that |
145 // as the map of the allocated object. | 140 // as the map of the allocated object. |
146 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 141 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); | 248 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); |
254 } | 249 } |
255 | 250 |
256 | 251 |
257 void FastNewContextStub::Generate(MacroAssembler* masm) { | 252 void FastNewContextStub::Generate(MacroAssembler* masm) { |
258 // Try to allocate the context in new space. | 253 // Try to allocate the context in new space. |
259 Label gc; | 254 Label gc; |
260 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 255 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
261 | 256 |
262 // Attempt to allocate the context in new space. | 257 // Attempt to allocate the context in new space. |
263 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 258 __ Allocate(FixedArray::SizeFor(length), r0, r1, r2, &gc, TAG_OBJECT); |
264 r0, | |
265 r1, | |
266 r2, | |
267 &gc, | |
268 TAG_OBJECT); | |
269 | 259 |
270 // Load the function from the stack. | 260 // Load the function from the stack. |
271 __ ldr(r3, MemOperand(sp, 0)); | 261 __ ldr(r3, MemOperand(sp, 0)); |
272 | 262 |
273 // Set up the object header. | 263 // Set up the object header. |
274 __ LoadRoot(r1, Heap::kFunctionContextMapRootIndex); | 264 __ LoadRoot(r1, Heap::kFunctionContextMapRootIndex); |
275 __ mov(r2, Operand(Smi::FromInt(length))); | 265 __ mov(r2, Operand(Smi::FromInt(length))); |
276 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 266 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
277 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 267 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
278 | 268 |
(...skipping 24 matching lines...) Expand all Loading... |
303 | 293 |
304 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 294 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
305 // Stack layout on entry: | 295 // Stack layout on entry: |
306 // | 296 // |
307 // [sp]: function. | 297 // [sp]: function. |
308 // [sp + kPointerSize]: serialized scope info | 298 // [sp + kPointerSize]: serialized scope info |
309 | 299 |
310 // Try to allocate the context in new space. | 300 // Try to allocate the context in new space. |
311 Label gc; | 301 Label gc; |
312 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 302 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
313 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 303 __ Allocate(FixedArray::SizeFor(length), r0, r1, r2, &gc, TAG_OBJECT); |
314 r0, r1, r2, &gc, TAG_OBJECT); | |
315 | 304 |
316 // Load the function from the stack. | 305 // Load the function from the stack. |
317 __ ldr(r3, MemOperand(sp, 0)); | 306 __ ldr(r3, MemOperand(sp, 0)); |
318 | 307 |
319 // Load the serialized scope info from the stack. | 308 // Load the serialized scope info from the stack. |
320 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); | 309 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); |
321 | 310 |
322 // Set up the object header. | 311 // Set up the object header. |
323 __ LoadRoot(r2, Heap::kBlockContextMapRootIndex); | 312 __ LoadRoot(r2, Heap::kBlockContextMapRootIndex); |
324 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 313 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 size += AllocationSiteInfo::kSize; | 379 size += AllocationSiteInfo::kSize; |
391 } | 380 } |
392 size += elements_size; | 381 size += elements_size; |
393 | 382 |
394 // Allocate both the JS array and the elements array in one big | 383 // Allocate both the JS array and the elements array in one big |
395 // allocation. This avoids multiple limit checks. | 384 // allocation. This avoids multiple limit checks. |
396 AllocationFlags flags = TAG_OBJECT; | 385 AllocationFlags flags = TAG_OBJECT; |
397 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { | 386 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { |
398 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); | 387 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); |
399 } | 388 } |
400 __ AllocateInNewSpace(size, r0, r1, r2, fail, flags); | 389 __ Allocate(size, r0, r1, r2, fail, flags); |
401 | 390 |
402 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { | 391 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
403 __ mov(r2, Operand(Handle<Map>(masm->isolate()->heap()-> | 392 __ mov(r2, Operand(Handle<Map>(masm->isolate()->heap()-> |
404 allocation_site_info_map()))); | 393 allocation_site_info_map()))); |
405 __ str(r2, FieldMemOperand(r0, allocation_info_start)); | 394 __ str(r2, FieldMemOperand(r0, allocation_info_start)); |
406 __ str(r3, FieldMemOperand(r0, allocation_info_start + kPointerSize)); | 395 __ str(r3, FieldMemOperand(r0, allocation_info_start + kPointerSize)); |
407 } | 396 } |
408 | 397 |
409 // Copy the JS array part. | 398 // Copy the JS array part. |
410 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 399 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
(...skipping 7507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7918 | 7907 |
7919 __ Pop(lr, r5, r1); | 7908 __ Pop(lr, r5, r1); |
7920 __ Ret(); | 7909 __ Ret(); |
7921 } | 7910 } |
7922 | 7911 |
7923 #undef __ | 7912 #undef __ |
7924 | 7913 |
7925 } } // namespace v8::internal | 7914 } } // namespace v8::internal |
7926 | 7915 |
7927 #endif // V8_TARGET_ARCH_ARM | 7916 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |