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 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 __ sll(t5, a1, 1); | 2448 __ sll(t5, a1, 1); |
2449 __ addiu(t5, t5, kParameterMapHeaderSize); | 2449 __ addiu(t5, t5, kParameterMapHeaderSize); |
2450 __ bind(¶m_map_size); | 2450 __ bind(¶m_map_size); |
2451 | 2451 |
2452 // 2. Backing store. | 2452 // 2. Backing store. |
2453 __ sll(t6, a2, 1); | 2453 __ sll(t6, a2, 1); |
2454 __ Addu(t5, t5, Operand(t6)); | 2454 __ Addu(t5, t5, Operand(t6)); |
2455 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); | 2455 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); |
2456 | 2456 |
2457 // 3. Arguments object. | 2457 // 3. Arguments object. |
2458 __ Addu(t5, t5, Operand(Heap::kArgumentsObjectSize)); | 2458 __ Addu(t5, t5, Operand(Heap::kSloppyArgumentsObjectSize)); |
2459 | 2459 |
2460 // Do the allocation of all three objects in one go. | 2460 // Do the allocation of all three objects in one go. |
2461 __ Allocate(t5, v0, a3, t0, &runtime, TAG_OBJECT); | 2461 __ Allocate(t5, v0, a3, t0, &runtime, TAG_OBJECT); |
2462 | 2462 |
2463 // v0 = address of new object(s) (tagged) | 2463 // v0 = address of new object(s) (tagged) |
2464 // a2 = argument count (tagged) | 2464 // a2 = argument count (tagged) |
2465 // Get the arguments boilerplate from the current native context into t0. | 2465 // Get the arguments boilerplate from the current native context into t0. |
2466 const int kNormalOffset = | 2466 const int kNormalOffset = |
2467 Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX); | 2467 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX); |
2468 const int kAliasedOffset = | 2468 const int kAliasedOffset = |
2469 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); | 2469 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); |
2470 | 2470 |
2471 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2471 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2472 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); | 2472 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); |
2473 Label skip2_ne, skip2_eq; | 2473 Label skip2_ne, skip2_eq; |
2474 __ Branch(&skip2_ne, ne, a1, Operand(zero_reg)); | 2474 __ Branch(&skip2_ne, ne, a1, Operand(zero_reg)); |
2475 __ lw(t0, MemOperand(t0, kNormalOffset)); | 2475 __ lw(t0, MemOperand(t0, kNormalOffset)); |
2476 __ bind(&skip2_ne); | 2476 __ bind(&skip2_ne); |
2477 | 2477 |
(...skipping 20 matching lines...) Expand all Loading... |
2498 | 2498 |
2499 // Use the length (smi tagged) and set that as an in-object property too. | 2499 // Use the length (smi tagged) and set that as an in-object property too. |
2500 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2500 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2501 const int kLengthOffset = JSObject::kHeaderSize + | 2501 const int kLengthOffset = JSObject::kHeaderSize + |
2502 Heap::kArgumentsLengthIndex * kPointerSize; | 2502 Heap::kArgumentsLengthIndex * kPointerSize; |
2503 __ sw(a2, FieldMemOperand(v0, kLengthOffset)); | 2503 __ sw(a2, FieldMemOperand(v0, kLengthOffset)); |
2504 | 2504 |
2505 // Set up the elements pointer in the allocated arguments object. | 2505 // Set up the elements pointer in the allocated arguments object. |
2506 // If we allocated a parameter map, t0 will point there, otherwise | 2506 // If we allocated a parameter map, t0 will point there, otherwise |
2507 // it will point to the backing store. | 2507 // it will point to the backing store. |
2508 __ Addu(t0, v0, Operand(Heap::kArgumentsObjectSize)); | 2508 __ Addu(t0, v0, Operand(Heap::kSloppyArgumentsObjectSize)); |
2509 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); | 2509 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
2510 | 2510 |
2511 // v0 = address of new object (tagged) | 2511 // v0 = address of new object (tagged) |
2512 // a1 = mapped parameter count (tagged) | 2512 // a1 = mapped parameter count (tagged) |
2513 // a2 = argument count (tagged) | 2513 // a2 = argument count (tagged) |
2514 // t0 = address of parameter map or backing store (tagged) | 2514 // t0 = address of parameter map or backing store (tagged) |
2515 // Initialize parameter map. If there are no mapped arguments, we're done. | 2515 // Initialize parameter map. If there are no mapped arguments, we're done. |
2516 Label skip_parameter_map; | 2516 Label skip_parameter_map; |
2517 Label skip3; | 2517 Label skip3; |
2518 __ Branch(&skip3, ne, a1, Operand(Smi::FromInt(0))); | 2518 __ Branch(&skip3, ne, a1, Operand(Smi::FromInt(0))); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 | 2639 |
2640 // Try the new space allocation. Start out with computing the size | 2640 // Try the new space allocation. Start out with computing the size |
2641 // of the arguments object and the elements array in words. | 2641 // of the arguments object and the elements array in words. |
2642 Label add_arguments_object; | 2642 Label add_arguments_object; |
2643 __ bind(&try_allocate); | 2643 __ bind(&try_allocate); |
2644 __ Branch(&add_arguments_object, eq, a1, Operand(zero_reg)); | 2644 __ Branch(&add_arguments_object, eq, a1, Operand(zero_reg)); |
2645 __ srl(a1, a1, kSmiTagSize); | 2645 __ srl(a1, a1, kSmiTagSize); |
2646 | 2646 |
2647 __ Addu(a1, a1, Operand(FixedArray::kHeaderSize / kPointerSize)); | 2647 __ Addu(a1, a1, Operand(FixedArray::kHeaderSize / kPointerSize)); |
2648 __ bind(&add_arguments_object); | 2648 __ bind(&add_arguments_object); |
2649 __ Addu(a1, a1, Operand(Heap::kArgumentsObjectSizeStrict / kPointerSize)); | 2649 __ Addu(a1, a1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
2650 | 2650 |
2651 // Do the allocation of both objects in one go. | 2651 // Do the allocation of both objects in one go. |
2652 __ Allocate(a1, v0, a2, a3, &runtime, | 2652 __ Allocate(a1, v0, a2, a3, &runtime, |
2653 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2653 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
2654 | 2654 |
2655 // Get the arguments boilerplate from the current native context. | 2655 // Get the arguments boilerplate from the current native context. |
2656 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2656 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2657 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); | 2657 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); |
2658 __ lw(t0, MemOperand(t0, Context::SlotOffset( | 2658 __ lw(t0, MemOperand(t0, Context::SlotOffset( |
2659 Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX))); | 2659 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX))); |
2660 | 2660 |
2661 // Copy the JS object part. | 2661 // Copy the JS object part. |
2662 __ CopyFields(v0, t0, a3.bit(), JSObject::kHeaderSize / kPointerSize); | 2662 __ CopyFields(v0, t0, a3.bit(), JSObject::kHeaderSize / kPointerSize); |
2663 | 2663 |
2664 // Get the length (smi tagged) and set that as an in-object property too. | 2664 // Get the length (smi tagged) and set that as an in-object property too. |
2665 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2665 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2666 __ lw(a1, MemOperand(sp, 0 * kPointerSize)); | 2666 __ lw(a1, MemOperand(sp, 0 * kPointerSize)); |
2667 __ sw(a1, FieldMemOperand(v0, JSObject::kHeaderSize + | 2667 __ sw(a1, FieldMemOperand(v0, JSObject::kHeaderSize + |
2668 Heap::kArgumentsLengthIndex * kPointerSize)); | 2668 Heap::kArgumentsLengthIndex * kPointerSize)); |
2669 | 2669 |
2670 Label done; | 2670 Label done; |
2671 __ Branch(&done, eq, a1, Operand(zero_reg)); | 2671 __ Branch(&done, eq, a1, Operand(zero_reg)); |
2672 | 2672 |
2673 // Get the parameters pointer from the stack. | 2673 // Get the parameters pointer from the stack. |
2674 __ lw(a2, MemOperand(sp, 1 * kPointerSize)); | 2674 __ lw(a2, MemOperand(sp, 1 * kPointerSize)); |
2675 | 2675 |
2676 // Set up the elements pointer in the allocated arguments object and | 2676 // Set up the elements pointer in the allocated arguments object and |
2677 // initialize the header in the elements fixed array. | 2677 // initialize the header in the elements fixed array. |
2678 __ Addu(t0, v0, Operand(Heap::kArgumentsObjectSizeStrict)); | 2678 __ Addu(t0, v0, Operand(Heap::kStrictArgumentsObjectSize)); |
2679 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); | 2679 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
2680 __ LoadRoot(a3, Heap::kFixedArrayMapRootIndex); | 2680 __ LoadRoot(a3, Heap::kFixedArrayMapRootIndex); |
2681 __ sw(a3, FieldMemOperand(t0, FixedArray::kMapOffset)); | 2681 __ sw(a3, FieldMemOperand(t0, FixedArray::kMapOffset)); |
2682 __ sw(a1, FieldMemOperand(t0, FixedArray::kLengthOffset)); | 2682 __ sw(a1, FieldMemOperand(t0, FixedArray::kLengthOffset)); |
2683 // Untag the length for the loop. | 2683 // Untag the length for the loop. |
2684 __ srl(a1, a1, kSmiTagSize); | 2684 __ srl(a1, a1, kSmiTagSize); |
2685 | 2685 |
2686 // Copy the fixed array slots. | 2686 // Copy the fixed array slots. |
2687 Label loop; | 2687 Label loop; |
2688 // Set up t0 to point to the first array slot. | 2688 // Set up t0 to point to the first array slot. |
(...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5758 MemOperand(fp, 6 * kPointerSize), | 5758 MemOperand(fp, 6 * kPointerSize), |
5759 NULL); | 5759 NULL); |
5760 } | 5760 } |
5761 | 5761 |
5762 | 5762 |
5763 #undef __ | 5763 #undef __ |
5764 | 5764 |
5765 } } // namespace v8::internal | 5765 } } // namespace v8::internal |
5766 | 5766 |
5767 #endif // V8_TARGET_ARCH_MIPS | 5767 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |