OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 Comment(";;; Allocate local context"); | 174 Comment(";;; Allocate local context"); |
175 bool need_write_barrier = true; | 175 bool need_write_barrier = true; |
176 // Argument to NewContext is the function, which is still in rdi. | 176 // Argument to NewContext is the function, which is still in rdi. |
177 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 177 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
178 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 178 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
179 if (info()->scope()->is_script_scope()) { | 179 if (info()->scope()->is_script_scope()) { |
180 __ Push(rdi); | 180 __ Push(rdi); |
181 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); | 181 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
182 __ CallRuntime(Runtime::kNewScriptContext); | 182 __ CallRuntime(Runtime::kNewScriptContext); |
183 deopt_mode = Safepoint::kLazyDeopt; | 183 deopt_mode = Safepoint::kLazyDeopt; |
184 } else if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 184 } else { |
185 FastNewFunctionContextStub stub(isolate(), slots); | 185 FastNewFunctionContextStub stub(isolate()); |
| 186 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
186 __ CallStub(&stub); | 187 __ CallStub(&stub); |
187 // Result of FastNewFunctionContextStub is always in new space. | 188 // Result of FastNewFunctionContextStub is always in new space. |
188 need_write_barrier = false; | 189 need_write_barrier = false; |
189 } else { | |
190 __ Push(rdi); | |
191 __ CallRuntime(Runtime::kNewFunctionContext); | |
192 } | 190 } |
193 RecordSafepoint(deopt_mode); | 191 RecordSafepoint(deopt_mode); |
194 | 192 |
195 // Context is returned in rax. It replaces the context passed to us. | 193 // Context is returned in rax. It replaces the context passed to us. |
196 // It's saved in the stack and kept live in rsi. | 194 // It's saved in the stack and kept live in rsi. |
197 __ movp(rsi, rax); | 195 __ movp(rsi, rax); |
198 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 196 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
199 | 197 |
200 // Copy any necessary parameters into the context. | 198 // Copy any necessary parameters into the context. |
201 int num_parameters = scope()->num_parameters(); | 199 int num_parameters = scope()->num_parameters(); |
(...skipping 5366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5568 __ bind(deferred->exit()); | 5566 __ bind(deferred->exit()); |
5569 __ bind(&done); | 5567 __ bind(&done); |
5570 } | 5568 } |
5571 | 5569 |
5572 #undef __ | 5570 #undef __ |
5573 | 5571 |
5574 } // namespace internal | 5572 } // namespace internal |
5575 } // namespace v8 | 5573 } // namespace v8 |
5576 | 5574 |
5577 #endif // V8_TARGET_ARCH_X64 | 5575 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |