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/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 bool need_write_barrier = true; | 163 bool need_write_barrier = true; |
164 // Argument to NewContext is the function, which is in r4. | 164 // Argument to NewContext is the function, which is in r4. |
165 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 165 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
166 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 166 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
167 if (info()->scope()->is_script_scope()) { | 167 if (info()->scope()->is_script_scope()) { |
168 __ push(r4); | 168 __ push(r4); |
169 __ Push(info()->scope()->scope_info()); | 169 __ Push(info()->scope()->scope_info()); |
170 __ CallRuntime(Runtime::kNewScriptContext); | 170 __ CallRuntime(Runtime::kNewScriptContext); |
171 deopt_mode = Safepoint::kLazyDeopt; | 171 deopt_mode = Safepoint::kLazyDeopt; |
172 } else { | 172 } else { |
173 FastNewFunctionContextStub stub(isolate()); | 173 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
174 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); | 174 FastNewFunctionContextStub stub(isolate()); |
175 __ CallStub(&stub); | 175 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
176 // Result of FastNewFunctionContextStub is always in new space. | 176 Operand(slots)); |
177 need_write_barrier = false; | 177 __ CallStub(&stub); |
| 178 // Result of FastNewFunctionContextStub is always in new space. |
| 179 need_write_barrier = false; |
| 180 } else { |
| 181 __ push(r4); |
| 182 __ CallRuntime(Runtime::kNewFunctionContext); |
| 183 } |
178 } | 184 } |
179 RecordSafepoint(deopt_mode); | 185 RecordSafepoint(deopt_mode); |
180 | 186 |
181 // Context is returned in both r3 and cp. It replaces the context | 187 // Context is returned in both r3 and cp. It replaces the context |
182 // passed to us. It's saved in the stack and kept live in cp. | 188 // passed to us. It's saved in the stack and kept live in cp. |
183 __ mr(cp, r3); | 189 __ mr(cp, r3); |
184 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 190 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
185 // Copy any necessary parameters into the context. | 191 // Copy any necessary parameters into the context. |
186 int num_parameters = info()->scope()->num_parameters(); | 192 int num_parameters = info()->scope()->num_parameters(); |
187 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; | 193 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; |
(...skipping 5467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5655 __ LoadP(result, | 5661 __ LoadP(result, |
5656 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5662 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5657 __ bind(deferred->exit()); | 5663 __ bind(deferred->exit()); |
5658 __ bind(&done); | 5664 __ bind(&done); |
5659 } | 5665 } |
5660 | 5666 |
5661 #undef __ | 5667 #undef __ |
5662 | 5668 |
5663 } // namespace internal | 5669 } // namespace internal |
5664 } // namespace v8 | 5670 } // namespace v8 |
OLD | NEW |