| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Create a new closure from the given function info in new | 161 // Create a new closure from the given function info in new |
| 162 // space. Set the context to the current context in cp. | 162 // space. Set the context to the current context in cp. |
| 163 Counters* counters = masm->isolate()->counters(); | 163 Counters* counters = masm->isolate()->counters(); |
| 164 | 164 |
| 165 Label gc; | 165 Label gc; |
| 166 | 166 |
| 167 // Pop the function info from the stack. | 167 // Pop the function info from the stack. |
| 168 __ pop(a3); | 168 __ pop(a3); |
| 169 | 169 |
| 170 // Attempt to allocate new JSFunction in new space. | 170 // Attempt to allocate new JSFunction in new space. |
| 171 __ AllocateInNewSpace(JSFunction::kSize, | 171 __ Allocate(JSFunction::kSize, v0, a1, a2, &gc, TAG_OBJECT); |
| 172 v0, | |
| 173 a1, | |
| 174 a2, | |
| 175 &gc, | |
| 176 TAG_OBJECT); | |
| 177 | 172 |
| 178 __ IncrementCounter(counters->fast_new_closure_total(), 1, t2, t3); | 173 __ IncrementCounter(counters->fast_new_closure_total(), 1, t2, t3); |
| 179 | 174 |
| 180 int map_index = (language_mode_ == CLASSIC_MODE) | 175 int map_index = (language_mode_ == CLASSIC_MODE) |
| 181 ? Context::FUNCTION_MAP_INDEX | 176 ? Context::FUNCTION_MAP_INDEX |
| 182 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; | 177 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; |
| 183 | 178 |
| 184 // Compute the function map in the current native context and set that | 179 // Compute the function map in the current native context and set that |
| 185 // as the map of the allocated object. | 180 // as the map of the allocated object. |
| 186 __ lw(a2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 181 __ lw(a2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); | 288 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); |
| 294 } | 289 } |
| 295 | 290 |
| 296 | 291 |
| 297 void FastNewContextStub::Generate(MacroAssembler* masm) { | 292 void FastNewContextStub::Generate(MacroAssembler* masm) { |
| 298 // Try to allocate the context in new space. | 293 // Try to allocate the context in new space. |
| 299 Label gc; | 294 Label gc; |
| 300 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 295 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 301 | 296 |
| 302 // Attempt to allocate the context in new space. | 297 // Attempt to allocate the context in new space. |
| 303 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 298 __ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT); |
| 304 v0, | |
| 305 a1, | |
| 306 a2, | |
| 307 &gc, | |
| 308 TAG_OBJECT); | |
| 309 | 299 |
| 310 // Load the function from the stack. | 300 // Load the function from the stack. |
| 311 __ lw(a3, MemOperand(sp, 0)); | 301 __ lw(a3, MemOperand(sp, 0)); |
| 312 | 302 |
| 313 // Set up the object header. | 303 // Set up the object header. |
| 314 __ LoadRoot(a1, Heap::kFunctionContextMapRootIndex); | 304 __ LoadRoot(a1, Heap::kFunctionContextMapRootIndex); |
| 315 __ li(a2, Operand(Smi::FromInt(length))); | 305 __ li(a2, Operand(Smi::FromInt(length))); |
| 316 __ sw(a2, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 306 __ sw(a2, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
| 317 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | 307 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 318 | 308 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 342 | 332 |
| 343 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 333 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
| 344 // Stack layout on entry: | 334 // Stack layout on entry: |
| 345 // | 335 // |
| 346 // [sp]: function. | 336 // [sp]: function. |
| 347 // [sp + kPointerSize]: serialized scope info | 337 // [sp + kPointerSize]: serialized scope info |
| 348 | 338 |
| 349 // Try to allocate the context in new space. | 339 // Try to allocate the context in new space. |
| 350 Label gc; | 340 Label gc; |
| 351 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 341 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 352 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 342 __ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT); |
| 353 v0, a1, a2, &gc, TAG_OBJECT); | |
| 354 | 343 |
| 355 // Load the function from the stack. | 344 // Load the function from the stack. |
| 356 __ lw(a3, MemOperand(sp, 0)); | 345 __ lw(a3, MemOperand(sp, 0)); |
| 357 | 346 |
| 358 // Load the serialized scope info from the stack. | 347 // Load the serialized scope info from the stack. |
| 359 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); | 348 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); |
| 360 | 349 |
| 361 // Set up the object header. | 350 // Set up the object header. |
| 362 __ LoadRoot(a2, Heap::kBlockContextMapRootIndex); | 351 __ LoadRoot(a2, Heap::kBlockContextMapRootIndex); |
| 363 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); | 352 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 411 |
| 423 int size = JSArray::kSize; | 412 int size = JSArray::kSize; |
| 424 int allocation_info_start = size; | 413 int allocation_info_start = size; |
| 425 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { | 414 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
| 426 size += AllocationSiteInfo::kSize; | 415 size += AllocationSiteInfo::kSize; |
| 427 } | 416 } |
| 428 size += elements_size; | 417 size += elements_size; |
| 429 | 418 |
| 430 // Allocate both the JS array and the elements array in one big | 419 // Allocate both the JS array and the elements array in one big |
| 431 // allocation. This avoids multiple limit checks. | 420 // allocation. This avoids multiple limit checks. |
| 432 __ AllocateInNewSpace(size, | 421 __ Allocate(size, v0, a1, a2, fail, TAG_OBJECT); |
| 433 v0, | |
| 434 a1, | |
| 435 a2, | |
| 436 fail, | |
| 437 TAG_OBJECT); | |
| 438 | 422 |
| 439 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { | 423 if (allocation_site_mode == TRACK_ALLOCATION_SITE) { |
| 440 __ li(a2, Operand(Handle<Map>(masm->isolate()->heap()-> | 424 __ li(a2, Operand(Handle<Map>(masm->isolate()->heap()-> |
| 441 allocation_site_info_map()))); | 425 allocation_site_info_map()))); |
| 442 __ sw(a2, FieldMemOperand(v0, allocation_info_start)); | 426 __ sw(a2, FieldMemOperand(v0, allocation_info_start)); |
| 443 __ sw(a3, FieldMemOperand(v0, allocation_info_start + kPointerSize)); | 427 __ sw(a3, FieldMemOperand(v0, allocation_info_start + kPointerSize)); |
| 444 } | 428 } |
| 445 | 429 |
| 446 // Copy the JS array part. | 430 // Copy the JS array part. |
| 447 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { | 431 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
| (...skipping 7760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8208 __ Pop(ra, t1, a1); | 8192 __ Pop(ra, t1, a1); |
| 8209 __ Ret(); | 8193 __ Ret(); |
| 8210 } | 8194 } |
| 8211 | 8195 |
| 8212 | 8196 |
| 8213 #undef __ | 8197 #undef __ |
| 8214 | 8198 |
| 8215 } } // namespace v8::internal | 8199 } } // namespace v8::internal |
| 8216 | 8200 |
| 8217 #endif // V8_TARGET_ARCH_MIPS | 8201 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |