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

Side by Side Diff: src/mark-compact.cc

Issue 117483002: Make cells pointing to JSObjects weak in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Handle cells that are saved as embedded objects in reloc info. Created 6 years, 11 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void VisitEmbeddedPointer(RelocInfo* rinfo) { 92 void VisitEmbeddedPointer(RelocInfo* rinfo) {
93 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); 93 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
94 if (!Code::IsWeakEmbeddedObject(rinfo->host()->kind(), 94 if (!Code::IsWeakEmbeddedObject(rinfo->host()->kind(),
95 rinfo->target_object())) { 95 rinfo->target_object())) {
96 Object* p = rinfo->target_object(); 96 Object* p = rinfo->target_object();
97 VisitPointer(&p); 97 VisitPointer(&p);
98 } 98 }
99 } 99 }
100 100
101 void VisitCell(RelocInfo* rinfo) {
102 Code* code = rinfo->host();
103 ASSERT(rinfo->rmode() == RelocInfo::CELL);
104 if (!Code::IsWeakEmbeddedObject(code->kind(), rinfo->target_cell())) {
105 ObjectVisitor::VisitCell(rinfo);
106 }
107 }
108
101 private: 109 private:
102 Heap* heap_; 110 Heap* heap_;
103 }; 111 };
104 112
105 113
106 static void VerifyMarking(Heap* heap, Address bottom, Address top) { 114 static void VerifyMarking(Heap* heap, Address bottom, Address top) {
107 VerifyMarkingVisitor visitor(heap); 115 VerifyMarkingVisitor visitor(heap);
108 HeapObject* object; 116 HeapObject* object;
109 Address next_object_must_be_here_or_later = bottom; 117 Address next_object_must_be_here_or_later = bottom;
110 118
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 if (heap_->weak_object_to_code_table()->IsHashTable()) { 2552 if (heap_->weak_object_to_code_table()->IsHashTable()) {
2545 WeakHashTable* table = 2553 WeakHashTable* table =
2546 WeakHashTable::cast(heap_->weak_object_to_code_table()); 2554 WeakHashTable::cast(heap_->weak_object_to_code_table());
2547 uint32_t capacity = table->Capacity(); 2555 uint32_t capacity = table->Capacity();
2548 for (uint32_t i = 0; i < capacity; i++) { 2556 for (uint32_t i = 0; i < capacity; i++) {
2549 uint32_t key_index = table->EntryToIndex(i); 2557 uint32_t key_index = table->EntryToIndex(i);
2550 Object* key = table->get(key_index); 2558 Object* key = table->get(key_index);
2551 if (!table->IsKey(key)) continue; 2559 if (!table->IsKey(key)) continue;
2552 uint32_t value_index = table->EntryToValueIndex(i); 2560 uint32_t value_index = table->EntryToValueIndex(i);
2553 Object* value = table->get(value_index); 2561 Object* value = table->get(value_index);
2562 if (key->IsCell() && !IsMarked(key)) {
2563 Cell* cell = Cell::cast(key);
2564 Object* object = cell->value();
2565 if (IsMarked(object)) {
2566 MarkBit mark = Marking::MarkBitFrom(cell);
2567 SetMark(cell, mark);
2568 Object** value_slot = HeapObject::RawField(cell, Cell::kValueOffset);
2569 RecordSlot(value_slot, value_slot, *value_slot);
2570 }
2571 }
2554 if (IsMarked(key)) { 2572 if (IsMarked(key)) {
2555 if (!IsMarked(value)) { 2573 if (!IsMarked(value)) {
2556 HeapObject* obj = HeapObject::cast(value); 2574 HeapObject* obj = HeapObject::cast(value);
2557 MarkBit mark = Marking::MarkBitFrom(obj); 2575 MarkBit mark = Marking::MarkBitFrom(obj);
2558 SetMark(obj, mark); 2576 SetMark(obj, mark);
2559 } 2577 }
2560 ClearNonLiveDependentCode(DependentCode::cast(value)); 2578 ClearNonLiveDependentCode(DependentCode::cast(value));
2561 } else { 2579 } else {
2562 ClearAndDeoptimizeDependentCode(DependentCode::cast(value)); 2580 ClearAndDeoptimizeDependentCode(DependentCode::cast(value));
2563 table->set(key_index, heap_->the_hole_value()); 2581 table->set(key_index, heap_->the_hole_value());
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
4351 while (buffer != NULL) { 4369 while (buffer != NULL) {
4352 SlotsBuffer* next_buffer = buffer->next(); 4370 SlotsBuffer* next_buffer = buffer->next();
4353 DeallocateBuffer(buffer); 4371 DeallocateBuffer(buffer);
4354 buffer = next_buffer; 4372 buffer = next_buffer;
4355 } 4373 }
4356 *buffer_address = NULL; 4374 *buffer_address = NULL;
4357 } 4375 }
4358 4376
4359 4377
4360 } } // namespace v8::internal 4378 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lithium-codegen.cc ('k') | src/objects.cc » ('j') | test/cctest/test-heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698