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

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: Created 7 years 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 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 if (heap_->weak_object_to_code_table()->IsHashTable()) { 2565 if (heap_->weak_object_to_code_table()->IsHashTable()) {
2558 WeakHashTable* table = 2566 WeakHashTable* table =
2559 WeakHashTable::cast(heap_->weak_object_to_code_table()); 2567 WeakHashTable::cast(heap_->weak_object_to_code_table());
2560 uint32_t capacity = table->Capacity(); 2568 uint32_t capacity = table->Capacity();
2561 for (uint32_t i = 0; i < capacity; i++) { 2569 for (uint32_t i = 0; i < capacity; i++) {
2562 uint32_t key_index = table->EntryToIndex(i); 2570 uint32_t key_index = table->EntryToIndex(i);
2563 Object* key = table->get(key_index); 2571 Object* key = table->get(key_index);
2564 if (!table->IsKey(key)) continue; 2572 if (!table->IsKey(key)) continue;
2565 uint32_t value_index = table->EntryToValueIndex(i); 2573 uint32_t value_index = table->EntryToValueIndex(i);
2566 Object* value = table->get(value_index); 2574 Object* value = table->get(value_index);
2575 if (key->IsCell() && !IsMarked(key)) {
2576 Cell* cell = Cell::cast(key);
2577 Object* object = cell->value();
2578 if (IsMarked(object)) {
2579 MarkBit mark = Marking::MarkBitFrom(cell);
2580 SetMark(cell, mark);
2581 Object** value_slot = HeapObject::RawField(cell, Cell::kValueOffset);
2582 RecordSlot(value_slot, value_slot, *value_slot);
2583 }
2584 }
2567 if (IsMarked(key)) { 2585 if (IsMarked(key)) {
2568 if (!IsMarked(value)) { 2586 if (!IsMarked(value)) {
2569 HeapObject* obj = HeapObject::cast(value); 2587 HeapObject* obj = HeapObject::cast(value);
2570 MarkBit mark = Marking::MarkBitFrom(obj); 2588 MarkBit mark = Marking::MarkBitFrom(obj);
2571 SetMark(obj, mark); 2589 SetMark(obj, mark);
2572 } 2590 }
2573 ClearNonLiveDependentCode(DependentCode::cast(value)); 2591 ClearNonLiveDependentCode(DependentCode::cast(value));
2574 } else { 2592 } else {
2575 ClearAndDeoptimizeDependentCode(DependentCode::cast(value)); 2593 ClearAndDeoptimizeDependentCode(DependentCode::cast(value));
2576 table->set(key_index, heap_->the_hole_value()); 2594 table->set(key_index, heap_->the_hole_value());
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
4361 while (buffer != NULL) { 4379 while (buffer != NULL) {
4362 SlotsBuffer* next_buffer = buffer->next(); 4380 SlotsBuffer* next_buffer = buffer->next();
4363 DeallocateBuffer(buffer); 4381 DeallocateBuffer(buffer);
4364 buffer = next_buffer; 4382 buffer = next_buffer;
4365 } 4383 }
4366 *buffer_address = NULL; 4384 *buffer_address = NULL;
4367 } 4385 }
4368 4386
4369 4387
4370 } } // namespace v8::internal 4388 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698