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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Return and remove the on-stack parameter. | 148 // Return and remove the on-stack parameter. |
149 __ movq(rsi, rax); | 149 __ movq(rsi, rax); |
150 __ ret(1 * kPointerSize); | 150 __ ret(1 * kPointerSize); |
151 | 151 |
152 // Need to collect. Call into runtime system. | 152 // Need to collect. Call into runtime system. |
153 __ bind(&gc); | 153 __ bind(&gc); |
154 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1); | 154 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1); |
155 } | 155 } |
156 | 156 |
157 | 157 |
| 158 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
| 159 // Stack layout on entry: |
| 160 // |
| 161 // [rsp + (1 * kPointerSize)]: function |
| 162 // [rsp + (2 * kPointerSize)]: serialized scope info |
| 163 |
| 164 // Try to allocate the context in new space. |
| 165 Label gc; |
| 166 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 167 __ AllocateInNewSpace(FixedArray::SizeFor(length), |
| 168 rax, rbx, rcx, &gc, TAG_OBJECT); |
| 169 |
| 170 // Get the function from the stack. |
| 171 __ movq(rcx, Operand(rsp, 1 * kPointerSize)); |
| 172 |
| 173 // Get the serialized scope info from the stack. |
| 174 __ movq(rbx, Operand(rsp, 2 * kPointerSize)); |
| 175 |
| 176 // Setup the object header. |
| 177 __ LoadRoot(kScratchRegister, Heap::kBlockContextMapRootIndex); |
| 178 __ movq(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister); |
| 179 __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length)); |
| 180 |
| 181 // Setup the fixed slots. |
| 182 __ movq(ContextOperand(rax, Context::CLOSURE_INDEX), rcx); |
| 183 __ movq(ContextOperand(rax, Context::PREVIOUS_INDEX), rsi); |
| 184 __ movq(ContextOperand(rax, Context::EXTENSION_INDEX), rbx); |
| 185 |
| 186 // Copy the global object from the previous context. |
| 187 __ movq(rbx, ContextOperand(rsi, Context::GLOBAL_INDEX)); |
| 188 __ movq(ContextOperand(rax, Context::GLOBAL_INDEX), rbx); |
| 189 |
| 190 // Initialize the rest of the slots to the hole value. |
| 191 __ LoadRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 192 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { |
| 193 __ movq(ContextOperand(rax, i), rbx); |
| 194 } |
| 195 |
| 196 // Return and remove the on-stack parameter. |
| 197 __ movq(rsi, rax); |
| 198 __ ret(2 * kPointerSize); |
| 199 |
| 200 // Need to collect. Call into runtime system. |
| 201 __ bind(&gc); |
| 202 __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); |
| 203 } |
| 204 |
| 205 |
158 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { | 206 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
159 // Stack layout on entry: | 207 // Stack layout on entry: |
160 // | 208 // |
161 // [rsp + kPointerSize]: constant elements. | 209 // [rsp + kPointerSize]: constant elements. |
162 // [rsp + (2 * kPointerSize)]: literal index. | 210 // [rsp + (2 * kPointerSize)]: literal index. |
163 // [rsp + (3 * kPointerSize)]: literals array. | 211 // [rsp + (3 * kPointerSize)]: literals array. |
164 | 212 |
165 // All sizes here are multiples of kPointerSize. | 213 // All sizes here are multiples of kPointerSize. |
166 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; | 214 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; |
167 int size = JSArray::kSize + elements_size; | 215 int size = JSArray::kSize + elements_size; |
(...skipping 5671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5839 | 5887 |
5840 // Fall through when we need to inform the incremental marker. | 5888 // Fall through when we need to inform the incremental marker. |
5841 } | 5889 } |
5842 | 5890 |
5843 | 5891 |
5844 #undef __ | 5892 #undef __ |
5845 | 5893 |
5846 } } // namespace v8::internal | 5894 } } // namespace v8::internal |
5847 | 5895 |
5848 #endif // V8_TARGET_ARCH_X64 | 5896 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |