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

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

Issue 3301008: [Isolates] Add heap pointer to all maps and use map->heap() more. (Closed)
Patch Set: even more Created 10 years, 3 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 } 1065 }
1066 #endif 1066 #endif
1067 1067
1068 1068
1069 Heap* HeapObject::GetHeap() { 1069 Heap* HeapObject::GetHeap() {
1070 // During GC, the map pointer in HeapObject is used in various ways that 1070 // During GC, the map pointer in HeapObject is used in various ways that
1071 // prevent us from retrieving Heap from the map. 1071 // prevent us from retrieving Heap from the map.
1072 // Assert that we are not in GC, implement GC code in a way that it doesn't 1072 // Assert that we are not in GC, implement GC code in a way that it doesn't
1073 // pull heap from the map. 1073 // pull heap from the map.
1074 ASSERT(HEAP->is_safe_to_read_maps()); 1074 ASSERT(HEAP->is_safe_to_read_maps());
1075 return map()->map()->heap(); 1075 return map()->heap();
1076 } 1076 }
1077 1077
1078 1078
1079 Map* HeapObject::map() { 1079 Map* HeapObject::map() {
1080 return map_word().ToMap(); 1080 return map_word().ToMap();
1081 } 1081 }
1082 1082
1083 1083
1084 void HeapObject::set_map(Map* value) { 1084 void HeapObject::set_map(Map* value) {
1085 set_map_word(MapWord::FromMap(value)); 1085 set_map_word(MapWord::FromMap(value));
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 // GetCodeFromTargetAddress might be called when marking objects during mark 2468 // GetCodeFromTargetAddress might be called when marking objects during mark
2469 // sweep. reinterpret_cast is therefore used instead of the more appropriate 2469 // sweep. reinterpret_cast is therefore used instead of the more appropriate
2470 // Code::cast. Code::cast does not work when the object's map is 2470 // Code::cast. Code::cast does not work when the object's map is
2471 // marked. 2471 // marked.
2472 Code* result = reinterpret_cast<Code*>(code); 2472 Code* result = reinterpret_cast<Code*>(code);
2473 return result; 2473 return result;
2474 } 2474 }
2475 2475
2476 2476
2477 Heap* Map::heap() { 2477 Heap* Map::heap() {
2478 ASSERT(instance_type() == MAP_TYPE);
2479 ASSERT(this == map());
2480 Heap* heap = reinterpret_cast<Heap*>(READ_INTPTR_FIELD(this, kHeapOffset)); 2478 Heap* heap = reinterpret_cast<Heap*>(READ_INTPTR_FIELD(this, kHeapOffset));
2481 ASSERT(heap != NULL); 2479 ASSERT(heap != NULL);
2482 ASSERT(heap->isolate() == Isolate::Current()); 2480 ASSERT(heap->isolate() == Isolate::Current());
2483 return heap; 2481 return heap;
2484 } 2482 }
2485 2483
2486 2484
2487 void Map::set_heap(Heap* heap) { 2485 void Map::set_heap(Heap* heap) {
2488 ASSERT(heap != NULL); 2486 ASSERT(heap != NULL);
2489 ASSERT(heap->isolate() == Isolate::Current()); 2487 ASSERT(heap->isolate() == Isolate::Current());
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 #undef WRITE_INT_FIELD 3560 #undef WRITE_INT_FIELD
3563 #undef READ_SHORT_FIELD 3561 #undef READ_SHORT_FIELD
3564 #undef WRITE_SHORT_FIELD 3562 #undef WRITE_SHORT_FIELD
3565 #undef READ_BYTE_FIELD 3563 #undef READ_BYTE_FIELD
3566 #undef WRITE_BYTE_FIELD 3564 #undef WRITE_BYTE_FIELD
3567 3565
3568 3566
3569 } } // namespace v8::internal 3567 } } // namespace v8::internal
3570 3568
3571 #endif // V8_OBJECTS_INL_H_ 3569 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/mark-compact.cc ('K') | « src/mark-compact.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698