Chromium Code Reviews

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: update multiplier for mips64 Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 3ad5a64f594b0b90aae0fd0e257216970d63fafe..d3de8cf417272c7684f8e59d86e59a9f9cc69a1b 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);
}

Powered by Google App Engine