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

Side by Side Diff: src/objects.cc

Issue 1155703006: Revert of Embedded constant pools. (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
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 } 1474 }
1475 break; 1475 break;
1476 } 1476 }
1477 return; 1477 return;
1478 } 1478 }
1479 1479
1480 switch (type) { 1480 switch (type) {
1481 case FIXED_ARRAY_TYPE: 1481 case FIXED_ARRAY_TYPE:
1482 FixedArray::BodyDescriptor::IterateBody(this, object_size, v); 1482 FixedArray::BodyDescriptor::IterateBody(this, object_size, v);
1483 break; 1483 break;
1484 case CONSTANT_POOL_ARRAY_TYPE:
1485 reinterpret_cast<ConstantPoolArray*>(this)->ConstantPoolIterateBody(v);
1486 break;
1484 case FIXED_DOUBLE_ARRAY_TYPE: 1487 case FIXED_DOUBLE_ARRAY_TYPE:
1485 break; 1488 break;
1486 case JS_OBJECT_TYPE: 1489 case JS_OBJECT_TYPE:
1487 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1490 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1488 case JS_GENERATOR_OBJECT_TYPE: 1491 case JS_GENERATOR_OBJECT_TYPE:
1489 case JS_MODULE_TYPE: 1492 case JS_MODULE_TYPE:
1490 case JS_VALUE_TYPE: 1493 case JS_VALUE_TYPE:
1491 case JS_DATE_TYPE: 1494 case JS_DATE_TYPE:
1492 case JS_ARRAY_TYPE: 1495 case JS_ARRAY_TYPE:
1493 case JS_ARRAY_BUFFER_TYPE: 1496 case JS_ARRAY_BUFFER_TYPE:
(...skipping 7984 matching lines...) Expand 10 before | Expand all | Expand 10 after
9478 9481
9479 bool Map::EquivalentToForNormalization(Map* other, 9482 bool Map::EquivalentToForNormalization(Map* other,
9480 PropertyNormalizationMode mode) { 9483 PropertyNormalizationMode mode) {
9481 int properties = mode == CLEAR_INOBJECT_PROPERTIES 9484 int properties = mode == CLEAR_INOBJECT_PROPERTIES
9482 ? 0 : other->inobject_properties(); 9485 ? 0 : other->inobject_properties();
9483 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() && 9486 return CheckEquivalent(this, other) && bit_field2() == other->bit_field2() &&
9484 inobject_properties() == properties; 9487 inobject_properties() == properties;
9485 } 9488 }
9486 9489
9487 9490
9491 void ConstantPoolArray::ConstantPoolIterateBody(ObjectVisitor* v) {
9492 // Unfortunately the serializer relies on pointers within an object being
9493 // visited in-order, so we have to iterate both the code and heap pointers in
9494 // the small section before doing so in the extended section.
9495 for (int s = 0; s <= final_section(); ++s) {
9496 LayoutSection section = static_cast<LayoutSection>(s);
9497 ConstantPoolArray::Iterator code_iter(this, ConstantPoolArray::CODE_PTR,
9498 section);
9499 while (!code_iter.is_finished()) {
9500 v->VisitCodeEntry(reinterpret_cast<Address>(
9501 RawFieldOfElementAt(code_iter.next_index())));
9502 }
9503
9504 ConstantPoolArray::Iterator heap_iter(this, ConstantPoolArray::HEAP_PTR,
9505 section);
9506 while (!heap_iter.is_finished()) {
9507 v->VisitPointer(RawFieldOfElementAt(heap_iter.next_index()));
9508 }
9509 }
9510 }
9511
9512
9513 void ConstantPoolArray::ClearPtrEntries(Isolate* isolate) {
9514 Type type[] = { CODE_PTR, HEAP_PTR };
9515 Address default_value[] = {
9516 isolate->builtins()->builtin(Builtins::kIllegal)->entry(),
9517 reinterpret_cast<Address>(isolate->heap()->undefined_value()) };
9518
9519 for (int i = 0; i < 2; ++i) {
9520 for (int s = 0; s <= final_section(); ++s) {
9521 LayoutSection section = static_cast<LayoutSection>(s);
9522 if (number_of_entries(type[i], section) > 0) {
9523 int offset = OffsetOfElementAt(first_index(type[i], section));
9524 MemsetPointer(
9525 reinterpret_cast<Address*>(HeapObject::RawField(this, offset)),
9526 default_value[i],
9527 number_of_entries(type[i], section));
9528 }
9529 }
9530 }
9531 }
9532
9533
9488 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { 9534 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) {
9489 // Iterate over all fields in the body but take care in dealing with 9535 // Iterate over all fields in the body but take care in dealing with
9490 // the code entry. 9536 // the code entry.
9491 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); 9537 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset);
9492 v->VisitCodeEntry(this->address() + kCodeEntryOffset); 9538 v->VisitCodeEntry(this->address() + kCodeEntryOffset);
9493 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); 9539 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size);
9494 } 9540 }
9495 9541
9496 9542
9497 void JSFunction::MarkForOptimization() { 9543 void JSFunction::MarkForOptimization() {
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
11600 if ((name != NULL) && (name[0] != '\0')) { 11646 if ((name != NULL) && (name[0] != '\0')) {
11601 os << "name = " << name << "\n"; 11647 os << "name = " << name << "\n";
11602 } 11648 }
11603 if (kind() == OPTIMIZED_FUNCTION) { 11649 if (kind() == OPTIMIZED_FUNCTION) {
11604 os << "stack_slots = " << stack_slots() << "\n"; 11650 os << "stack_slots = " << stack_slots() << "\n";
11605 } 11651 }
11606 11652
11607 os << "Instructions (size = " << instruction_size() << ")\n"; 11653 os << "Instructions (size = " << instruction_size() << ")\n";
11608 { 11654 {
11609 Isolate* isolate = GetIsolate(); 11655 Isolate* isolate = GetIsolate();
11610 int size = instruction_size(); 11656 int decode_size = is_crankshafted()
11611 int safepoint_offset = 11657 ? static_cast<int>(safepoint_table_offset())
11612 is_crankshafted() ? static_cast<int>(safepoint_table_offset()) : size; 11658 : instruction_size();
11613 int back_edge_offset = (kind() == Code::FUNCTION) 11659 // If there might be a back edge table, stop before reaching it.
11614 ? static_cast<int>(back_edge_table_offset()) 11660 if (kind() == Code::FUNCTION) {
11615 : size; 11661 decode_size =
11616 int constant_pool_offset = FLAG_enable_embedded_constant_pool 11662 Min(decode_size, static_cast<int>(back_edge_table_offset()));
11617 ? this->constant_pool_offset() 11663 }
11618 : size;
11619
11620 // Stop before reaching any embedded tables
11621 int code_size = Min(safepoint_offset, back_edge_offset);
11622 code_size = Min(code_size, constant_pool_offset);
11623 byte* begin = instruction_start(); 11664 byte* begin = instruction_start();
11624 byte* end = begin + code_size; 11665 byte* end = begin + decode_size;
11625 Disassembler::Decode(isolate, &os, begin, end, this); 11666 Disassembler::Decode(isolate, &os, begin, end, this);
11626
11627 if (constant_pool_offset < size) {
11628 int constant_pool_size = size - constant_pool_offset;
11629 DCHECK((constant_pool_size & kPointerAlignmentMask) == 0);
11630 os << "\nConstant Pool (size = " << constant_pool_size << ")\n";
11631 Vector<char> buf = Vector<char>::New(50);
11632 intptr_t* ptr = reinterpret_cast<intptr_t*>(begin + constant_pool_offset);
11633 for (int i = 0; i < constant_pool_size; i += kPointerSize, ptr++) {
11634 SNPrintF(buf, "%4d %08" V8PRIxPTR, i, *ptr);
11635 os << static_cast<const void*>(ptr) << " " << buf.start() << "\n";
11636 }
11637 }
11638 } 11667 }
11639 os << "\n"; 11668 os << "\n";
11640 11669
11641 if (kind() == FUNCTION) { 11670 if (kind() == FUNCTION) {
11642 DeoptimizationOutputData* data = 11671 DeoptimizationOutputData* data =
11643 DeoptimizationOutputData::cast(this->deoptimization_data()); 11672 DeoptimizationOutputData::cast(this->deoptimization_data());
11644 data->DeoptimizationOutputDataPrint(os); 11673 data->DeoptimizationOutputDataPrint(os);
11645 } else if (kind() == OPTIMIZED_FUNCTION) { 11674 } else if (kind() == OPTIMIZED_FUNCTION) {
11646 DeoptimizationInputData* data = 11675 DeoptimizationInputData* data =
11647 DeoptimizationInputData::cast(this->deoptimization_data()); 11676 DeoptimizationInputData::cast(this->deoptimization_data());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
11706 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os); 11735 HandlerTable::cast(handler_table())->HandlerTableReturnPrint(os);
11707 } 11736 }
11708 os << "\n"; 11737 os << "\n";
11709 } 11738 }
11710 11739
11711 os << "RelocInfo (size = " << relocation_size() << ")\n"; 11740 os << "RelocInfo (size = " << relocation_size() << ")\n";
11712 for (RelocIterator it(this); !it.done(); it.next()) { 11741 for (RelocIterator it(this); !it.done(); it.next()) {
11713 it.rinfo()->Print(GetIsolate(), os); 11742 it.rinfo()->Print(GetIsolate(), os);
11714 } 11743 }
11715 os << "\n"; 11744 os << "\n";
11745
11746 #ifdef OBJECT_PRINT
11747 if (FLAG_enable_ool_constant_pool) {
11748 ConstantPoolArray* pool = constant_pool();
11749 if (pool->length()) {
11750 os << "Constant Pool\n";
11751 pool->Print(os);
11752 os << "\n";
11753 }
11754 }
11755 #endif
11716 } 11756 }
11717 #endif // ENABLE_DISASSEMBLER 11757 #endif // ENABLE_DISASSEMBLER
11718 11758
11719 11759
11720 Handle<FixedArray> JSObject::SetFastElementsCapacity( 11760 Handle<FixedArray> JSObject::SetFastElementsCapacity(
11721 Handle<JSObject> object, int capacity, 11761 Handle<JSObject> object, int capacity,
11722 SetFastElementsCapacitySmiMode smi_mode) { 11762 SetFastElementsCapacitySmiMode smi_mode) {
11723 // We should never end in here with a pixel or external array. 11763 // We should never end in here with a pixel or external array.
11724 DCHECK(!object->HasExternalArrayElements()); 11764 DCHECK(!object->HasExternalArrayElements());
11725 11765
(...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after
16952 Handle<Object> new_value) { 16992 Handle<Object> new_value) {
16953 if (cell->value() != *new_value) { 16993 if (cell->value() != *new_value) {
16954 cell->set_value(*new_value); 16994 cell->set_value(*new_value);
16955 Isolate* isolate = cell->GetIsolate(); 16995 Isolate* isolate = cell->GetIsolate();
16956 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16996 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16957 isolate, DependentCode::kPropertyCellChangedGroup); 16997 isolate, DependentCode::kPropertyCellChangedGroup);
16958 } 16998 }
16959 } 16999 }
16960 } // namespace internal 17000 } // namespace internal
16961 } // namespace v8 17001 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698