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

Unified Diff: src/api.cc

Issue 876613002: Only use FreeSpace objects in the free list. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0b0ab03bbf1cf90ad60a2e0109a7066f591477d2..8ddd351f9e32067f14a6edffe5076f177a6924d9 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -27,6 +27,7 @@
#include "src/debug.h"
#include "src/deoptimizer.h"
#include "src/execution.h"
+#include "src/full-codegen.h"
#include "src/global-handles.h"
#include "src/heap-profiler.h"
#include "src/heap-snapshot-generator-inl.h"
@@ -220,6 +221,54 @@ bool RunExtraCode(Isolate* isolate, char* utf8_source) {
}
+void CheckDefaultReservationSizes(const i::StartupSerializer& startup_ser,
+ const i::PartialSerializer& context_ser) {
+#ifdef DEBUG
+ i::List<i::SerializedData::Reservation> startup_reservations;
+ i::List<i::SerializedData::Reservation> context_reservations;
+ startup_ser.EncodeReservations(&startup_reservations);
+ context_ser.EncodeReservations(&context_reservations);
+ for (int space = 0; space < i::Serializer::kNumberOfSpaces; space++) {
+ // Exactly one chunk per space.
+ CHECK(startup_reservations[space].is_last());
+ CHECK(startup_reservations[space].is_last());
+ uint32_t sum = startup_reservations[space].chunk_size() +
+ context_reservations[space].chunk_size();
+ uint32_t limit = 0;
+ const int constant_pool_delta = i::FLAG_enable_ool_constant_pool ? 48 : 0;
+ switch (space) {
+ case i::NEW_SPACE:
+ limit = 3 * i::kPointerSize;
+ break;
+ case i::OLD_POINTER_SPACE:
+ limit = (128 + constant_pool_delta) * i::kPointerSize * i::KB;
+ break;
+ case i::OLD_DATA_SPACE:
+ limit = 192 * i::KB;
+ break;
+ case i::MAP_SPACE:
+ limit = 16 * i::kPointerSize * i::KB;
+ break;
+ case i::CELL_SPACE:
+ limit = 16 * i::kPointerSize * i::KB;
+ break;
+ case i::PROPERTY_CELL_SPACE:
+ limit = 8 * i::kPointerSize * i::KB;
+ break;
+ case i::CODE_SPACE:
+ limit = RoundUp((480 - constant_pool_delta) * i::KB *
+ i::FullCodeGenerator::kBootCodeSizeMultiplier / 100,
+ i::kPointerSize);
+ break;
+ default:
+ break;
+ }
+ CHECK_LE(sum, limit);
+ }
+#endif // DEBUG
+}
+
+
StartupData V8::CreateSnapshotDataBlob(char* custom_source) {
Isolate::CreateParams params;
params.enable_serializer = true;
@@ -266,6 +315,8 @@ StartupData V8::CreateSnapshotDataBlob(char* custom_source) {
i::SnapshotData sd(snapshot_sink, ser);
i::SnapshotData csd(context_sink, context_ser);
+ if (custom_source == NULL) CheckDefaultReservationSizes(ser, context_ser);
+
result = i::Snapshot::CreateSnapshotBlob(sd.RawData(), csd.RawData(),
metadata);
}
« no previous file with comments | « src/allocation-tracker.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698