From 25cfc5dc2956303856e9704ace0abe88c6b98a3a Mon Sep 17 00:00:00 2001 From: yangguo Date: Wed, 10 Dec 2014 06:55:51 -0800 Subject: [PATCH] Disallow object/function templates when creating snapshots. R=vogelheim@chromium.org Review URL: https://codereview.chromium.org/791033002 Cr-Commit-Position: refs/heads/master@{#25749} --- src/api.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api.cc b/src/api.cc index afe5f1b..cf3cda3 100644 --- a/src/api.cc +++ b/src/api.cc @@ -802,6 +802,9 @@ Local FunctionTemplate::New( v8::Handle signature, int length) { i::Isolate* i_isolate = reinterpret_cast(isolate); + // Changes to the environment cannot be captured in the snapshot. Expect no + // function templates when the isolate is created for serialization. + DCHECK(!i_isolate->serializer_enabled()); LOG_API(i_isolate, "FunctionTemplate::New"); ENTER_V8(i_isolate); return FunctionTemplateNew( @@ -1141,6 +1144,9 @@ Local ObjectTemplate::New() { Local ObjectTemplate::New( i::Isolate* isolate, v8::Handle constructor) { + // Changes to the environment cannot be captured in the snapshot. Expect no + // object templates when the isolate is created for serialization. + DCHECK(!isolate->serializer_enabled()); LOG_API(isolate, "ObjectTemplate::New"); ENTER_V8(isolate); i::Handle struct_obj = -- 2.7.4