| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Create a new closure from the given function info in new | 159 // Create a new closure from the given function info in new |
| 160 // space. Set the context to the current context in cp. | 160 // space. Set the context to the current context in cp. |
| 161 Counters* counters = masm->isolate()->counters(); | 161 Counters* counters = masm->isolate()->counters(); |
| 162 | 162 |
| 163 Label gc; | 163 Label gc; |
| 164 | 164 |
| 165 // Pop the function info from the stack. | 165 // Pop the function info from the stack. |
| 166 __ pop(r3); | 166 __ pop(r3); |
| 167 | 167 |
| 168 // Attempt to allocate new JSFunction in new space. | 168 // Attempt to allocate new JSFunction in new space. |
| 169 __ AllocateInNewSpace(JSFunction::kSize, | 169 __ Allocate(JSFunction::kSize, r0, r1, r2, &gc, TAG_OBJECT); |
| 170 r0, | |
| 171 r1, | |
| 172 r2, | |
| 173 &gc, | |
| 174 TAG_OBJECT); | |
| 175 | 170 |
| 176 __ IncrementCounter(counters->fast_new_closure_total(), 1, r6, r7); | 171 __ IncrementCounter(counters->fast_new_closure_total(), 1, r6, r7); |
| 177 | 172 |
| 178 int map_index = (language_mode_ == CLASSIC_MODE) | 173 int map_index = (language_mode_ == CLASSIC_MODE) |
| 179 ? Context::FUNCTION_MAP_INDEX | 174 ? Context::FUNCTION_MAP_INDEX |
| 180 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | 175 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; |
| 181 | 176 |
| 182 // Compute the function map in the current native context and set that | 177 // Compute the function map in the current native context and set that |
| 183 // as the map of the allocated object. | 178 // as the map of the allocated object. |
| 184 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 179 __ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); | 286 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); |
| 292 } | 287 } |
| 293 | 288 |
| 294 | 289 |
| 295 void FastNewContextStub::Generate(MacroAssembler* masm) { | 290 void FastNewContextStub::Generate(MacroAssembler* masm) { |
| 296 // Try to allocate the context in new space. | 291 // Try to allocate the context in new space. |
| 297 Label gc; | 292 Label gc; |
| 298 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 293 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 299 | 294 |
| 300 // Attempt to allocate the context in new space. | 295 // Attempt to allocate the context in new space. |
| 301 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 296 __ Allocate(FixedArray::SizeFor(length), r0, r1, r2, &gc, TAG_OBJECT); |
| 302 r0, | |
| 303 r1, | |
| 304 r2, | |
| 305 &gc, | |
| 306 TAG_OBJECT); | |
| 307 | 297 |
| 308 // Load the function from the stack. | 298 // Load the function from the stack. |
| 309 __ ldr(r3, MemOperand(sp, 0)); | 299 __ ldr(r3, MemOperand(sp, 0)); |
| 310 | 300 |
| 311 // Set up the object header. | 301 // Set up the object header. |
| 312 __ LoadRoot(r1, Heap::kFunctionContextMapRootIndex); | 302 __ LoadRoot(r1, Heap::kFunctionContextMapRootIndex); |
| 313 __ mov(r2, Operand(Smi::FromInt(length))); | 303 __ mov(r2, Operand(Smi::FromInt(length))); |
| 314 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 304 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
| 315 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 305 __ str(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 316 | 306 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 341 | 331 |
| 342 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 332 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
| 343 // Stack layout on entry: | 333 // Stack layout on entry: |
| 344 // | 334 // |
| 345 // [sp]: function. | 335 // [sp]: function. |
| 346 // [sp + kPointerSize]: serialized scope info | 336 // [sp + kPointerSize]: serialized scope info |
| 347 | 337 |
| 348 // Try to allocate the context in new space. | 338 // Try to allocate the context in new space. |
| 349 Label gc; | 339 Label gc; |
| 350 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 340 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 351 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 341 __ Allocate(FixedArray::SizeFor(length), r0, r1, r2, &gc, TAG_OBJECT); |
| 352 r0, r1, r2, &gc, TAG_OBJECT); | |
| 353 | 342 |
| 354 // Load the function from the stack. | 343 // Load the function from the stack. |
| 355 __ ldr(r3, MemOperand(sp, 0)); | 344 __ ldr(r3, MemOperand(sp, 0)); |
| 356 | 345 |
| 357 // Load the serialized scope info from the stack. | 346 // Load the serialized scope info from the stack. |
| 358 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); | 347 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); |
| 359 | 348 |
| 360 // Set up the object header. | 349 // Set up the object header. |
| 361 __ LoadRoot(r2, Heap::kBlockContextMapRootIndex); | 350 __ LoadRoot(r2, Heap::kBlockContextMapRootIndex); |
| 362 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 351 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 size += AllocationSiteInfo::kSize; | 417 size += AllocationSiteInfo::kSize; |
| 429 } | 418 } |
| 430 size += elements_size; | 419 size += elements_size; |
| 431 | 420 |
| 432 // Allocate both the JS array and the elements array in one big | 421 // Allocate both the JS array and the elements array in one big |
| 433 // allocation. This avoids multiple limit checks. | 422 // allocation. This avoids multiple limit checks. |
| 434 AllocationFlags flags = TAG_OBJECT; | 423 AllocationFlags flags = TAG_OBJECT; |
| 435 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { | 424 if (mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS) { |
| 436 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); | 425 flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT | flags); |
| 437 } | 426 } |
| 438 __ AllocateInNewSpace(size, r0, r1, r2, fail, flags); | 427 __ Allocate(size, r0, r1, r2, fail, flags); |
| 439 | 428 |
| 440 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { | 429 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
| 441 __ mov(r2, Operand(Handle<Map>(masm->isolate()->heap()-> | 430 __ mov(r2, Operand(Handle<Map>(masm->isolate()->heap()-> |
| 442 allocation_site_info_map()))); | 431 allocation_site_info_map()))); |
| 443 __ str(r2, FieldMemOperand(r0, allocation_info_start)); | 432 __ str(r2, FieldMemOperand(r0, allocation_info_start)); |
| 444 __ str(r3, FieldMemOperand(r0, allocation_info_start + kPointerSize)); | 433 __ str(r3, FieldMemOperand(r0, allocation_info_start + kPointerSize)); |
| 445 } | 434 } |
| 446 | 435 |
| 447 // Copy the JS array part. | 436 // Copy the JS array part. |
| 448 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 437 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
| (...skipping 7638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8087 | 8076 |
| 8088 __ Pop(lr, r5, r1); | 8077 __ Pop(lr, r5, r1); |
| 8089 __ Ret(); | 8078 __ Ret(); |
| 8090 } | 8079 } |
| 8091 | 8080 |
| 8092 #undef __ | 8081 #undef __ |
| 8093 | 8082 |
| 8094 } } // namespace v8::internal | 8083 } } // namespace v8::internal |
| 8095 | 8084 |
| 8096 #endif // V8_TARGET_ARCH_ARM | 8085 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |