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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 6579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6590 StoreObjectField(cell, WeakCell::kValueOffset, value); | 6590 StoreObjectField(cell, WeakCell::kValueOffset, value); |
6591 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, | 6591 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, |
6592 Heap::kTheHoleValueRootIndex); | 6592 Heap::kTheHoleValueRootIndex); |
6593 | 6593 |
6594 // Store the WeakCell in the feedback vector. | 6594 // Store the WeakCell in the feedback vector. |
6595 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 0, | 6595 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 0, |
6596 CodeStubAssembler::SMI_PARAMETERS); | 6596 CodeStubAssembler::SMI_PARAMETERS); |
6597 return cell; | 6597 return cell; |
6598 } | 6598 } |
6599 | 6599 |
| 6600 void CodeStubAssembler::HandleSlackTracking(Node* context, Node* object, |
| 6601 Node* initial_map, |
| 6602 int start_offset) { |
| 6603 Node* instance_size_words = ChangeUint32ToWord(LoadObjectField( |
| 6604 initial_map, Map::kInstanceSizeOffset, MachineType::Uint8())); |
| 6605 Node* instance_size = |
| 6606 WordShl(instance_size_words, IntPtrConstant(kPointerSizeLog2)); |
| 6607 |
| 6608 // Perform in-object slack tracking if requested. |
| 6609 Node* bit_field3 = LoadMapBitField3(initial_map); |
| 6610 Label end(this), slack_tracking(this), finalize(this, Label::kDeferred); |
| 6611 GotoIf(IsSetWord32<Map::ConstructionCounter>(bit_field3), &slack_tracking); |
| 6612 |
| 6613 // Initialize remaining fields. |
| 6614 { |
| 6615 Comment("no slack tracking"); |
| 6616 InitializeFieldsWithRoot(object, IntPtrConstant(start_offset), |
| 6617 instance_size, Heap::kUndefinedValueRootIndex); |
| 6618 Goto(&end); |
| 6619 } |
| 6620 |
| 6621 { |
| 6622 BIND(&slack_tracking); |
| 6623 |
| 6624 // Decrease generous allocation count. |
| 6625 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); |
| 6626 Comment("update allocation count"); |
| 6627 Node* new_bit_field3 = Int32Sub( |
| 6628 bit_field3, Int32Constant(1 << Map::ConstructionCounter::kShift)); |
| 6629 StoreObjectFieldNoWriteBarrier(initial_map, Map::kBitField3Offset, |
| 6630 new_bit_field3, |
| 6631 MachineRepresentation::kWord32); |
| 6632 GotoIf(IsClearWord32<Map::ConstructionCounter>(new_bit_field3), &finalize); |
| 6633 |
| 6634 Node* unused_fields = LoadObjectField( |
| 6635 initial_map, Map::kUnusedPropertyFieldsOffset, MachineType::Uint8()); |
| 6636 Node* used_size = |
| 6637 IntPtrSub(instance_size, WordShl(ChangeUint32ToWord(unused_fields), |
| 6638 IntPtrConstant(kPointerSizeLog2))); |
| 6639 |
| 6640 Comment("initialize filler fields (no finalize)"); |
| 6641 InitializeFieldsWithRoot(object, used_size, instance_size, |
| 6642 Heap::kOnePointerFillerMapRootIndex); |
| 6643 |
| 6644 Comment("initialize undefined fields (no finalize)"); |
| 6645 InitializeFieldsWithRoot(object, IntPtrConstant(start_offset), used_size, |
| 6646 Heap::kUndefinedValueRootIndex); |
| 6647 Goto(&end); |
| 6648 } |
| 6649 |
| 6650 { |
| 6651 // Finalize the instance size. |
| 6652 BIND(&finalize); |
| 6653 |
| 6654 Node* unused_fields = LoadObjectField( |
| 6655 initial_map, Map::kUnusedPropertyFieldsOffset, MachineType::Uint8()); |
| 6656 Node* used_size = |
| 6657 IntPtrSub(instance_size, WordShl(ChangeUint32ToWord(unused_fields), |
| 6658 IntPtrConstant(kPointerSizeLog2))); |
| 6659 |
| 6660 Comment("initialize filler fields (finalize)"); |
| 6661 InitializeFieldsWithRoot(object, used_size, instance_size, |
| 6662 Heap::kOnePointerFillerMapRootIndex); |
| 6663 |
| 6664 Comment("initialize undefined fields (finalize)"); |
| 6665 InitializeFieldsWithRoot(object, IntPtrConstant(start_offset), used_size, |
| 6666 Heap::kUndefinedValueRootIndex); |
| 6667 |
| 6668 CallRuntime(Runtime::kFinalizeInstanceSize, context, initial_map); |
| 6669 Goto(&end); |
| 6670 } |
| 6671 |
| 6672 BIND(&end); |
| 6673 } |
| 6674 |
6600 Node* CodeStubAssembler::BuildFastLoop( | 6675 Node* CodeStubAssembler::BuildFastLoop( |
6601 const CodeStubAssembler::VariableList& vars, Node* start_index, | 6676 const CodeStubAssembler::VariableList& vars, Node* start_index, |
6602 Node* end_index, const FastLoopBody& body, int increment, | 6677 Node* end_index, const FastLoopBody& body, int increment, |
6603 ParameterMode parameter_mode, IndexAdvanceMode advance_mode) { | 6678 ParameterMode parameter_mode, IndexAdvanceMode advance_mode) { |
6604 MachineRepresentation index_rep = (parameter_mode == INTPTR_PARAMETERS) | 6679 MachineRepresentation index_rep = (parameter_mode == INTPTR_PARAMETERS) |
6605 ? MachineType::PointerRepresentation() | 6680 ? MachineType::PointerRepresentation() |
6606 : MachineRepresentation::kTaggedSigned; | 6681 : MachineRepresentation::kTaggedSigned; |
6607 VARIABLE(var, index_rep, start_index); | 6682 VARIABLE(var, index_rep, start_index); |
6608 VariableList vars_copy(vars, zone()); | 6683 VariableList vars_copy(vars, zone()); |
6609 vars_copy.Add(&var, zone()); | 6684 vars_copy.Add(&var, zone()); |
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8882 formatted.c_str(), TENURED); | 8957 formatted.c_str(), TENURED); |
8883 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8958 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8884 HeapConstant(string)); | 8959 HeapConstant(string)); |
8885 } | 8960 } |
8886 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8961 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8887 #endif | 8962 #endif |
8888 } | 8963 } |
8889 | 8964 |
8890 } // namespace internal | 8965 } // namespace internal |
8891 } // namespace v8 | 8966 } // namespace v8 |
OLD | NEW |