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 5575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5586 } | 5586 } |
5587 | 5587 |
5588 | 5588 |
5589 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5589 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
5590 DCHECK(ToRegister(instr->value()).is(r3)); | 5590 DCHECK(ToRegister(instr->value()).is(r3)); |
5591 __ push(r3); | 5591 __ push(r3); |
5592 CallRuntime(Runtime::kToFastProperties, 1, instr); | 5592 CallRuntime(Runtime::kToFastProperties, 1, instr); |
5593 } | 5593 } |
5594 | 5594 |
5595 | 5595 |
5596 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | |
5597 DCHECK(ToRegister(instr->context()).is(cp)); | |
5598 Label materialized; | |
5599 // Registers will be used as follows: | |
5600 // r10 = literals array. | |
5601 // r4 = regexp literal. | |
5602 // r3 = regexp literal clone. | |
5603 // r5 and r7-r9 are used as temporaries. | |
5604 int literal_offset = | |
5605 LiteralsArray::OffsetOfLiteralAt(instr->hydrogen()->literal_index()); | |
5606 __ Move(r10, instr->hydrogen()->literals()); | |
5607 __ LoadP(r4, FieldMemOperand(r10, literal_offset)); | |
5608 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | |
5609 __ cmp(r4, ip); | |
5610 __ bne(&materialized); | |
5611 | |
5612 // Create regexp literal using runtime function | |
5613 // Result will be in r3. | |
5614 __ LoadSmiLiteral(r9, Smi::FromInt(instr->hydrogen()->literal_index())); | |
5615 __ mov(r8, Operand(instr->hydrogen()->pattern())); | |
5616 __ mov(r7, Operand(instr->hydrogen()->flags())); | |
5617 __ Push(r10, r9, r8, r7); | |
5618 CallRuntime(Runtime::kMaterializeRegExpLiteral, 4, instr); | |
5619 __ mr(r4, r3); | |
5620 | |
5621 __ bind(&materialized); | |
5622 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; | |
5623 Label allocated, runtime_allocate; | |
5624 | |
5625 __ Allocate(size, r3, r5, r6, &runtime_allocate, TAG_OBJECT); | |
5626 __ b(&allocated); | |
5627 | |
5628 __ bind(&runtime_allocate); | |
5629 __ LoadSmiLiteral(r3, Smi::FromInt(size)); | |
5630 __ Push(r4, r3); | |
5631 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | |
5632 __ pop(r4); | |
5633 | |
5634 __ bind(&allocated); | |
5635 // Copy the content into the newly allocated memory. | |
5636 __ CopyFields(r3, r4, r5.bit(), size / kPointerSize); | |
5637 } | |
5638 | |
5639 | |
5640 void LCodeGen::DoTypeof(LTypeof* instr) { | 5596 void LCodeGen::DoTypeof(LTypeof* instr) { |
5641 DCHECK(ToRegister(instr->value()).is(r6)); | 5597 DCHECK(ToRegister(instr->value()).is(r6)); |
5642 DCHECK(ToRegister(instr->result()).is(r3)); | 5598 DCHECK(ToRegister(instr->result()).is(r3)); |
5643 Label end, do_call; | 5599 Label end, do_call; |
5644 Register value_register = ToRegister(instr->value()); | 5600 Register value_register = ToRegister(instr->value()); |
5645 __ JumpIfNotSmi(value_register, &do_call); | 5601 __ JumpIfNotSmi(value_register, &do_call); |
5646 __ mov(r3, Operand(isolate()->factory()->number_string())); | 5602 __ mov(r3, Operand(isolate()->factory()->number_string())); |
5647 __ b(&end); | 5603 __ b(&end); |
5648 __ bind(&do_call); | 5604 __ bind(&do_call); |
5649 TypeofStub stub(isolate()); | 5605 TypeofStub stub(isolate()); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6036 __ Push(scope_info); | 5992 __ Push(scope_info); |
6037 __ push(ToRegister(instr->function())); | 5993 __ push(ToRegister(instr->function())); |
6038 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5994 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6039 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5995 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6040 } | 5996 } |
6041 | 5997 |
6042 | 5998 |
6043 #undef __ | 5999 #undef __ |
6044 } // namespace internal | 6000 } // namespace internal |
6045 } // namespace v8 | 6001 } // namespace v8 |
OLD | NEW |