OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/builtins/builtins-constructor.h" |
8 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 11 #include "src/crankshaft/hydrogen-osr.h" |
11 #include "src/crankshaft/ppc/lithium-gap-resolver-ppc.h" | 12 #include "src/crankshaft/ppc/lithium-gap-resolver-ppc.h" |
12 #include "src/ic/ic.h" | 13 #include "src/ic/ic.h" |
13 #include "src/ic/stub-cache.h" | 14 #include "src/ic/stub-cache.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 bool need_write_barrier = true; | 180 bool need_write_barrier = true; |
180 // Argument to NewContext is the function, which is in r4. | 181 // Argument to NewContext is the function, which is in r4. |
181 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 182 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
182 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 183 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
183 if (info()->scope()->is_script_scope()) { | 184 if (info()->scope()->is_script_scope()) { |
184 __ push(r4); | 185 __ push(r4); |
185 __ Push(info()->scope()->scope_info()); | 186 __ Push(info()->scope()->scope_info()); |
186 __ CallRuntime(Runtime::kNewScriptContext); | 187 __ CallRuntime(Runtime::kNewScriptContext); |
187 deopt_mode = Safepoint::kLazyDeopt; | 188 deopt_mode = Safepoint::kLazyDeopt; |
188 } else { | 189 } else { |
189 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { | 190 if (slots <= |
190 FastNewFunctionContextStub stub(isolate(), | 191 ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { |
191 info()->scope()->scope_type()); | 192 Callable callable = CodeFactory::FastNewFunctionContext( |
| 193 isolate(), info()->scope()->scope_type()); |
192 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), | 194 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
193 Operand(slots)); | 195 Operand(slots)); |
194 __ CallStub(&stub); | 196 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
195 // Result of FastNewFunctionContextStub is always in new space. | 197 // Result of the FastNewFunctionContext builtin is always in new space. |
196 need_write_barrier = false; | 198 need_write_barrier = false; |
197 } else { | 199 } else { |
198 __ push(r4); | 200 __ push(r4); |
199 __ Push(Smi::FromInt(info()->scope()->scope_type())); | 201 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
200 __ CallRuntime(Runtime::kNewFunctionContext); | 202 __ CallRuntime(Runtime::kNewFunctionContext); |
201 } | 203 } |
202 } | 204 } |
203 RecordSafepoint(deopt_mode); | 205 RecordSafepoint(deopt_mode); |
204 | 206 |
205 // Context is returned in both r3 and cp. It replaces the context | 207 // Context is returned in both r3 and cp. It replaces the context |
(...skipping 5448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5654 __ LoadP(result, | 5656 __ LoadP(result, |
5655 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5657 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5656 __ bind(deferred->exit()); | 5658 __ bind(deferred->exit()); |
5657 __ bind(&done); | 5659 __ bind(&done); |
5658 } | 5660 } |
5659 | 5661 |
5660 #undef __ | 5662 #undef __ |
5661 | 5663 |
5662 } // namespace internal | 5664 } // namespace internal |
5663 } // namespace v8 | 5665 } // namespace v8 |
OLD | NEW |