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

Side by Side Diff: src/objects-inl.h

Issue 882913006: Make functions contexts in optimized code weak. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/lithium.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 5216 matching lines...) Expand 10 before | Expand all | Expand 10 after
5227 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize); 5227 FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
5228 } 5228 }
5229 5229
5230 5230
5231 bool Code::IsWeakObjectInOptimizedCode(Object* object) { 5231 bool Code::IsWeakObjectInOptimizedCode(Object* object) {
5232 if (!FLAG_collect_maps) return false; 5232 if (!FLAG_collect_maps) return false;
5233 if (object->IsMap()) { 5233 if (object->IsMap()) {
5234 return Map::cast(object)->CanTransition() && 5234 return Map::cast(object)->CanTransition() &&
5235 FLAG_weak_embedded_maps_in_optimized_code; 5235 FLAG_weak_embedded_maps_in_optimized_code;
5236 } 5236 }
5237 if (object->IsJSObject() || 5237 if (object->IsCell()) object = Cell::cast(object)->value();
5238 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { 5238 if (object->IsJSObject()) {
5239 return FLAG_weak_embedded_objects_in_optimized_code; 5239 return FLAG_weak_embedded_objects_in_optimized_code;
5240 } 5240 }
5241 if (object->IsFixedArray()) {
5242 // Contexts of inlined functions are embedded in optimized code.
5243 Map* map = HeapObject::cast(object)->map();
5244 Heap* heap = map->GetHeap();
5245 return FLAG_weak_embedded_objects_in_optimized_code &&
5246 map == heap->function_context_map();
5247 }
5241 return false; 5248 return false;
5242 } 5249 }
5243 5250
5244 5251
5245 class Code::FindAndReplacePattern { 5252 class Code::FindAndReplacePattern {
5246 public: 5253 public:
5247 FindAndReplacePattern() : count_(0) { } 5254 FindAndReplacePattern() : count_(0) { }
5248 void Add(Handle<Map> map_to_find, Handle<Object> obj_to_replace) { 5255 void Add(Handle<Map> map_to_find, Handle<Object> obj_to_replace) {
5249 DCHECK(count_ < kMaxCount); 5256 DCHECK(count_ < kMaxCount);
5250 find_[count_] = map_to_find; 5257 find_[count_] = map_to_find;
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
7601 #undef READ_SHORT_FIELD 7608 #undef READ_SHORT_FIELD
7602 #undef WRITE_SHORT_FIELD 7609 #undef WRITE_SHORT_FIELD
7603 #undef READ_BYTE_FIELD 7610 #undef READ_BYTE_FIELD
7604 #undef WRITE_BYTE_FIELD 7611 #undef WRITE_BYTE_FIELD
7605 #undef NOBARRIER_READ_BYTE_FIELD 7612 #undef NOBARRIER_READ_BYTE_FIELD
7606 #undef NOBARRIER_WRITE_BYTE_FIELD 7613 #undef NOBARRIER_WRITE_BYTE_FIELD
7607 7614
7608 } } // namespace v8::internal 7615 } } // namespace v8::internal
7609 7616
7610 #endif // V8_OBJECTS_INL_H_ 7617 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/lithium.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698