| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
| 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 bool need_write_barrier = true; | 152 bool need_write_barrier = true; |
| 153 // Argument to NewContext is the function, which is in a1. | 153 // Argument to NewContext is the function, which is in a1. |
| 154 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 154 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 155 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 155 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
| 156 if (info()->scope()->is_script_scope()) { | 156 if (info()->scope()->is_script_scope()) { |
| 157 __ push(a1); | 157 __ push(a1); |
| 158 __ Push(info()->scope()->scope_info()); | 158 __ Push(info()->scope()->scope_info()); |
| 159 __ CallRuntime(Runtime::kNewScriptContext); | 159 __ CallRuntime(Runtime::kNewScriptContext); |
| 160 deopt_mode = Safepoint::kLazyDeopt; | 160 deopt_mode = Safepoint::kLazyDeopt; |
| 161 } else { | 161 } else { |
| 162 FastNewFunctionContextStub stub(isolate()); | 162 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
| 163 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); | 163 FastNewFunctionContextStub stub(isolate()); |
| 164 __ CallStub(&stub); | 164 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), |
| 165 // Result of FastNewFunctionContextStub is always in new space. | 165 Operand(slots)); |
| 166 need_write_barrier = false; | 166 __ CallStub(&stub); |
| 167 // Result of FastNewFunctionContextStub is always in new space. |
| 168 need_write_barrier = false; |
| 169 } else { |
| 170 __ push(a1); |
| 171 __ CallRuntime(Runtime::kNewFunctionContext); |
| 172 } |
| 167 } | 173 } |
| 168 RecordSafepoint(deopt_mode); | 174 RecordSafepoint(deopt_mode); |
| 169 | 175 |
| 170 // Context is returned in both v0. It replaces the context passed to us. | 176 // Context is returned in both v0. It replaces the context passed to us. |
| 171 // It's saved in the stack and kept live in cp. | 177 // It's saved in the stack and kept live in cp. |
| 172 __ mov(cp, v0); | 178 __ mov(cp, v0); |
| 173 __ sd(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 179 __ sd(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 174 // Copy any necessary parameters into the context. | 180 // Copy any necessary parameters into the context. |
| 175 int num_parameters = info()->scope()->num_parameters(); | 181 int num_parameters = info()->scope()->num_parameters(); |
| 176 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; | 182 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; |
| (...skipping 5444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5621 __ ld(result, FieldMemOperand(scratch, | 5627 __ ld(result, FieldMemOperand(scratch, |
| 5622 FixedArray::kHeaderSize - kPointerSize)); | 5628 FixedArray::kHeaderSize - kPointerSize)); |
| 5623 __ bind(deferred->exit()); | 5629 __ bind(deferred->exit()); |
| 5624 __ bind(&done); | 5630 __ bind(&done); |
| 5625 } | 5631 } |
| 5626 | 5632 |
| 5627 #undef __ | 5633 #undef __ |
| 5628 | 5634 |
| 5629 } // namespace internal | 5635 } // namespace internal |
| 5630 } // namespace v8 | 5636 } // namespace v8 |
| OLD | NEW |