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/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 11 #include "src/code-factory.h" |
11 #include "src/code-stubs.h" | 12 #include "src/code-stubs.h" |
12 #include "src/crankshaft/hydrogen-osr.h" | 13 #include "src/crankshaft/hydrogen-osr.h" |
13 #include "src/ic/ic.h" | 14 #include "src/ic/ic.h" |
14 #include "src/ic/stub-cache.h" | 15 #include "src/ic/stub-cache.h" |
15 | 16 |
16 namespace v8 { | 17 namespace v8 { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 | 20 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 bool need_write_barrier = true; | 173 bool need_write_barrier = true; |
173 // Argument to NewContext is the function, which is still in rdi. | 174 // Argument to NewContext is the function, which is still in rdi. |
174 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 175 int slots = info_->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
175 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 176 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
176 if (info()->scope()->is_script_scope()) { | 177 if (info()->scope()->is_script_scope()) { |
177 __ Push(rdi); | 178 __ Push(rdi); |
178 __ Push(info()->scope()->scope_info()); | 179 __ Push(info()->scope()->scope_info()); |
179 __ CallRuntime(Runtime::kNewScriptContext); | 180 __ CallRuntime(Runtime::kNewScriptContext); |
180 deopt_mode = Safepoint::kLazyDeopt; | 181 deopt_mode = Safepoint::kLazyDeopt; |
181 } else { | 182 } else { |
182 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { | 183 if (slots <= |
183 FastNewFunctionContextStub stub(isolate(), | 184 ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { |
184 info()->scope()->scope_type()); | 185 Callable callable = CodeFactory::FastNewFunctionContext( |
| 186 isolate(), info()->scope()->scope_type()); |
185 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); | 187 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
186 __ CallStub(&stub); | 188 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
187 // Result of FastNewFunctionContextStub is always in new space. | 189 // Result of FastNewFunctionContextStub is always in new space. |
188 need_write_barrier = false; | 190 need_write_barrier = false; |
189 } else { | 191 } else { |
190 __ Push(rdi); | 192 __ Push(rdi); |
191 __ Push(Smi::FromInt(info()->scope()->scope_type())); | 193 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
192 __ CallRuntime(Runtime::kNewFunctionContext); | 194 __ CallRuntime(Runtime::kNewFunctionContext); |
193 } | 195 } |
194 } | 196 } |
195 RecordSafepoint(deopt_mode); | 197 RecordSafepoint(deopt_mode); |
196 | 198 |
(...skipping 5234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5431 __ bind(deferred->exit()); | 5433 __ bind(deferred->exit()); |
5432 __ bind(&done); | 5434 __ bind(&done); |
5433 } | 5435 } |
5434 | 5436 |
5435 #undef __ | 5437 #undef __ |
5436 | 5438 |
5437 } // namespace internal | 5439 } // namespace internal |
5438 } // namespace v8 | 5440 } // namespace v8 |
5439 | 5441 |
5440 #endif // V8_TARGET_ARCH_X64 | 5442 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |