| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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; |
| 115 | 116 |
| 116 // Attempt to allocate the context in new space. | 117 // Attempt to allocate the context in new space. |
| 117 __ AllocateInNewSpace(FixedArray::SizeFor(slots_), | 118 __ AllocateInNewSpace(FixedArray::SizeFor(length), |
| 118 r0, | 119 r0, |
| 119 r1, | 120 r1, |
| 120 r2, | 121 r2, |
| 121 &gc, | 122 &gc, |
| 122 TAG_OBJECT); | 123 TAG_OBJECT); |
| 123 | 124 |
| 124 // Load the function from the stack. | 125 // Load the function from the stack. |
| 125 __ ldr(r3, MemOperand(sp, 0)); | 126 __ ldr(r3, MemOperand(sp, 0)); |
| 126 | 127 |
| 127 // Setup the object header. | 128 // Setup the object header. |
| 128 __ LoadRoot(r2, Heap::kContextMapRootIndex); | 129 __ LoadRoot(r2, Heap::kContextMapRootIndex); |
| 129 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | 130 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 130 __ mov(r2, Operand(Smi::FromInt(slots_))); | 131 __ mov(r2, Operand(Smi::FromInt(length))); |
| 131 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 132 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
| 132 | 133 |
| 133 // Setup the fixed slots. | 134 // Setup the fixed slots. |
| 134 __ mov(r1, Operand(Smi::FromInt(0))); | 135 __ mov(r1, Operand(Smi::FromInt(0))); |
| 135 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); | 136 __ str(r3, MemOperand(r0, Context::SlotOffset(Context::CLOSURE_INDEX))); |
| 136 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 137 __ str(r0, MemOperand(r0, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
| 137 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); | 138 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::PREVIOUS_INDEX))); |
| 138 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); | 139 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::EXTENSION_INDEX))); |
| 139 | 140 |
| 140 // Copy the global object from the surrounding context. | 141 // Copy the global object from the surrounding context. |
| 141 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 142 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 142 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX))); | 143 __ str(r1, MemOperand(r0, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 143 | 144 |
| 144 // Initialize the rest of the slots to undefined. | 145 // Initialize the rest of the slots to undefined. |
| 145 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 146 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| 146 for (int i = Context::MIN_CONTEXT_SLOTS; i < slots_; i++) { | 147 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { |
| 147 __ str(r1, MemOperand(r0, Context::SlotOffset(i))); | 148 __ str(r1, MemOperand(r0, Context::SlotOffset(i))); |
| 148 } | 149 } |
| 149 | 150 |
| 150 // Remove the on-stack argument and return. | 151 // Remove the on-stack argument and return. |
| 151 __ mov(cp, r0); | 152 __ mov(cp, r0); |
| 152 __ pop(); | 153 __ pop(); |
| 153 __ Ret(); | 154 __ Ret(); |
| 154 | 155 |
| 155 // Need to collect. Call into runtime system. | 156 // Need to collect. Call into runtime system. |
| 156 __ bind(&gc); | 157 __ bind(&gc); |
| (...skipping 4929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5086 __ pop(r1); | 5087 __ pop(r1); |
| 5087 __ Jump(r2); | 5088 __ Jump(r2); |
| 5088 } | 5089 } |
| 5089 | 5090 |
| 5090 | 5091 |
| 5091 #undef __ | 5092 #undef __ |
| 5092 | 5093 |
| 5093 } } // namespace v8::internal | 5094 } } // namespace v8::internal |
| 5094 | 5095 |
| 5095 #endif // V8_TARGET_ARCH_ARM | 5096 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |