OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1565 } | 1565 } |
1566 break; | 1566 break; |
1567 } | 1567 } |
1568 return; | 1568 return; |
1569 } | 1569 } |
1570 | 1570 |
1571 switch (type) { | 1571 switch (type) { |
1572 case FIXED_ARRAY_TYPE: | 1572 case FIXED_ARRAY_TYPE: |
1573 FixedArray::BodyDescriptor::IterateBody(this, object_size, v); | 1573 FixedArray::BodyDescriptor::IterateBody(this, object_size, v); |
1574 break; | 1574 break; |
1575 case CONSTANT_POOL_ARRAY_TYPE: | |
1576 reinterpret_cast<ConstantPoolArray*>(this)->ConstantPoolIterateBody(v); | |
1577 break; | |
1578 case FIXED_DOUBLE_ARRAY_TYPE: | 1575 case FIXED_DOUBLE_ARRAY_TYPE: |
1579 break; | 1576 break; |
1580 case JS_OBJECT_TYPE: | 1577 case JS_OBJECT_TYPE: |
1581 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 1578 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
1582 case JS_GENERATOR_OBJECT_TYPE: | 1579 case JS_GENERATOR_OBJECT_TYPE: |
1583 case JS_MODULE_TYPE: | 1580 case JS_MODULE_TYPE: |
1584 case JS_VALUE_TYPE: | 1581 case JS_VALUE_TYPE: |
1585 case JS_DATE_TYPE: | 1582 case JS_DATE_TYPE: |
1586 case JS_ARRAY_TYPE: | 1583 case JS_ARRAY_TYPE: |
1587 case JS_ARRAY_BUFFER_TYPE: | 1584 case JS_ARRAY_BUFFER_TYPE: |
(...skipping 8135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9723 | 9720 |
9724 bool Map::EquivalentToForNormalization(Map* other, | 9721 bool Map::EquivalentToForNormalization(Map* other, |
9725 PropertyNormalizationMode mode) { | 9722 PropertyNormalizationMode mode) { |
9726 int properties = mode == CLEAR_INOBJECT_PROPERTIES | 9723 int properties = mode == CLEAR_INOBJECT_PROPERTIES |
9727 ? 0 : other->inobject_properties(); | 9724 ? 0 : other->inobject_properties(); |
9728 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() && | 9725 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() && |
9729 inobject_properties() == properties; | 9726 inobject_properties() == properties; |
9730 } | 9727 } |
9731 | 9728 |
9732 | 9729 |
9733 void ConstantPoolArray::ConstantPoolIterateBody(ObjectVisitor* v) { | |
9734 // Unfortunately the serializer relies on pointers within an object being | |
9735 // visited in-order, so we have to iterate both the code and heap pointers in | |
9736 // the small section before doing so in the extended section. | |
9737 for (int s = 0; s <= final_section(); ++s) { | |
9738 LayoutSection section = static_cast<LayoutSection>(s); | |
9739 ConstantPoolArray::Iterator code_iter(this, ConstantPoolArray::CODE_PTR, | |
9740 section); | |
9741 while (!code_iter.is_finished()) { | |
9742 v->VisitCodeEntry(reinterpret_cast<Address>( | |
9743 RawFieldOfElementAt(code_iter.next_index()))); | |
9744 } | |
9745 | |
9746 ConstantPoolArray::Iterator heap_iter(this, ConstantPoolArray::HEAP_PTR, | |
9747 section); | |
9748 while (!heap_iter.is_finished()) { | |
9749 v->VisitPointer(RawFieldOfElementAt(heap_iter.next_index())); | |
9750 } | |
9751 } | |
9752 } | |
9753 | |
9754 | |
9755 void ConstantPoolArray::ClearPtrEntries(Isolate* isolate) { | |
9756 Type type[] = { CODE_PTR, HEAP_PTR }; | |
9757 Address default_value[] = { | |
9758 isolate->builtins()->builtin(Builtins::kIllegal)->entry(), | |
9759 reinterpret_cast<Address>(isolate->heap()->undefined_value()) }; | |
9760 | |
9761 for (int i = 0; i < 2; ++i) { | |
9762 for (int s = 0; s <= final_section(); ++s) { | |
9763 LayoutSection section = static_cast<LayoutSection>(s); | |
9764 if (number_of_entries(type[i], section) > 0) { | |
9765 int offset = OffsetOfElementAt(first_index(type[i], section)); | |
9766 MemsetPointer( | |
9767 reinterpret_cast<Address*>(HeapObject::RawField(this, offset)), | |
9768 default_value[i], | |
9769 number_of_entries(type[i], section)); | |
9770 } | |
9771 } | |
9772 } | |
9773 } | |
9774 | |
9775 | |
9776 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { | 9730 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { |
9777 // Iterate over all fields in the body but take care in dealing with | 9731 // Iterate over all fields in the body but take care in dealing with |
9778 // the code entry. | 9732 // the code entry. |
9779 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); | 9733 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
9780 v->VisitCodeEntry(this->address() + kCodeEntryOffset); | 9734 v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
9781 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); | 9735 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
9782 } | 9736 } |
9783 | 9737 |
9784 | 9738 |
9785 void JSFunction::MarkForOptimization() { | 9739 void JSFunction::MarkForOptimization() { |
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11873 if ((name != NULL) && (name[0] != '\0')) { | 11827 if ((name != NULL) && (name[0] != '\0')) { |
11874 os << "name = " << name << "\n"; | 11828 os << "name = " << name << "\n"; |
11875 } | 11829 } |
11876 if (kind() == OPTIMIZED_FUNCTION) { | 11830 if (kind() == OPTIMIZED_FUNCTION) { |
11877 os << "stack_slots = " << stack_slots() << "\n"; | 11831 os << "stack_slots = " << stack_slots() << "\n"; |
11878 } | 11832 } |
11879 | 11833 |
11880 os << "Instructions (size = " << instruction_size() << ")\n"; | 11834 os << "Instructions (size = " << instruction_size() << ")\n"; |
11881 { | 11835 { |
11882 Isolate* isolate = GetIsolate(); | 11836 Isolate* isolate = GetIsolate(); |
11883 int decode_size = is_crankshafted() | 11837 int size = instruction_size(); |
11884 ? static_cast<int>(safepoint_table_offset()) | 11838 int safepoint_offset = |
11885 : instruction_size(); | 11839 is_crankshafted() ? static_cast<int>(safepoint_table_offset()) : size; |
11886 // If there might be a back edge table, stop before reaching it. | 11840 int back_edge_offset = (kind() == Code::FUNCTION) |
11887 if (kind() == Code::FUNCTION) { | 11841 ? static_cast<int>(back_edge_table_offset()) |
11888 decode_size = | 11842 : size; |
11889 Min(decode_size, static_cast<int>(back_edge_table_offset())); | 11843 int constant_offset = |
rmcilroy
2015/05/20 14:32:12
nit - constant_pool_offset
MTBrandyberry
2015/05/20 22:28:23
Done.
| |
11844 FLAG_enable_embedded_constant_pool ? constant_pool_offset() : size; | |
11845 | |
11846 // Stop before reaching any embedded tables | |
11847 int code_size = Min(safepoint_offset, back_edge_offset); | |
rmcilroy
2015/05/20 14:32:12
Do we want the Min of constant_pool_offset as well
MTBrandyberry
2015/05/20 22:28:23
Effectively yes -- that's result of the 'end' calc
| |
11848 byte* begin = instruction_start(); | |
11849 byte* end = begin + Min(code_size, constant_offset); | |
11850 Disassembler::Decode(isolate, &os, begin, end, this); | |
11851 | |
11852 if (constant_offset < code_size) { | |
11853 int constant_size = code_size - constant_offset; | |
11854 DCHECK((constant_size & kPointerAlignmentMask) == 0); | |
11855 os << "\nConstant Pool (size = " << constant_size << ")\n"; | |
11856 Vector<char> buf = Vector<char>::New(50); | |
11857 intptr_t* ptr = reinterpret_cast<intptr_t*>(begin + constant_offset); | |
11858 for (int i = 0; i < constant_size; i += kPointerSize, ptr++) { | |
11859 SNPrintF(buf, "%4d %08" V8PRIxPTR, i, *ptr); | |
11860 os << static_cast<const void*>(ptr) << " " << buf.start() << "\n"; | |
11861 } | |
11890 } | 11862 } |
11891 byte* begin = instruction_start(); | |
11892 byte* end = begin + decode_size; | |
11893 Disassembler::Decode(isolate, &os, begin, end, this); | |
11894 } | 11863 } |
11895 os << "\n"; | 11864 os << "\n"; |
11896 | 11865 |
11897 if (kind() == FUNCTION) { | 11866 if (kind() == FUNCTION) { |
11898 DeoptimizationOutputData* data = | 11867 DeoptimizationOutputData* data = |
11899 DeoptimizationOutputData::cast(this->deoptimization_data()); | 11868 DeoptimizationOutputData::cast(this->deoptimization_data()); |
11900 data->DeoptimizationOutputDataPrint(os); | 11869 data->DeoptimizationOutputDataPrint(os); |
11901 } else if (kind() == OPTIMIZED_FUNCTION) { | 11870 } else if (kind() == OPTIMIZED_FUNCTION) { |
11902 DeoptimizationInputData* data = | 11871 DeoptimizationInputData* data = |
11903 DeoptimizationInputData::cast(this->deoptimization_data()); | 11872 DeoptimizationInputData::cast(this->deoptimization_data()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11962 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os); | 11931 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os); |
11963 } | 11932 } |
11964 os << "\n"; | 11933 os << "\n"; |
11965 } | 11934 } |
11966 | 11935 |
11967 os << "RelocInfo (size = " << relocation_size() << ")\n"; | 11936 os << "RelocInfo (size = " << relocation_size() << ")\n"; |
11968 for (RelocIterator it(this); !it.done(); it.next()) { | 11937 for (RelocIterator it(this); !it.done(); it.next()) { |
11969 it.rinfo()->Print(GetIsolate(), os); | 11938 it.rinfo()->Print(GetIsolate(), os); |
11970 } | 11939 } |
11971 os << "\n"; | 11940 os << "\n"; |
11972 | |
11973 #ifdef OBJECT_PRINT | |
11974 if (FLAG_enable_ool_constant_pool) { | |
11975 ConstantPoolArray* pool = constant_pool(); | |
11976 if (pool->length()) { | |
11977 os << "Constant Pool\n"; | |
11978 pool->Print(os); | |
11979 os << "\n"; | |
11980 } | |
11981 } | |
11982 #endif | |
11983 } | 11941 } |
11984 #endif // ENABLE_DISASSEMBLER | 11942 #endif // ENABLE_DISASSEMBLER |
11985 | 11943 |
11986 | 11944 |
11987 Handle<FixedArray> JSObject::SetFastElementsCapacity( | 11945 Handle<FixedArray> JSObject::SetFastElementsCapacity( |
11988 Handle<JSObject> object, int capacity, | 11946 Handle<JSObject> object, int capacity, |
11989 SetFastElementsCapacitySmiMode smi_mode) { | 11947 SetFastElementsCapacitySmiMode smi_mode) { |
11990 // We should never end in here with a pixel or external array. | 11948 // We should never end in here with a pixel or external array. |
11991 DCHECK(!object->HasExternalArrayElements()); | 11949 DCHECK(!object->HasExternalArrayElements()); |
11992 | 11950 |
(...skipping 5244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17237 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17195 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
17238 Handle<Object> new_value) { | 17196 Handle<Object> new_value) { |
17239 if (cell->value() != *new_value) { | 17197 if (cell->value() != *new_value) { |
17240 cell->set_value(*new_value); | 17198 cell->set_value(*new_value); |
17241 Isolate* isolate = cell->GetIsolate(); | 17199 Isolate* isolate = cell->GetIsolate(); |
17242 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17200 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17243 isolate, DependentCode::kPropertyCellChangedGroup); | 17201 isolate, DependentCode::kPropertyCellChangedGroup); |
17244 } | 17202 } |
17245 } | 17203 } |
17246 } } // namespace v8::internal | 17204 } } // namespace v8::internal |
OLD | NEW |