OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 Comment(";;; Allocate local context"); | 155 Comment(";;; Allocate local context"); |
156 bool need_write_barrier = true; | 156 bool need_write_barrier = true; |
157 // Argument to NewContext is the function, which is in r3. | 157 // Argument to NewContext is the function, which is in r3. |
158 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 158 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
159 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 159 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
160 if (info()->scope()->is_script_scope()) { | 160 if (info()->scope()->is_script_scope()) { |
161 __ push(r3); | 161 __ push(r3); |
162 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); | 162 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
163 __ CallRuntime(Runtime::kNewScriptContext); | 163 __ CallRuntime(Runtime::kNewScriptContext); |
164 deopt_mode = Safepoint::kLazyDeopt; | 164 deopt_mode = Safepoint::kLazyDeopt; |
165 } else if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 165 } else { |
166 FastNewFunctionContextStub stub(isolate(), slots); | 166 FastNewFunctionContextStub stub(isolate()); |
| 167 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); |
167 __ CallStub(&stub); | 168 __ CallStub(&stub); |
168 // Result of FastNewFunctionContextStub is always in new space. | 169 // Result of FastNewFunctionContextStub is always in new space. |
169 need_write_barrier = false; | 170 need_write_barrier = false; |
170 } else { | |
171 __ push(r3); | |
172 __ CallRuntime(Runtime::kNewFunctionContext); | |
173 } | 171 } |
174 RecordSafepoint(deopt_mode); | 172 RecordSafepoint(deopt_mode); |
175 | 173 |
176 // Context is returned in both r2 and cp. It replaces the context | 174 // Context is returned in both r2 and cp. It replaces the context |
177 // passed to us. It's saved in the stack and kept live in cp. | 175 // passed to us. It's saved in the stack and kept live in cp. |
178 __ LoadRR(cp, r2); | 176 __ LoadRR(cp, r2); |
179 __ StoreP(r2, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 177 __ StoreP(r2, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
180 // Copy any necessary parameters into the context. | 178 // Copy any necessary parameters into the context. |
181 int num_parameters = scope()->num_parameters(); | 179 int num_parameters = scope()->num_parameters(); |
182 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 180 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
(...skipping 5163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5346 | 5344 |
5347 void LCodeGen::DoTypeof(LTypeof* instr) { | 5345 void LCodeGen::DoTypeof(LTypeof* instr) { |
5348 DCHECK(ToRegister(instr->value()).is(r5)); | 5346 DCHECK(ToRegister(instr->value()).is(r5)); |
5349 DCHECK(ToRegister(instr->result()).is(r2)); | 5347 DCHECK(ToRegister(instr->result()).is(r2)); |
5350 Label end, do_call; | 5348 Label end, do_call; |
5351 Register value_register = ToRegister(instr->value()); | 5349 Register value_register = ToRegister(instr->value()); |
5352 __ JumpIfNotSmi(value_register, &do_call); | 5350 __ JumpIfNotSmi(value_register, &do_call); |
5353 __ mov(r2, Operand(isolate()->factory()->number_string())); | 5351 __ mov(r2, Operand(isolate()->factory()->number_string())); |
5354 __ b(&end); | 5352 __ b(&end); |
5355 __ bind(&do_call); | 5353 __ bind(&do_call); |
5356 Callable callable = CodeFactory::Typeof(isolate()); | 5354 TypeofStub stub(isolate()); |
5357 CallCode(callable.code(), RelocInfo::CODE_TARGET, instr); | 5355 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
5358 __ bind(&end); | 5356 __ bind(&end); |
5359 } | 5357 } |
5360 | 5358 |
5361 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 5359 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
5362 Register input = ToRegister(instr->value()); | 5360 Register input = ToRegister(instr->value()); |
5363 | 5361 |
5364 Condition final_branch_condition = | 5362 Condition final_branch_condition = |
5365 EmitTypeofIs(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), input, | 5363 EmitTypeofIs(instr->TrueLabel(chunk_), instr->FalseLabel(chunk_), input, |
5366 instr->type_literal()); | 5364 instr->type_literal()); |
5367 if (final_branch_condition != kNoCondition) { | 5365 if (final_branch_condition != kNoCondition) { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5670 __ LoadP(result, | 5668 __ LoadP(result, |
5671 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5669 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5672 __ bind(deferred->exit()); | 5670 __ bind(deferred->exit()); |
5673 __ bind(&done); | 5671 __ bind(&done); |
5674 } | 5672 } |
5675 | 5673 |
5676 #undef __ | 5674 #undef __ |
5677 | 5675 |
5678 } // namespace internal | 5676 } // namespace internal |
5679 } // namespace v8 | 5677 } // namespace v8 |
OLD | NEW |