Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: src/objects.cc

Issue 1162993006: Add support for Embedded Constant Pools for PPC and Arm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 } 1481 }
1482 break; 1482 break;
1483 } 1483 }
1484 return; 1484 return;
1485 } 1485 }
1486 1486
1487 switch (type) { 1487 switch (type) {
1488 case FIXED_ARRAY_TYPE: 1488 case FIXED_ARRAY_TYPE:
1489 FixedArray::BodyDescriptor::IterateBody(this, object_size, v); 1489 FixedArray::BodyDescriptor::IterateBody(this, object_size, v);
1490 break; 1490 break;
1491 case CONSTANT_POOL_ARRAY_TYPE:
1492 reinterpret_cast<ConstantPoolArray*>(this)->ConstantPoolIterateBody(v);
1493 break;
1494 case FIXED_DOUBLE_ARRAY_TYPE: 1491 case FIXED_DOUBLE_ARRAY_TYPE:
1495 break; 1492 break;
1496 case JS_OBJECT_TYPE: 1493 case JS_OBJECT_TYPE:
1497 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1494 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1498 case JS_GENERATOR_OBJECT_TYPE: 1495 case JS_GENERATOR_OBJECT_TYPE:
1499 case JS_MODULE_TYPE: 1496 case JS_MODULE_TYPE:
1500 case JS_VALUE_TYPE: 1497 case JS_VALUE_TYPE:
1501 case JS_DATE_TYPE: 1498 case JS_DATE_TYPE:
1502 case JS_ARRAY_TYPE: 1499 case JS_ARRAY_TYPE:
1503 case JS_ARRAY_BUFFER_TYPE: 1500 case JS_ARRAY_BUFFER_TYPE:
(...skipping 7993 matching lines...) Expand 10 before | Expand all | Expand 10 after
9497 9494
9498 bool Map::EquivalentToForNormalization(Map* other, 9495 bool Map::EquivalentToForNormalization(Map* other,
9499 PropertyNormalizationMode mode) { 9496 PropertyNormalizationMode mode) {
9500 int properties = mode == CLEAR_INOBJECT_PROPERTIES 9497 int properties = mode == CLEAR_INOBJECT_PROPERTIES
9501 ? 0 : other->inobject_properties(); 9498 ? 0 : other->inobject_properties();
9502 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() && 9499 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() &&
9503 inobject_properties() == properties; 9500 inobject_properties() == properties;
9504 } 9501 }
9505 9502
9506 9503
9507 void ConstantPoolArray::ConstantPoolIterateBody(ObjectVisitor* v) {
9508 // Unfortunately the serializer relies on pointers within an object being
9509 // visited in-order, so we have to iterate both the code and heap pointers in
9510 // the small section before doing so in the extended section.
9511 for (int s = 0; s <= final_section(); ++s) {
9512 LayoutSection section = static_cast<LayoutSection>(s);
9513 ConstantPoolArray::Iterator code_iter(this, ConstantPoolArray::CODE_PTR,
9514 section);
9515 while (!code_iter.is_finished()) {
9516 v->VisitCodeEntry(reinterpret_cast<Address>(
9517 RawFieldOfElementAt(code_iter.next_index())));
9518 }
9519
9520 ConstantPoolArray::Iterator heap_iter(this, ConstantPoolArray::HEAP_PTR,
9521 section);
9522 while (!heap_iter.is_finished()) {
9523 v->VisitPointer(RawFieldOfElementAt(heap_iter.next_index()));
9524 }
9525 }
9526 }
9527
9528
9529 void ConstantPoolArray::ClearPtrEntries(Isolate* isolate) {
9530 Type type[] = { CODE_PTR, HEAP_PTR };
9531 Address default_value[] = {
9532 isolate->builtins()->builtin(Builtins::kIllegal)->entry(),
9533 reinterpret_cast<Address>(isolate->heap()->undefined_value()) };
9534
9535 for (int i = 0; i < 2; ++i) {
9536 for (int s = 0; s <= final_section(); ++s) {
9537 LayoutSection section = static_cast<LayoutSection>(s);
9538 if (number_of_entries(type[i], section) > 0) {
9539 int offset = OffsetOfElementAt(first_index(type[i], section));
9540 MemsetPointer(
9541 reinterpret_cast<Address*>(HeapObject::RawField(this, offset)),
9542 default_value[i],
9543 number_of_entries(type[i], section));
9544 }
9545 }
9546 }
9547 }
9548
9549
9550 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { 9504 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) {
9551 // Iterate over all fields in the body but take care in dealing with 9505 // Iterate over all fields in the body but take care in dealing with
9552 // the code entry. 9506 // the code entry.
9553 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); 9507 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset);
9554 v->VisitCodeEntry(this->address() + kCodeEntryOffset); 9508 v->VisitCodeEntry(this->address() + kCodeEntryOffset);
9555 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); 9509 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size);
9556 } 9510 }
9557 9511
9558 9512
9559 void JSFunction::MarkForOptimization() { 9513 void JSFunction::MarkForOptimization() {
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
11662 if ((name != NULL) && (name[0] != '\0')) { 11616 if ((name != NULL) && (name[0] != '\0')) {
11663 os << "name = " << name << "\n"; 11617 os << "name = " << name << "\n";
11664 } 11618 }
11665 if (kind() == OPTIMIZED_FUNCTION) { 11619 if (kind() == OPTIMIZED_FUNCTION) {
11666 os << "stack_slots = " << stack_slots() << "\n"; 11620 os << "stack_slots = " << stack_slots() << "\n";
11667 } 11621 }
11668 11622
11669 os << "Instructions (size = " << instruction_size() << ")\n"; 11623 os << "Instructions (size = " << instruction_size() << ")\n";
11670 { 11624 {
11671 Isolate* isolate = GetIsolate(); 11625 Isolate* isolate = GetIsolate();
11672 int decode_size = is_crankshafted() 11626 int size = instruction_size();
11673 ? static_cast<int>(safepoint_table_offset()) 11627 int safepoint_offset =
11674 : instruction_size(); 11628 is_crankshafted() ? static_cast<int>(safepoint_table_offset()) : size;
11675 // If there might be a back edge table, stop before reaching it. 11629 int back_edge_offset = (kind() == Code::FUNCTION)
11676 if (kind() == Code::FUNCTION) { 11630 ? static_cast<int>(back_edge_table_offset())
11677 decode_size = 11631 : size;
11678 Min(decode_size, static_cast<int>(back_edge_table_offset())); 11632 int constant_pool_offset = FLAG_enable_embedded_constant_pool
11633 ? this->constant_pool_offset()
11634 : size;
11635
11636 // Stop before reaching any embedded tables
11637 int code_size = Min(safepoint_offset, back_edge_offset);
11638 code_size = Min(code_size, constant_pool_offset);
11639 byte* begin = instruction_start();
11640 byte* end = begin + code_size;
11641 Disassembler::Decode(isolate, &os, begin, end, this);
11642
11643 if (constant_pool_offset < size) {
11644 int constant_pool_size = size - constant_pool_offset;
11645 DCHECK((constant_pool_size & kPointerAlignmentMask) == 0);
11646 os << "\nConstant Pool (size = " << constant_pool_size << ")\n";
11647 Vector<char> buf = Vector<char>::New(50);
11648 intptr_t* ptr = reinterpret_cast<intptr_t*>(begin + constant_pool_offset);
11649 for (int i = 0; i < constant_pool_size; i += kPointerSize, ptr++) {
11650 SNPrintF(buf, "%4d %08" V8PRIxPTR, i, *ptr);
11651 os << static_cast<const void*>(ptr) << " " << buf.start() << "\n";
11652 }
11679 } 11653 }
11680 byte* begin = instruction_start();
11681 byte* end = begin + decode_size;
11682 Disassembler::Decode(isolate, &os, begin, end, this);
11683 } 11654 }
11684 os << "\n"; 11655 os << "\n";
11685 11656
11686 if (kind() == FUNCTION) { 11657 if (kind() == FUNCTION) {
11687 DeoptimizationOutputData* data = 11658 DeoptimizationOutputData* data =
11688 DeoptimizationOutputData::cast(this->deoptimization_data()); 11659 DeoptimizationOutputData::cast(this->deoptimization_data());
11689 data->DeoptimizationOutputDataPrint(os); 11660 data->DeoptimizationOutputDataPrint(os);
11690 } else if (kind() == OPTIMIZED_FUNCTION) { 11661 } else if (kind() == OPTIMIZED_FUNCTION) {
11691 DeoptimizationInputData* data = 11662 DeoptimizationInputData* data =
11692 DeoptimizationInputData::cast(this->deoptimization_data()); 11663 DeoptimizationInputData::cast(this->deoptimization_data());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
11751 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os); 11722 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os);
11752 } 11723 }
11753 os << "\n"; 11724 os << "\n";
11754 } 11725 }
11755 11726
11756 os << "RelocInfo (size = " << relocation_size() << ")\n"; 11727 os << "RelocInfo (size = " << relocation_size() << ")\n";
11757 for (RelocIterator it(this); !it.done(); it.next()) { 11728 for (RelocIterator it(this); !it.done(); it.next()) {
11758 it.rinfo()->Print(GetIsolate(), os); 11729 it.rinfo()->Print(GetIsolate(), os);
11759 } 11730 }
11760 os << "\n"; 11731 os << "\n";
11761
11762 #ifdef OBJECT_PRINT
11763 if (FLAG_enable_ool_constant_pool) {
11764 ConstantPoolArray* pool = constant_pool();
11765 if (pool->length()) {
11766 os << "Constant Pool\n";
11767 pool->Print(os);
11768 os << "\n";
11769 }
11770 }
11771 #endif
11772 } 11732 }
11773 #endif // ENABLE_DISASSEMBLER 11733 #endif // ENABLE_DISASSEMBLER
11774 11734
11775 11735
11776 Handle<FixedArray> JSObject::SetFastElementsCapacity( 11736 Handle<FixedArray> JSObject::SetFastElementsCapacity(
11777 Handle<JSObject> object, int capacity, 11737 Handle<JSObject> object, int capacity,
11778 SetFastElementsCapacitySmiMode smi_mode) { 11738 SetFastElementsCapacitySmiMode smi_mode) {
11779 // We should never end in here with a pixel or external array. 11739 // We should never end in here with a pixel or external array.
11780 DCHECK(!object->HasExternalArrayElements()); 11740 DCHECK(!object->HasExternalArrayElements());
11781 11741
(...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after
17008 Handle<Object> new_value) { 16968 Handle<Object> new_value) {
17009 if (cell->value() != *new_value) { 16969 if (cell->value() != *new_value) {
17010 cell->set_value(*new_value); 16970 cell->set_value(*new_value);
17011 Isolate* isolate = cell->GetIsolate(); 16971 Isolate* isolate = cell->GetIsolate();
17012 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16972 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17013 isolate, DependentCode::kPropertyCellChangedGroup); 16973 isolate, DependentCode::kPropertyCellChangedGroup);
17014 } 16974 }
17015 } 16975 }
17016 } // namespace internal 16976 } // namespace internal
17017 } // namespace v8 16977 } // namespace v8
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698