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

Side by Side Diff: src/objects.cc

Issue 16631002: Separate Cell and PropertyCell spaces (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove Mips changes Created 7 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 | Annotate | Revision Log
« 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 return ABSENT; 624 return ABSENT;
625 } 625 }
626 626
627 627
628 Object* JSObject::GetNormalizedProperty(LookupResult* result) { 628 Object* JSObject::GetNormalizedProperty(LookupResult* result) {
629 ASSERT(!HasFastProperties()); 629 ASSERT(!HasFastProperties());
630 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); 630 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry());
631 if (IsGlobalObject()) { 631 if (IsGlobalObject()) {
632 value = JSGlobalPropertyCell::cast(value)->value(); 632 value = JSGlobalPropertyCell::cast(value)->value();
633 } 633 }
634 ASSERT(!value->IsJSGlobalPropertyCell()); 634 ASSERT(!value->IsJSGlobalPropertyCell() && !value->IsCell());
635 return value; 635 return value;
636 } 636 }
637 637
638 638
639 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) { 639 Object* JSObject::SetNormalizedProperty(LookupResult* result, Object* value) {
640 ASSERT(!HasFastProperties()); 640 ASSERT(!HasFastProperties());
641 if (IsGlobalObject()) { 641 if (IsGlobalObject()) {
642 JSGlobalPropertyCell* cell = 642 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(
643 JSGlobalPropertyCell::cast( 643 property_dictionary()->ValueAt(result->GetDictionaryEntry()));
644 property_dictionary()->ValueAt(result->GetDictionaryEntry()));
645 cell->set_value(value); 644 cell->set_value(value);
646 } else { 645 } else {
647 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); 646 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value);
648 } 647 }
649 return value; 648 return value;
650 } 649 }
651 650
652 651
653 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object, 652 Handle<Object> JSObject::SetNormalizedProperty(Handle<JSObject> object,
654 Handle<Name> key, 653 Handle<Name> key,
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 break; 1559 break;
1561 case JS_PROXY_TYPE: 1560 case JS_PROXY_TYPE:
1562 accumulator->Add("<JSProxy>"); 1561 accumulator->Add("<JSProxy>");
1563 break; 1562 break;
1564 case JS_FUNCTION_PROXY_TYPE: 1563 case JS_FUNCTION_PROXY_TYPE:
1565 accumulator->Add("<JSFunctionProxy>"); 1564 accumulator->Add("<JSFunctionProxy>");
1566 break; 1565 break;
1567 case FOREIGN_TYPE: 1566 case FOREIGN_TYPE:
1568 accumulator->Add("<Foreign>"); 1567 accumulator->Add("<Foreign>");
1569 break; 1568 break;
1570 case JS_GLOBAL_PROPERTY_CELL_TYPE: 1569 case CELL_TYPE:
1571 accumulator->Add("Cell for "); 1570 accumulator->Add("Cell for ");
1571 Cell::cast(this)->value()->ShortPrint(accumulator);
1572 break;
1573 case PROPERTY_CELL_TYPE:
1574 accumulator->Add("PropertyCell for ");
1572 JSGlobalPropertyCell::cast(this)->value()->ShortPrint(accumulator); 1575 JSGlobalPropertyCell::cast(this)->value()->ShortPrint(accumulator);
1573 break; 1576 break;
1574 default: 1577 default:
1575 accumulator->Add("<Other heap object (%d)>", map()->instance_type()); 1578 accumulator->Add("<Other heap object (%d)>", map()->instance_type());
1576 break; 1579 break;
1577 } 1580 }
1578 } 1581 }
1579 1582
1580 1583
1581 void HeapObject::Iterate(ObjectVisitor* v) { 1584 void HeapObject::Iterate(ObjectVisitor* v) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 break; 1657 break;
1655 case FOREIGN_TYPE: 1658 case FOREIGN_TYPE:
1656 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v); 1659 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v);
1657 break; 1660 break;
1658 case MAP_TYPE: 1661 case MAP_TYPE:
1659 Map::BodyDescriptor::IterateBody(this, v); 1662 Map::BodyDescriptor::IterateBody(this, v);
1660 break; 1663 break;
1661 case CODE_TYPE: 1664 case CODE_TYPE:
1662 reinterpret_cast<Code*>(this)->CodeIterateBody(v); 1665 reinterpret_cast<Code*>(this)->CodeIterateBody(v);
1663 break; 1666 break;
1664 case JS_GLOBAL_PROPERTY_CELL_TYPE: 1667 case CELL_TYPE:
1668 Cell::BodyDescriptor::IterateBody(this, v);
1669 break;
1670 case PROPERTY_CELL_TYPE:
1665 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v); 1671 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v);
1666 break; 1672 break;
1667 case SYMBOL_TYPE: 1673 case SYMBOL_TYPE:
1668 Symbol::BodyDescriptor::IterateBody(this, v); 1674 Symbol::BodyDescriptor::IterateBody(this, v);
1669 break; 1675 break;
1670 case HEAP_NUMBER_TYPE: 1676 case HEAP_NUMBER_TYPE:
1671 case FILLER_TYPE: 1677 case FILLER_TYPE:
1672 case BYTE_ARRAY_TYPE: 1678 case BYTE_ARRAY_TYPE:
1673 case FREE_SPACE_TYPE: 1679 case FREE_SPACE_TYPE:
1674 case EXTERNAL_PIXEL_ARRAY_TYPE: 1680 case EXTERNAL_PIXEL_ARRAY_TYPE:
(...skipping 7223 matching lines...) Expand 10 before | Expand all | Expand 10 after
8898 return info; 8904 return info;
8899 } 8905 }
8900 } 8906 }
8901 } 8907 }
8902 return NULL; 8908 return NULL;
8903 } 8909 }
8904 8910
8905 8911
8906 bool AllocationSiteInfo::GetElementsKindPayload(ElementsKind* kind) { 8912 bool AllocationSiteInfo::GetElementsKindPayload(ElementsKind* kind) {
8907 ASSERT(kind != NULL); 8913 ASSERT(kind != NULL);
8908 if (payload()->IsJSGlobalPropertyCell()) { 8914 if (payload()->IsCell()) {
8909 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(payload()); 8915 Cell* cell = Cell::cast(payload());
8910 Object* cell_contents = cell->value(); 8916 Object* cell_contents = cell->value();
8911 if (cell_contents->IsSmi()) { 8917 if (cell_contents->IsSmi()) {
8912 *kind = static_cast<ElementsKind>( 8918 *kind = static_cast<ElementsKind>(
8913 Smi::cast(cell_contents)->value()); 8919 Smi::cast(cell_contents)->value());
8914 return true; 8920 return true;
8915 } 8921 }
8916 } 8922 }
8917 return false; 8923 return false;
8918 } 8924 }
8919 8925
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
9973 void ObjectVisitor::VisitCodeEntry(Address entry_address) { 9979 void ObjectVisitor::VisitCodeEntry(Address entry_address) {
9974 Object* code = Code::GetObjectFromEntryAddress(entry_address); 9980 Object* code = Code::GetObjectFromEntryAddress(entry_address);
9975 Object* old_code = code; 9981 Object* old_code = code;
9976 VisitPointer(&code); 9982 VisitPointer(&code);
9977 if (code != old_code) { 9983 if (code != old_code) {
9978 Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry(); 9984 Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry();
9979 } 9985 }
9980 } 9986 }
9981 9987
9982 9988
9983 void ObjectVisitor::VisitGlobalPropertyCell(RelocInfo* rinfo) { 9989 void ObjectVisitor::VisitCell(RelocInfo* rinfo) {
9984 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL); 9990 ASSERT(rinfo->rmode() == RelocInfo::CELL);
9985 Object* cell = rinfo->target_cell(); 9991 Object* cell = rinfo->target_cell();
9986 Object* old_cell = cell; 9992 Object* old_cell = cell;
9987 VisitPointer(&cell); 9993 VisitPointer(&cell);
9988 if (cell != old_cell) { 9994 if (cell != old_cell) {
9989 rinfo->set_target_cell(reinterpret_cast<JSGlobalPropertyCell*>(cell)); 9995 rinfo->set_target_cell(reinterpret_cast<Cell*>(cell));
9990 } 9996 }
9991 } 9997 }
9992 9998
9993 9999
9994 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { 10000 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) {
9995 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && 10001 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) &&
9996 rinfo->IsPatchedReturnSequence()) || 10002 rinfo->IsPatchedReturnSequence()) ||
9997 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && 10003 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) &&
9998 rinfo->IsPatchedDebugBreakSlotSequence())); 10004 rinfo->IsPatchedDebugBreakSlotSequence()));
9999 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); 10005 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
10041 10047
10042 // copy reloc info 10048 // copy reloc info
10043 CopyBytes(relocation_start(), 10049 CopyBytes(relocation_start(),
10044 desc.buffer + desc.buffer_size - desc.reloc_size, 10050 desc.buffer + desc.buffer_size - desc.reloc_size,
10045 static_cast<size_t>(desc.reloc_size)); 10051 static_cast<size_t>(desc.reloc_size));
10046 10052
10047 // unbox handles and relocate 10053 // unbox handles and relocate
10048 intptr_t delta = instruction_start() - desc.buffer; 10054 intptr_t delta = instruction_start() - desc.buffer;
10049 int mode_mask = RelocInfo::kCodeTargetMask | 10055 int mode_mask = RelocInfo::kCodeTargetMask |
10050 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 10056 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
10051 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | 10057 RelocInfo::ModeMask(RelocInfo::CELL) |
10052 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | 10058 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) |
10053 RelocInfo::kApplyMask; 10059 RelocInfo::kApplyMask;
10054 // Needed to find target_object and runtime_entry on X64 10060 // Needed to find target_object and runtime_entry on X64
10055 Assembler* origin = desc.origin; 10061 Assembler* origin = desc.origin;
10056 AllowDeferredHandleDereference embedding_raw_address; 10062 AllowDeferredHandleDereference embedding_raw_address;
10057 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 10063 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
10058 RelocInfo::Mode mode = it.rinfo()->rmode(); 10064 RelocInfo::Mode mode = it.rinfo()->rmode();
10059 if (mode == RelocInfo::EMBEDDED_OBJECT) { 10065 if (mode == RelocInfo::EMBEDDED_OBJECT) {
10060 Handle<Object> p = it.rinfo()->target_object_handle(origin); 10066 Handle<Object> p = it.rinfo()->target_object_handle(origin);
10061 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); 10067 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER);
10062 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 10068 } else if (mode == RelocInfo::CELL) {
10063 Handle<JSGlobalPropertyCell> cell = it.rinfo()->target_cell_handle(); 10069 Handle<Cell> cell = it.rinfo()->target_cell_handle();
10064 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); 10070 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER);
10065 } else if (RelocInfo::IsCodeTarget(mode)) { 10071 } else if (RelocInfo::IsCodeTarget(mode)) {
10066 // rewrite code handles in inline cache targets to direct 10072 // rewrite code handles in inline cache targets to direct
10067 // pointers to the first instruction in the code object 10073 // pointers to the first instruction in the code object
10068 Handle<Object> p = it.rinfo()->target_object_handle(origin); 10074 Handle<Object> p = it.rinfo()->target_object_handle(origin);
10069 Code* code = Code::cast(*p); 10075 Code* code = Code::cast(*p);
10070 it.rinfo()->set_target_address(code->instruction_start(), 10076 it.rinfo()->set_target_address(code->instruction_start(),
10071 SKIP_WRITE_BARRIER); 10077 SKIP_WRITE_BARRIER);
10072 } else if (RelocInfo::IsRuntimeEntry(mode)) { 10078 } else if (RelocInfo::IsRuntimeEntry(mode)) {
10073 Address p = it.rinfo()->target_runtime_entry(origin); 10079 Address p = it.rinfo()->target_runtime_entry(origin);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
10239 } 10245 }
10240 10246
10241 10247
10242 void Code::ClearTypeFeedbackCells(Heap* heap) { 10248 void Code::ClearTypeFeedbackCells(Heap* heap) {
10243 if (kind() != FUNCTION) return; 10249 if (kind() != FUNCTION) return;
10244 Object* raw_info = type_feedback_info(); 10250 Object* raw_info = type_feedback_info();
10245 if (raw_info->IsTypeFeedbackInfo()) { 10251 if (raw_info->IsTypeFeedbackInfo()) {
10246 TypeFeedbackCells* type_feedback_cells = 10252 TypeFeedbackCells* type_feedback_cells =
10247 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells(); 10253 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells();
10248 for (int i = 0; i < type_feedback_cells->CellCount(); i++) { 10254 for (int i = 0; i < type_feedback_cells->CellCount(); i++) {
10249 JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i); 10255 Cell* cell = type_feedback_cells->GetCell(i);
10250 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap)); 10256 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap));
10251 } 10257 }
10252 } 10258 }
10253 } 10259 }
10254 10260
10255 10261
10256 bool Code::allowed_in_shared_map_code_cache() { 10262 bool Code::allowed_in_shared_map_code_cache() {
10257 return is_keyed_load_stub() || is_keyed_store_stub() || 10263 return is_keyed_load_stub() || is_keyed_store_stub() ||
10258 (is_compare_ic_stub() && 10264 (is_compare_ic_stub() &&
10259 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); 10265 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT);
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
12313 if (FLAG_trace_track_allocation_sites) { 12319 if (FLAG_trace_track_allocation_sites) {
12314 PrintF( 12320 PrintF(
12315 "AllocationSiteInfo: JSArray %p boilerplate updated %s->%s\n", 12321 "AllocationSiteInfo: JSArray %p boilerplate updated %s->%s\n",
12316 reinterpret_cast<void*>(this), 12322 reinterpret_cast<void*>(this),
12317 ElementsKindToString(kind), 12323 ElementsKindToString(kind),
12318 ElementsKindToString(to_kind)); 12324 ElementsKindToString(to_kind));
12319 } 12325 }
12320 return payload->TransitionElementsKind(to_kind); 12326 return payload->TransitionElementsKind(to_kind);
12321 } 12327 }
12322 } 12328 }
12323 } else if (info->payload()->IsJSGlobalPropertyCell()) { 12329 } else if (info->payload()->IsCell()) {
12324 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(info->payload()); 12330 Cell* cell = Cell::cast(info->payload());
12325 Object* cell_contents = cell->value(); 12331 Object* cell_contents = cell->value();
12326 if (cell_contents->IsSmi()) { 12332 if (cell_contents->IsSmi()) {
12327 ElementsKind kind = static_cast<ElementsKind>( 12333 ElementsKind kind = static_cast<ElementsKind>(
12328 Smi::cast(cell_contents)->value()); 12334 Smi::cast(cell_contents)->value());
12329 if (AllocationSiteInfo::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) { 12335 if (AllocationSiteInfo::GetMode(kind, to_kind) == TRACK_ALLOCATION_SITE) {
12330 if (FLAG_trace_track_allocation_sites) { 12336 if (FLAG_trace_track_allocation_sites) {
12331 PrintF("AllocationSiteInfo: JSArray %p info updated %s->%s\n", 12337 PrintF("AllocationSiteInfo: JSArray %p info updated %s->%s\n",
12332 reinterpret_cast<void*>(this), 12338 reinterpret_cast<void*>(this),
12333 ElementsKindToString(kind), 12339 ElementsKindToString(kind),
12334 ElementsKindToString(to_kind)); 12340 ElementsKindToString(to_kind));
(...skipping 3452 matching lines...) Expand 10 before | Expand all | Expand 10 after
15787 } 15793 }
15788 15794
15789 15795
15790 void JSTypedArray::Neuter() { 15796 void JSTypedArray::Neuter() {
15791 set_byte_offset(Smi::FromInt(0)); 15797 set_byte_offset(Smi::FromInt(0));
15792 set_byte_length(Smi::FromInt(0)); 15798 set_byte_length(Smi::FromInt(0));
15793 set_length(Smi::FromInt(0)); 15799 set_length(Smi::FromInt(0));
15794 set_elements(GetHeap()->EmptyExternalArrayForMap(map())); 15800 set_elements(GetHeap()->EmptyExternalArrayForMap(map()));
15795 } 15801 }
15796 15802
15803
15804 Type* JSGlobalPropertyCell::type() {
15805 return static_cast<Type*>(type_raw());
15806 }
15807
15808
15809 void JSGlobalPropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
15810 set_type_raw(type, ignored);
15811 }
15812
15813
15797 } } // namespace v8::internal 15814 } } // namespace v8::internal
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