| 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 FastNewFunctionContextStub stub(isolate()); | 182 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
| 183 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); | 183 FastNewFunctionContextStub stub(isolate()); |
| 184 __ CallStub(&stub); | 184 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
| 185 // Result of FastNewFunctionContextStub is always in new space. | 185 __ CallStub(&stub); |
| 186 need_write_barrier = false; | 186 // Result of FastNewFunctionContextStub is always in new space. |
| 187 need_write_barrier = false; |
| 188 } else { |
| 189 __ Push(rdi); |
| 190 __ CallRuntime(Runtime::kNewFunctionContext); |
| 191 } |
| 187 } | 192 } |
| 188 RecordSafepoint(deopt_mode); | 193 RecordSafepoint(deopt_mode); |
| 189 | 194 |
| 190 // Context is returned in rax. It replaces the context passed to us. | 195 // Context is returned in rax. It replaces the context passed to us. |
| 191 // It's saved in the stack and kept live in rsi. | 196 // It's saved in the stack and kept live in rsi. |
| 192 __ movp(rsi, rax); | 197 __ movp(rsi, rax); |
| 193 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 198 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
| 194 | 199 |
| 195 // Copy any necessary parameters into the context. | 200 // Copy any necessary parameters into the context. |
| 196 int num_parameters = info()->scope()->num_parameters(); | 201 int num_parameters = info()->scope()->num_parameters(); |
| (...skipping 5247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5444 __ bind(deferred->exit()); | 5449 __ bind(deferred->exit()); |
| 5445 __ bind(&done); | 5450 __ bind(&done); |
| 5446 } | 5451 } |
| 5447 | 5452 |
| 5448 #undef __ | 5453 #undef __ |
| 5449 | 5454 |
| 5450 } // namespace internal | 5455 } // namespace internal |
| 5451 } // namespace v8 | 5456 } // namespace v8 |
| 5452 | 5457 |
| 5453 #endif // V8_TARGET_ARCH_X64 | 5458 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |