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/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: 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 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 10362 matching lines...) Expand 10 before | Expand all | Expand 10 after
10373 } 10373 }
10374 10374
10375 10375
10376 void Code::InvalidateRelocation() { 10376 void Code::InvalidateRelocation() {
10377 set_relocation_info(GetHeap()->empty_byte_array()); 10377 set_relocation_info(GetHeap()->empty_byte_array());
10378 } 10378 }
10379 10379
10380 10380
10381 void Code::InvalidateEmbeddedObjects() { 10381 void Code::InvalidateEmbeddedObjects() {
10382 Object* undefined = GetHeap()->undefined_value(); 10382 Object* undefined = GetHeap()->undefined_value();
10383 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 10383 Cell* undefined_cell = GetHeap()->undefined_cell();
10384 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
10385 RelocInfo::ModeMask(RelocInfo::CELL);
10384 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { 10386 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
10385 RelocInfo::Mode mode = it.rinfo()->rmode(); 10387 RelocInfo::Mode mode = it.rinfo()->rmode();
10386 if (mode == RelocInfo::EMBEDDED_OBJECT) { 10388 if (mode == RelocInfo::EMBEDDED_OBJECT) {
10387 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); 10389 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
10390 } else if (mode == RelocInfo::CELL) {
10391 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER);
10388 } 10392 }
10389 } 10393 }
10390 } 10394 }
10391 10395
10392 10396
10393 void Code::Relocate(intptr_t delta) { 10397 void Code::Relocate(intptr_t delta) {
10394 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { 10398 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
10395 it.rinfo()->apply(delta); 10399 it.rinfo()->apply(delta);
10396 } 10400 }
10397 CPU::FlushICache(instruction_start(), instruction_size()); 10401 CPU::FlushICache(instruction_start(), instruction_size());
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
11312 11316
11313 bool Code::IsWeakEmbeddedObject(Kind kind, Object* object) { 11317 bool Code::IsWeakEmbeddedObject(Kind kind, Object* object) {
11314 if (kind != Code::OPTIMIZED_FUNCTION) return false; 11318 if (kind != Code::OPTIMIZED_FUNCTION) return false;
11315 11319
11316 if (object->IsMap()) { 11320 if (object->IsMap()) {
11317 return Map::cast(object)->CanTransition() && 11321 return Map::cast(object)->CanTransition() &&
11318 FLAG_collect_maps && 11322 FLAG_collect_maps &&
11319 FLAG_weak_embedded_maps_in_optimized_code; 11323 FLAG_weak_embedded_maps_in_optimized_code;
11320 } 11324 }
11321 11325
11322 if (object->IsJSObject()) { 11326 if (object->IsJSObject() ||
11327 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) {
11323 return FLAG_weak_embedded_objects_in_optimized_code; 11328 return FLAG_weak_embedded_objects_in_optimized_code;
11324 } 11329 }
11325 11330
11326 return false; 11331 return false;
11327 } 11332 }
11328 11333
11329 11334
11330 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, 11335 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object,
11331 int capacity, 11336 int capacity,
11332 int length) { 11337 int length) {
(...skipping 5331 matching lines...) Expand 10 before | Expand all | Expand 10 after
16664 #define ERROR_MESSAGES_TEXTS(C, T) T, 16669 #define ERROR_MESSAGES_TEXTS(C, T) T,
16665 static const char* error_messages_[] = { 16670 static const char* error_messages_[] = {
16666 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16671 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16667 }; 16672 };
16668 #undef ERROR_MESSAGES_TEXTS 16673 #undef ERROR_MESSAGES_TEXTS
16669 return error_messages_[reason]; 16674 return error_messages_[reason];
16670 } 16675 }
16671 16676
16672 16677
16673 } } // namespace v8::internal 16678 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698