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

Side by Side Diff: src/objects.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 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 10326 matching lines...) Expand 10 before | Expand all | Expand 10 after
10337 } 10337 }
10338 10338
10339 10339
10340 void Code::InvalidateRelocation() { 10340 void Code::InvalidateRelocation() {
10341 set_relocation_info(GetHeap()->empty_byte_array()); 10341 set_relocation_info(GetHeap()->empty_byte_array());
10342 } 10342 }
10343 10343
10344 10344
10345 void Code::InvalidateEmbeddedObjects() { 10345 void Code::InvalidateEmbeddedObjects() {
10346 Object* undefined = GetHeap()->undefined_value(); 10346 Object* undefined = GetHeap()->undefined_value();
10347 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 10347 Cell* undefined_cell = GetHeap()->undefined_cell();
10348 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
10349 RelocInfo::ModeMask(RelocInfo::CELL);
10348 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 10350 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
10349 RelocInfo::Mode mode = it.rinfo()->rmode(); 10351 RelocInfo::Mode mode = it.rinfo()->rmode();
10350 if (mode == RelocInfo::EMBEDDED_OBJECT) { 10352 if (mode == RelocInfo::EMBEDDED_OBJECT) {
10351 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); 10353 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
10354 } else if (mode == RelocInfo::CELL) {
10355 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER);
10352 } 10356 }
10353 } 10357 }
10354 } 10358 }
10355 10359
10356 10360
10357 void Code::Relocate(intptr_t delta) { 10361 void Code::Relocate(intptr_t delta) {
10358 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 10362 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
10359 it.rinfo()->apply(delta); 10363 it.rinfo()->apply(delta);
10360 } 10364 }
10361 CPU::FlushICache(instruction_start(), instruction_size()); 10365 CPU::FlushICache(instruction_start(), instruction_size());
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
11303 11307
11304 bool Code::IsWeakEmbeddedObject(Kind kind, Object* object) { 11308 bool Code::IsWeakEmbeddedObject(Kind kind, Object* object) {
11305 if (kind != Code::OPTIMIZED_FUNCTION) return false; 11309 if (kind != Code::OPTIMIZED_FUNCTION) return false;
11306 11310
11307 if (object->IsMap()) { 11311 if (object->IsMap()) {
11308 return Map::cast(object)->CanTransition() && 11312 return Map::cast(object)->CanTransition() &&
11309 FLAG_collect_maps && 11313 FLAG_collect_maps &&
11310 FLAG_weak_embedded_maps_in_optimized_code; 11314 FLAG_weak_embedded_maps_in_optimized_code;
11311 } 11315 }
11312 11316
11313 if (object->IsJSObject()) { 11317 if (object->IsJSObject() ||
11318 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) {
11314 return FLAG_weak_embedded_objects_in_optimized_code; 11319 return FLAG_weak_embedded_objects_in_optimized_code;
11315 } 11320 }
11316 11321
11317 return false; 11322 return false;
11318 } 11323 }
11319 11324
11320 11325
11321 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, 11326 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object,
11322 int capacity, 11327 int capacity,
11323 int length) { 11328 int length) {
(...skipping 5351 matching lines...) Expand 10 before | Expand all | Expand 10 after
16675 #define ERROR_MESSAGES_TEXTS(C, T) T, 16680 #define ERROR_MESSAGES_TEXTS(C, T) T,
16676 static const char* error_messages_[] = { 16681 static const char* error_messages_[] = {
16677 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16682 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16678 }; 16683 };
16679 #undef ERROR_MESSAGES_TEXTS 16684 #undef ERROR_MESSAGES_TEXTS
16680 return error_messages_[reason]; 16685 return error_messages_[reason];
16681 } 16686 }
16682 16687
16683 16688
16684 } } // namespace v8::internal 16689 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects-visiting-inl.h » ('j') | test/cctest/test-heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698