OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (info()->saves_caller_doubles()) { | 211 if (info()->saves_caller_doubles()) { |
212 SaveCallerDoubles(); | 212 SaveCallerDoubles(); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 // Possibly allocate a local context. | 216 // Possibly allocate a local context. |
217 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 217 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
218 if (heap_slots > 0) { | 218 if (heap_slots > 0) { |
219 Comment(";;; Allocate local context"); | 219 Comment(";;; Allocate local context"); |
220 // Argument to NewContext is the function, which is still in rdi. | 220 // Argument to NewContext is the function, which is still in rdi. |
221 __ push(rdi); | |
222 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 221 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
223 FastNewContextStub stub(heap_slots); | 222 FastNewContextStub stub(heap_slots); |
224 __ CallStub(&stub); | 223 __ CallStub(&stub); |
225 } else { | 224 } else { |
| 225 __ push(rdi); |
226 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 226 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
227 } | 227 } |
228 RecordSafepoint(Safepoint::kNoLazyDeopt); | 228 RecordSafepoint(Safepoint::kNoLazyDeopt); |
229 // Context is returned in both rax and rsi. It replaces the context | 229 // Context is returned in rax. It replaces the context passed to us. |
230 // passed to us. It's saved in the stack and kept live in rsi. | 230 // It's saved in the stack and kept live in rsi. |
231 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); | 231 __ movp(rsi, rax); |
| 232 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
232 | 233 |
233 // Copy any necessary parameters into the context. | 234 // Copy any necessary parameters into the context. |
234 int num_parameters = scope()->num_parameters(); | 235 int num_parameters = scope()->num_parameters(); |
235 for (int i = 0; i < num_parameters; i++) { | 236 for (int i = 0; i < num_parameters; i++) { |
236 Variable* var = scope()->parameter(i); | 237 Variable* var = scope()->parameter(i); |
237 if (var->IsContextSlot()) { | 238 if (var->IsContextSlot()) { |
238 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 239 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
239 (num_parameters - 1 - i) * kPointerSize; | 240 (num_parameters - 1 - i) * kPointerSize; |
240 // Load parameter from stack. | 241 // Load parameter from stack. |
241 __ movp(rax, Operand(rbp, parameter_offset)); | 242 __ movp(rax, Operand(rbp, parameter_offset)); |
(...skipping 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5629 FixedArray::kHeaderSize - kPointerSize)); | 5630 FixedArray::kHeaderSize - kPointerSize)); |
5630 __ bind(&done); | 5631 __ bind(&done); |
5631 } | 5632 } |
5632 | 5633 |
5633 | 5634 |
5634 #undef __ | 5635 #undef __ |
5635 | 5636 |
5636 } } // namespace v8::internal | 5637 } } // namespace v8::internal |
5637 | 5638 |
5638 #endif // V8_TARGET_ARCH_X64 | 5639 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |