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 6587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6598 StoreObjectField(cell, WeakCell::kValueOffset, value); | 6598 StoreObjectField(cell, WeakCell::kValueOffset, value); |
6599 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, | 6599 StoreObjectFieldRoot(cell, WeakCell::kNextOffset, |
6600 Heap::kTheHoleValueRootIndex); | 6600 Heap::kTheHoleValueRootIndex); |
6601 | 6601 |
6602 // Store the WeakCell in the feedback vector. | 6602 // Store the WeakCell in the feedback vector. |
6603 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 0, | 6603 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 0, |
6604 CodeStubAssembler::SMI_PARAMETERS); | 6604 CodeStubAssembler::SMI_PARAMETERS); |
6605 return cell; | 6605 return cell; |
6606 } | 6606 } |
6607 | 6607 |
| 6608 void CodeStubAssembler::HandleSlackTracking(Node* context, Node* object, |
| 6609 Node* initial_map, |
| 6610 int start_offset) { |
| 6611 Node* instance_size_words = ChangeUint32ToWord(LoadObjectField( |
| 6612 initial_map, Map::kInstanceSizeOffset, MachineType::Uint8())); |
| 6613 Node* instance_size = |
| 6614 WordShl(instance_size_words, IntPtrConstant(kPointerSizeLog2)); |
| 6615 |
| 6616 // Perform in-object slack tracking if requested. |
| 6617 Node* bit_field3 = LoadMapBitField3(initial_map); |
| 6618 Label end(this), slack_tracking(this), finalize(this, Label::kDeferred); |
| 6619 GotoIf(IsSetWord32<Map::ConstructionCounter>(bit_field3), &slack_tracking); |
| 6620 |
| 6621 // Initialize remaining fields. |
| 6622 { |
| 6623 Comment("no slack tracking"); |
| 6624 InitializeFieldsWithRoot(object, IntPtrConstant(start_offset), |
| 6625 instance_size, Heap::kUndefinedValueRootIndex); |
| 6626 Goto(&end); |
| 6627 } |
| 6628 |
| 6629 { |
| 6630 BIND(&slack_tracking); |
| 6631 |
| 6632 // Decrease generous allocation count. |
| 6633 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); |
| 6634 Comment("update allocation count"); |
| 6635 Node* new_bit_field3 = Int32Sub( |
| 6636 bit_field3, Int32Constant(1 << Map::ConstructionCounter::kShift)); |
| 6637 StoreObjectFieldNoWriteBarrier(initial_map, Map::kBitField3Offset, |
| 6638 new_bit_field3, |
| 6639 MachineRepresentation::kWord32); |
| 6640 GotoIf(IsClearWord32<Map::ConstructionCounter>(new_bit_field3), &finalize); |
| 6641 |
| 6642 Node* unused_fields = LoadObjectField( |
| 6643 initial_map, Map::kUnusedPropertyFieldsOffset, MachineType::Uint8()); |
| 6644 Node* used_size = |
| 6645 IntPtrSub(instance_size, WordShl(ChangeUint32ToWord(unused_fields), |
| 6646 IntPtrConstant(kPointerSizeLog2))); |
| 6647 |
| 6648 Comment("initialize filler fields (no finalize)"); |
| 6649 InitializeFieldsWithRoot(object, used_size, instance_size, |
| 6650 Heap::kOnePointerFillerMapRootIndex); |
| 6651 |
| 6652 Comment("initialize undefined fields (no finalize)"); |
| 6653 InitializeFieldsWithRoot(object, IntPtrConstant(start_offset), used_size, |
| 6654 Heap::kUndefinedValueRootIndex); |
| 6655 Goto(&end); |
| 6656 } |
| 6657 |
| 6658 { |
| 6659 // Finalize the instance size. |
| 6660 BIND(&finalize); |
| 6661 |
| 6662 Node* unused_fields = LoadObjectField( |
| 6663 initial_map, Map::kUnusedPropertyFieldsOffset, MachineType::Uint8()); |
| 6664 Node* used_size = |
| 6665 IntPtrSub(instance_size, WordShl(ChangeUint32ToWord(unused_fields), |
| 6666 IntPtrConstant(kPointerSizeLog2))); |
| 6667 |
| 6668 Comment("initialize filler fields (finalize)"); |
| 6669 InitializeFieldsWithRoot(object, used_size, instance_size, |
| 6670 Heap::kOnePointerFillerMapRootIndex); |
| 6671 |
| 6672 Comment("initialize undefined fields (finalize)"); |
| 6673 InitializeFieldsWithRoot(object, IntPtrConstant(start_offset), used_size, |
| 6674 Heap::kUndefinedValueRootIndex); |
| 6675 |
| 6676 CallRuntime(Runtime::kFinalizeInstanceSize, context, initial_map); |
| 6677 Goto(&end); |
| 6678 } |
| 6679 |
| 6680 BIND(&end); |
| 6681 } |
| 6682 |
6608 Node* CodeStubAssembler::BuildFastLoop( | 6683 Node* CodeStubAssembler::BuildFastLoop( |
6609 const CodeStubAssembler::VariableList& vars, Node* start_index, | 6684 const CodeStubAssembler::VariableList& vars, Node* start_index, |
6610 Node* end_index, const FastLoopBody& body, int increment, | 6685 Node* end_index, const FastLoopBody& body, int increment, |
6611 ParameterMode parameter_mode, IndexAdvanceMode advance_mode) { | 6686 ParameterMode parameter_mode, IndexAdvanceMode advance_mode) { |
6612 MachineRepresentation index_rep = (parameter_mode == INTPTR_PARAMETERS) | 6687 MachineRepresentation index_rep = (parameter_mode == INTPTR_PARAMETERS) |
6613 ? MachineType::PointerRepresentation() | 6688 ? MachineType::PointerRepresentation() |
6614 : MachineRepresentation::kTaggedSigned; | 6689 : MachineRepresentation::kTaggedSigned; |
6615 VARIABLE(var, index_rep, start_index); | 6690 VARIABLE(var, index_rep, start_index); |
6616 VariableList vars_copy(vars, zone()); | 6691 VariableList vars_copy(vars, zone()); |
6617 vars_copy.Add(&var, zone()); | 6692 vars_copy.Add(&var, zone()); |
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8892 formatted.c_str(), TENURED); | 8967 formatted.c_str(), TENURED); |
8893 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8968 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8894 HeapConstant(string)); | 8969 HeapConstant(string)); |
8895 } | 8970 } |
8896 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8971 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8897 #endif | 8972 #endif |
8898 } | 8973 } |
8899 | 8974 |
8900 } // namespace internal | 8975 } // namespace internal |
8901 } // namespace v8 | 8976 } // namespace v8 |
OLD | NEW |