OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 Node* result = AllocateHeapNumber(); | 602 Node* result = AllocateHeapNumber(); |
603 StoreHeapNumberValue(result, value); | 603 StoreHeapNumberValue(result, value); |
604 return result; | 604 return result; |
605 } | 605 } |
606 | 606 |
607 Node* CodeStubAssembler::AllocateSeqOneByteString(int length) { | 607 Node* CodeStubAssembler::AllocateSeqOneByteString(int length) { |
608 Node* result = Allocate(SeqOneByteString::SizeFor(length)); | 608 Node* result = Allocate(SeqOneByteString::SizeFor(length)); |
609 StoreMapNoWriteBarrier(result, LoadRoot(Heap::kOneByteStringMapRootIndex)); | 609 StoreMapNoWriteBarrier(result, LoadRoot(Heap::kOneByteStringMapRootIndex)); |
610 StoreObjectFieldNoWriteBarrier(result, SeqOneByteString::kLengthOffset, | 610 StoreObjectFieldNoWriteBarrier(result, SeqOneByteString::kLengthOffset, |
611 SmiConstant(Smi::FromInt(length))); | 611 SmiConstant(Smi::FromInt(length))); |
612 StoreObjectFieldNoWriteBarrier(result, SeqOneByteString::kHashFieldOffset, | 612 StoreObjectFieldNoWriteBarrier(result, SeqOneByteString::kHashFieldSlot, |
613 IntPtrConstant(String::kEmptyHashField)); | 613 IntPtrConstant(String::kEmptyHashField)); |
614 return result; | 614 return result; |
615 } | 615 } |
616 | 616 |
617 Node* CodeStubAssembler::AllocateSeqTwoByteString(int length) { | 617 Node* CodeStubAssembler::AllocateSeqTwoByteString(int length) { |
618 Node* result = Allocate(SeqTwoByteString::SizeFor(length)); | 618 Node* result = Allocate(SeqTwoByteString::SizeFor(length)); |
619 StoreMapNoWriteBarrier(result, LoadRoot(Heap::kStringMapRootIndex)); | 619 StoreMapNoWriteBarrier(result, LoadRoot(Heap::kStringMapRootIndex)); |
620 StoreObjectFieldNoWriteBarrier(result, SeqTwoByteString::kLengthOffset, | 620 StoreObjectFieldNoWriteBarrier(result, SeqTwoByteString::kLengthOffset, |
621 SmiConstant(Smi::FromInt(length))); | 621 SmiConstant(Smi::FromInt(length))); |
622 StoreObjectFieldNoWriteBarrier(result, SeqTwoByteString::kHashFieldOffset, | 622 StoreObjectFieldNoWriteBarrier(result, SeqTwoByteString::kHashFieldSlot, |
623 IntPtrConstant(String::kEmptyHashField)); | 623 IntPtrConstant(String::kEmptyHashField)); |
624 return result; | 624 return result; |
625 } | 625 } |
626 | 626 |
627 Node* CodeStubAssembler::TruncateTaggedToFloat64(Node* context, Node* value) { | 627 Node* CodeStubAssembler::TruncateTaggedToFloat64(Node* context, Node* value) { |
628 // We might need to loop once due to ToNumber conversion. | 628 // We might need to loop once due to ToNumber conversion. |
629 Variable var_value(this, MachineRepresentation::kTagged), | 629 Variable var_value(this, MachineRepresentation::kTagged), |
630 var_result(this, MachineRepresentation::kFloat64); | 630 var_result(this, MachineRepresentation::kFloat64); |
631 Label loop(this, &var_value), done_loop(this, &var_result); | 631 Label loop(this, &var_value), done_loop(this, &var_result); |
632 var_value.Bind(value); | 632 var_value.Bind(value); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 } | 1145 } |
1146 | 1146 |
1147 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 1147 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
1148 uint32_t mask) { | 1148 uint32_t mask) { |
1149 return Word32Shr(Word32And(word32, Int32Constant(mask)), | 1149 return Word32Shr(Word32And(word32, Int32Constant(mask)), |
1150 Int32Constant(shift)); | 1150 Int32Constant(shift)); |
1151 } | 1151 } |
1152 | 1152 |
1153 } // namespace internal | 1153 } // namespace internal |
1154 } // namespace v8 | 1154 } // namespace v8 |
OLD | NEW |