| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 __ bind(&gc); | 105 __ bind(&gc); |
| 106 __ LoadRoot(r4, Heap::kFalseValueRootIndex); | 106 __ LoadRoot(r4, Heap::kFalseValueRootIndex); |
| 107 __ Push(cp, r3, r4); | 107 __ Push(cp, r3, r4); |
| 108 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); | 108 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 void FastNewContextStub::Generate(MacroAssembler* masm) { | 112 void FastNewContextStub::Generate(MacroAssembler* masm) { |
| 113 // Try to allocate the context in new space. | 113 // Try to allocate the context in new space. |
| 114 Label gc; | 114 Label gc; |
| 115 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | |
| 116 | 115 |
| 117 // Attempt to allocate the context in new space. | 116 // Attempt to allocate the context in new space. |
| 118 __ AllocateInNewSpace(FixedArray::SizeFor(length), | 117 __ AllocateInNewSpace(FixedArray::SizeFor(slots_), |
| 119 r0, | 118 r0, |
| 120 r1, | 119 r1, |
| 121 r2, | 120 r2, |
| 122 &gc, | 121 &gc, |
| 123 TAG_OBJECT); | 122 TAG_OBJECT); |
| 124 | 123 |
| 125 // Load the function from the stack. | 124 // Load the function from the stack. |
| 126 __ ldr(r3, MemOperand(sp, 0)); | 125 __ ldr(r3, MemOperand(sp, 0)); |
| 127 | 126 |
| 128 // Setup the object header. | 127 // Setup the object header. |
| 129 __ LoadRoot(r2, Heap::kContextMapRootIndex); | 128 __ LoadRoot(r2, Heap::kContextMapRootIndex); |
| 130 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 129 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 131 __ mov(r2, Operand(Smi::FromInt(length))); | 130 __ mov(r2, Operand(Smi::FromInt(slots_))); |
| 132 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 131 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
| 133 | 132 |
| 134 // Setup the fixed slots. | 133 // Setup the fixed slots. |
| 135 __ mov(r1, Operand(Smi::FromInt(0))); | 134 __ mov(r1, Operand(Smi::FromInt(0))); |
| 136 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); | 135 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); |
| 137 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 136 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
| 138 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 137 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
| 139 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); | 138 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); |
| 140 | 139 |
| 141 // Copy the global object from the surrounding context. | 140 // Copy the global object from the surrounding context. |
| 142 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 141 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 143 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX))); | 142 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 144 | 143 |
| 145 // Initialize the rest of the slots to undefined. | 144 // Initialize the rest of the slots to undefined. |
| 146 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 145 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| 147 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { | 146 for (int i = Context::MIN_CONTEXT_SLOTS; i < slots_; i++) { |
| 148 __ str(r1, MemOperand(r0, Context::SlotOffset(i))); | 147 __ str(r1, MemOperand(r0, Context::SlotOffset(i))); |
| 149 } | 148 } |
| 150 | 149 |
| 151 // Remove the on-stack argument and return. | 150 // Remove the on-stack argument and return. |
| 152 __ mov(cp, r0); | 151 __ mov(cp, r0); |
| 153 __ pop(); | 152 __ pop(); |
| 154 __ Ret(); | 153 __ Ret(); |
| 155 | 154 |
| 156 // Need to collect. Call into runtime system. | 155 // Need to collect. Call into runtime system. |
| 157 __ bind(&gc); | 156 __ bind(&gc); |
| (...skipping 4949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5107 __ pop(r1); | 5106 __ pop(r1); |
| 5108 __ Jump(r2); | 5107 __ Jump(r2); |
| 5109 } | 5108 } |
| 5110 | 5109 |
| 5111 | 5110 |
| 5112 #undef __ | 5111 #undef __ |
| 5113 | 5112 |
| 5114 } } // namespace v8::internal | 5113 } } // namespace v8::internal |
| 5115 | 5114 |
| 5116 #endif // V8_TARGET_ARCH_ARM | 5115 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |