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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 bool need_write_barrier = true; | 172 bool need_write_barrier = true; |
173 // Argument to NewContext is the function, which is still in rdi. | 173 // Argument to NewContext is the function, which is still in rdi. |
174 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 174 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
175 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 175 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
176 if (info()->scope()->is_script_scope()) { | 176 if (info()->scope()->is_script_scope()) { |
177 __ Push(rdi); | 177 __ Push(rdi); |
178 __ Push(info()->scope()->scope_info()); | 178 __ Push(info()->scope()->scope_info()); |
179 __ CallRuntime(Runtime::kNewScriptContext); | 179 __ CallRuntime(Runtime::kNewScriptContext); |
180 deopt_mode = Safepoint::kLazyDeopt; | 180 deopt_mode = Safepoint::kLazyDeopt; |
181 } else { | 181 } else { |
182 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 182 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { |
183 FastNewFunctionContextStub stub(isolate()); | 183 FastNewFunctionContextStub stub(isolate(), |
| 184 info()->scope()->scope_type()); |
184 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); | 185 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
185 __ CallStub(&stub); | 186 __ CallStub(&stub); |
186 // Result of FastNewFunctionContextStub is always in new space. | 187 // Result of FastNewFunctionContextStub is always in new space. |
187 need_write_barrier = false; | 188 need_write_barrier = false; |
188 } else { | 189 } else { |
189 __ Push(rdi); | 190 __ Push(rdi); |
| 191 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
190 __ CallRuntime(Runtime::kNewFunctionContext); | 192 __ CallRuntime(Runtime::kNewFunctionContext); |
191 } | 193 } |
192 } | 194 } |
193 RecordSafepoint(deopt_mode); | 195 RecordSafepoint(deopt_mode); |
194 | 196 |
195 // Context is returned in rax. It replaces the context passed to us. | 197 // Context is returned in rax. It replaces the context passed to us. |
196 // It's saved in the stack and kept live in rsi. | 198 // It's saved in the stack and kept live in rsi. |
197 __ movp(rsi, rax); | 199 __ movp(rsi, rax); |
198 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 200 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
199 | 201 |
(...skipping 5229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5429 __ bind(deferred->exit()); | 5431 __ bind(deferred->exit()); |
5430 __ bind(&done); | 5432 __ bind(&done); |
5431 } | 5433 } |
5432 | 5434 |
5433 #undef __ | 5435 #undef __ |
5434 | 5436 |
5435 } // namespace internal | 5437 } // namespace internal |
5436 } // namespace v8 | 5438 } // namespace v8 |
5437 | 5439 |
5438 #endif // V8_TARGET_ARCH_X64 | 5440 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |