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

Side by Side Diff: Source/platform/heap/Heap.h

Issue 1237063002: Allocate XMLHttpRequest on the eagerly finalized heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add macro for testing eager finalization Created 5 years, 5 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 | « Source/core/xmlhttprequest/XMLHttpRequest.cpp ('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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 return index >= ThreadState::NormalPage1HeapIndex && index <= ThreadState::N ormalPage4HeapIndex; 1172 return index >= ThreadState::NormalPage1HeapIndex && index <= ThreadState::N ormalPage4HeapIndex;
1173 } 1173 }
1174 1174
1175 #define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \ 1175 #define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \
1176 public: \ 1176 public: \
1177 GC_PLUGIN_IGNORE("491488") \ 1177 GC_PLUGIN_IGNORE("491488") \
1178 void* operator new(size_t size) \ 1178 void* operator new(size_t size) \
1179 { \ 1179 { \
1180 return allocateObject(size, true); \ 1180 return allocateObject(size, true); \
1181 } 1181 }
1182
1183 #define IS_EAGERLY_FINALIZED() (pageFromObject(this)->heap()->heapIndex() == Thr eadState::EagerSweepHeapIndex)
1182 #if ENABLE(ASSERT) && ENABLE(OILPAN) 1184 #if ENABLE(ASSERT) && ENABLE(OILPAN)
1183 class VerifyEagerFinalization { 1185 class VerifyEagerFinalization {
1184 public: 1186 public:
1185 ~VerifyEagerFinalization() 1187 ~VerifyEagerFinalization()
1186 { 1188 {
1187 // If this assert triggers, the class annotated as eagerly 1189 // If this assert triggers, the class annotated as eagerly
1188 // finalized ended up not being allocated on the heap 1190 // finalized ended up not being allocated on the heap
1189 // set aside for eager finalization. The reason is most 1191 // set aside for eager finalization. The reason is most
1190 // likely that the effective 'operator new' overload for 1192 // likely that the effective 'operator new' overload for
1191 // this class' leftmost base is for a class that is not 1193 // this class' leftmost base is for a class that is not
1192 // eagerly finalized. Declaring and defining an 'operator new' 1194 // eagerly finalized. Declaring and defining an 'operator new'
1193 // for this class is what's required -- consider using 1195 // for this class is what's required -- consider using
1194 // DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(). 1196 // DECLARE_EAGER_FINALIZATION_OPERATOR_NEW().
1195 ASSERT(pageFromObject(this)->heap()->heapIndex() == ThreadState::EagerSw eepHeapIndex); 1197 ASSERT(IS_EAGERLY_FINALIZED());
1196 } 1198 }
1197 }; 1199 };
1198 #define EAGERLY_FINALIZE() \ 1200 #define EAGERLY_FINALIZE() \
1199 private: \ 1201 private: \
1200 VerifyEagerFinalization m_verifyEagerFinalization; \ 1202 VerifyEagerFinalization m_verifyEagerFinalization; \
1201 public: \ 1203 public: \
1202 typedef int IsEagerlyFinalizedMarker 1204 typedef int IsEagerlyFinalizedMarker
1203 #else 1205 #else
1204 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker 1206 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker
1205 #endif 1207 #endif
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 size_t copySize = previousHeader->payloadSize(); 1380 size_t copySize = previousHeader->payloadSize();
1379 if (copySize > size) 1381 if (copySize > size)
1380 copySize = size; 1382 copySize = size;
1381 memcpy(address, previous, copySize); 1383 memcpy(address, previous, copySize);
1382 return address; 1384 return address;
1383 } 1385 }
1384 1386
1385 } // namespace blink 1387 } // namespace blink
1386 1388
1387 #endif // Heap_h 1389 #endif // Heap_h
OLDNEW
« no previous file with comments | « Source/core/xmlhttprequest/XMLHttpRequest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698