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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 Comment(";;; Allocate local context"); | 165 Comment(";;; Allocate local context"); |
166 bool need_write_barrier = true; | 166 bool need_write_barrier = true; |
167 // Argument to NewContext is the function, which is in r4. | 167 // Argument to NewContext is the function, which is in r4. |
168 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 168 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
169 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 169 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
170 if (info()->scope()->is_script_scope()) { | 170 if (info()->scope()->is_script_scope()) { |
171 __ push(r4); | 171 __ push(r4); |
172 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); | 172 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
173 __ CallRuntime(Runtime::kNewScriptContext); | 173 __ CallRuntime(Runtime::kNewScriptContext); |
174 deopt_mode = Safepoint::kLazyDeopt; | 174 deopt_mode = Safepoint::kLazyDeopt; |
175 } else if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 175 } else { |
176 FastNewFunctionContextStub stub(isolate(), slots); | 176 FastNewFunctionContextStub stub(isolate()); |
| 177 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); |
177 __ CallStub(&stub); | 178 __ CallStub(&stub); |
178 // Result of FastNewFunctionContextStub is always in new space. | 179 // Result of FastNewFunctionContextStub is always in new space. |
179 need_write_barrier = false; | 180 need_write_barrier = false; |
180 } else { | |
181 __ push(r4); | |
182 __ CallRuntime(Runtime::kNewFunctionContext); | |
183 } | 181 } |
184 RecordSafepoint(deopt_mode); | 182 RecordSafepoint(deopt_mode); |
185 | 183 |
186 // Context is returned in both r3 and cp. It replaces the context | 184 // Context is returned in both r3 and cp. It replaces the context |
187 // passed to us. It's saved in the stack and kept live in cp. | 185 // passed to us. It's saved in the stack and kept live in cp. |
188 __ mr(cp, r3); | 186 __ mr(cp, r3); |
189 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 187 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
190 // Copy any necessary parameters into the context. | 188 // Copy any necessary parameters into the context. |
191 int num_parameters = scope()->num_parameters(); | 189 int num_parameters = scope()->num_parameters(); |
192 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 190 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
(...skipping 5247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5440 | 5438 |
5441 void LCodeGen::DoTypeof(LTypeof* instr) { | 5439 void LCodeGen::DoTypeof(LTypeof* instr) { |
5442 DCHECK(ToRegister(instr->value()).is(r6)); | 5440 DCHECK(ToRegister(instr->value()).is(r6)); |
5443 DCHECK(ToRegister(instr->result()).is(r3)); | 5441 DCHECK(ToRegister(instr->result()).is(r3)); |
5444 Label end, do_call; | 5442 Label end, do_call; |
5445 Register value_register = ToRegister(instr->value()); | 5443 Register value_register = ToRegister(instr->value()); |
5446 __ JumpIfNotSmi(value_register, &do_call); | 5444 __ JumpIfNotSmi(value_register, &do_call); |
5447 __ mov(r3, Operand(isolate()->factory()->number_string())); | 5445 __ mov(r3, Operand(isolate()->factory()->number_string())); |
5448 __ b(&end); | 5446 __ b(&end); |
5449 __ bind(&do_call); | 5447 __ bind(&do_call); |
5450 Callable callable = CodeFactory::Typeof(isolate()); | 5448 TypeofStub stub(isolate()); |
5451 CallCode(callable.code(), RelocInfo::CODE_TARGET, instr); | 5449 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
5452 __ bind(&end); | 5450 __ bind(&end); |
5453 } | 5451 } |
5454 | 5452 |
5455 | 5453 |
5456 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 5454 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
5457 Register input = ToRegister(instr->value()); | 5455 Register input = ToRegister(instr->value()); |
5458 | 5456 |
5459 Condition final_branch_condition = | 5457 Condition final_branch_condition = |
5460 EmitTypeofIs(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), input, | 5458 EmitTypeofIs(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), input, |
5461 instr->type_literal()); | 5459 instr->type_literal()); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5781 __ LoadP(result, | 5779 __ LoadP(result, |
5782 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5780 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5783 __ bind(deferred->exit()); | 5781 __ bind(deferred->exit()); |
5784 __ bind(&done); | 5782 __ bind(&done); |
5785 } | 5783 } |
5786 | 5784 |
5787 #undef __ | 5785 #undef __ |
5788 | 5786 |
5789 } // namespace internal | 5787 } // namespace internal |
5790 } // namespace v8 | 5788 } // namespace v8 |
OLD | NEW |