OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 static void ReserveSpaceForSnapshot(Deserializer* deserializer, | 239 static void ReserveSpaceForSnapshot(Deserializer* deserializer, |
240 const char* file_name) { | 240 const char* file_name) { |
241 int file_name_length = StrLength(file_name) + 10; | 241 int file_name_length = StrLength(file_name) + 10; |
242 Vector<char> name = Vector<char>::New(file_name_length + 1); | 242 Vector<char> name = Vector<char>::New(file_name_length + 1); |
243 SNPrintF(name, "%s.size", file_name); | 243 SNPrintF(name, "%s.size", file_name); |
244 FILE* fp = v8::base::OS::FOpen(name.start(), "r"); | 244 FILE* fp = v8::base::OS::FOpen(name.start(), "r"); |
245 name.Dispose(); | 245 name.Dispose(); |
246 int new_size, pointer_size, data_size, code_size, map_size, cell_size, | 246 int new_size, pointer_size, data_size, code_size, map_size, cell_size, |
247 property_cell_size, lo_size; | 247 property_cell_size, lo_size; |
248 #ifdef _MSC_VER | 248 #if V8_CC_MSVC |
249 // Avoid warning about unsafe fscanf from MSVC. | 249 // Avoid warning about unsafe fscanf from MSVC. |
250 // Please note that this is only fine if %c and %s are not being used. | 250 // Please note that this is only fine if %c and %s are not being used. |
251 #define fscanf fscanf_s | 251 #define fscanf fscanf_s |
252 #endif | 252 #endif |
253 CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size)); | 253 CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size)); |
254 CHECK_EQ(1, fscanf(fp, "pointer %d\n", &pointer_size)); | 254 CHECK_EQ(1, fscanf(fp, "pointer %d\n", &pointer_size)); |
255 CHECK_EQ(1, fscanf(fp, "data %d\n", &data_size)); | 255 CHECK_EQ(1, fscanf(fp, "data %d\n", &data_size)); |
256 CHECK_EQ(1, fscanf(fp, "code %d\n", &code_size)); | 256 CHECK_EQ(1, fscanf(fp, "code %d\n", &code_size)); |
257 CHECK_EQ(1, fscanf(fp, "map %d\n", &map_size)); | 257 CHECK_EQ(1, fscanf(fp, "map %d\n", &map_size)); |
258 CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size)); | 258 CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size)); |
259 CHECK_EQ(1, fscanf(fp, "property cell %d\n", &property_cell_size)); | 259 CHECK_EQ(1, fscanf(fp, "property cell %d\n", &property_cell_size)); |
260 CHECK_EQ(1, fscanf(fp, "lo %d\n", &lo_size)); | 260 CHECK_EQ(1, fscanf(fp, "lo %d\n", &lo_size)); |
261 #ifdef _MSC_VER | 261 #if V8_CC_MSVC |
262 #undef fscanf | 262 #undef fscanf |
263 #endif | 263 #endif |
264 fclose(fp); | 264 fclose(fp); |
265 deserializer->AddReservation(NEW_SPACE, new_size); | 265 deserializer->AddReservation(NEW_SPACE, new_size); |
266 deserializer->AddReservation(OLD_POINTER_SPACE, pointer_size); | 266 deserializer->AddReservation(OLD_POINTER_SPACE, pointer_size); |
267 deserializer->AddReservation(OLD_DATA_SPACE, data_size); | 267 deserializer->AddReservation(OLD_DATA_SPACE, data_size); |
268 deserializer->AddReservation(CODE_SPACE, code_size); | 268 deserializer->AddReservation(CODE_SPACE, code_size); |
269 deserializer->AddReservation(MAP_SPACE, map_size); | 269 deserializer->AddReservation(MAP_SPACE, map_size); |
270 deserializer->AddReservation(CELL_SPACE, cell_size); | 270 deserializer->AddReservation(CELL_SPACE, cell_size); |
271 deserializer->AddReservation(PROPERTY_CELL_SPACE, property_cell_size); | 271 deserializer->AddReservation(PROPERTY_CELL_SPACE, property_cell_size); |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 { | 1272 { |
1273 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 1273 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
1274 script = v8::ScriptCompiler::CompileUnbound( | 1274 script = v8::ScriptCompiler::CompileUnbound( |
1275 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 1275 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
1276 } | 1276 } |
1277 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 1277 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
1278 CHECK(result->ToString()->Equals(v8_str("XY"))); | 1278 CHECK(result->ToString()->Equals(v8_str("XY"))); |
1279 } | 1279 } |
1280 isolate2->Dispose(); | 1280 isolate2->Dispose(); |
1281 } | 1281 } |
OLD | NEW |