OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The common functionality when building with or without snapshots. | 5 // The common functionality when building with or without snapshots. |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/serialize.h" | 10 #include "src/serialize.h" |
11 #include "src/snapshot.h" | 11 #include "src/snapshot.h" |
12 #include "src/platform.h" | 12 #include "src/platform.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 | 17 |
18 static void ReserveSpaceForSnapshot(Deserializer* deserializer, | 18 static void ReserveSpaceForSnapshot(Deserializer* deserializer, |
19 const char* file_name) { | 19 const char* file_name) { |
20 int file_name_length = StrLength(file_name) + 10; | 20 int file_name_length = StrLength(file_name) + 10; |
21 Vector<char> name = Vector<char>::New(file_name_length + 1); | 21 Vector<char> name = Vector<char>::New(file_name_length + 1); |
22 OS::SNPrintF(name, "%s.size", file_name); | 22 SNPrintF(name, "%s.size", file_name); |
23 FILE* fp = OS::FOpen(name.start(), "r"); | 23 FILE* fp = OS::FOpen(name.start(), "r"); |
24 CHECK_NE(NULL, fp); | 24 CHECK_NE(NULL, fp); |
25 int new_size, pointer_size, data_size, code_size, map_size, cell_size, | 25 int new_size, pointer_size, data_size, code_size, map_size, cell_size, |
26 property_cell_size; | 26 property_cell_size; |
27 #ifdef _MSC_VER | 27 #ifdef _MSC_VER |
28 // Avoid warning about unsafe fscanf from MSVC. | 28 // Avoid warning about unsafe fscanf from MSVC. |
29 // Please note that this is only fine if %c and %s are not being used. | 29 // Please note that this is only fine if %c and %s are not being used. |
30 #define fscanf fscanf_s | 30 #define fscanf fscanf_s |
31 #endif | 31 #endif |
32 CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size)); | 32 CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); | 117 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); |
118 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); | 118 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); |
119 deserializer.set_reservation(PROPERTY_CELL_SPACE, | 119 deserializer.set_reservation(PROPERTY_CELL_SPACE, |
120 context_property_cell_space_used_); | 120 context_property_cell_space_used_); |
121 deserializer.DeserializePartial(isolate, &root); | 121 deserializer.DeserializePartial(isolate, &root); |
122 CHECK(root->IsContext()); | 122 CHECK(root->IsContext()); |
123 return Handle<Context>(Context::cast(root)); | 123 return Handle<Context>(Context::cast(root)); |
124 } | 124 } |
125 | 125 |
126 } } // namespace v8::internal | 126 } } // namespace v8::internal |
OLD | NEW |