Snapshot clean ups

- Don't call eval() in mock_runtime - not allowed - see js2c.py.
- Don't use v8_use_external_startup_data
- Move MakeSnapshot to snapshot_creator.cc
- Use logging.h in from_snapshot.cc
This commit is contained in:
Ryan Dahl 2018-06-18 16:02:08 +02:00
parent 064d889af0
commit cc2ae2d316
9 changed files with 56 additions and 97 deletions

View file

@ -44,16 +44,18 @@ class StartupDataCppWriter {
void WritePrefix() {
file_ << "// Autogenerated snapshot file. Do not edit.\n\n";
file_ << "#include \"v8/include/v8.h\"\n\n";
file_ << "namespace deno { \n\n";
}
void WriteSuffix() {
char buffer[500];
snprintf(buffer, sizeof(buffer),
"const v8::StartupData* StartupBlob_%s() {\n", name_);
snprintf(buffer, sizeof(buffer), "v8::StartupData* StartupBlob_%s() {\n",
name_);
file_ << buffer;
snprintf(buffer, sizeof(buffer), " return &%s_blob;\n", name_);
file_ << buffer;
file_ << "}\n\n";
file_ << "} // namespace deno\n\n";
}
void WriteBinaryContentsAsCArray() {
@ -78,7 +80,7 @@ class StartupDataCppWriter {
snprintf(buffer, sizeof(buffer), "static const int %s_blob_size = %llu;\n",
name_, static_cast<unsigned long long>(data_.size()));
file_ << buffer;
snprintf(buffer, sizeof(buffer), "static const v8::StartupData %s_blob =\n",
snprintf(buffer, sizeof(buffer), "static v8::StartupData %s_blob =\n",
name_);
file_ << buffer;
snprintf(buffer, sizeof(buffer),