| 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 // 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 static void ReserveSpaceForSnapshot(Deserializer* deserializer, | 41 static void ReserveSpaceForSnapshot(Deserializer* deserializer, |
| 42 const char* file_name) { | 42 const char* file_name) { |
| 43 int file_name_length = StrLength(file_name) + 10; | 43 int file_name_length = StrLength(file_name) + 10; |
| 44 Vector<char> name = Vector<char>::New(file_name_length + 1); | 44 Vector<char> name = Vector<char>::New(file_name_length + 1); |
| 45 OS::SNPrintF(name, "%s.size", file_name); | 45 OS::SNPrintF(name, "%s.size", file_name); |
| 46 FILE* fp = OS::FOpen(name.start(), "r"); | 46 FILE* fp = OS::FOpen(name.start(), "r"); |
| 47 CHECK_NE(NULL, fp); | 47 CHECK_NE(NULL, fp); |
| 48 int new_size, pointer_size, data_size, code_size, map_size, cell_size, | 48 int new_size, pointer_size, data_size, code_size, map_size, cell_size, |
| 49 property_cell_size; | 49 property_cell_size; |
| 50 #if V8_CC_MSVC | 50 #ifdef _MSC_VER |
| 51 // Avoid warning about unsafe fscanf from MSVC. | 51 // Avoid warning about unsafe fscanf from MSVC. |
| 52 // Please note that this is only fine if %c and %s are not being used. | 52 // Please note that this is only fine if %c and %s are not being used. |
| 53 #define fscanf fscanf_s | 53 #define fscanf fscanf_s |
| 54 #endif | 54 #endif |
| 55 CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size)); | 55 CHECK_EQ(1, fscanf(fp, "new %d\n", &new_size)); |
| 56 CHECK_EQ(1, fscanf(fp, "pointer %d\n", &pointer_size)); | 56 CHECK_EQ(1, fscanf(fp, "pointer %d\n", &pointer_size)); |
| 57 CHECK_EQ(1, fscanf(fp, "data %d\n", &data_size)); | 57 CHECK_EQ(1, fscanf(fp, "data %d\n", &data_size)); |
| 58 CHECK_EQ(1, fscanf(fp, "code %d\n", &code_size)); | 58 CHECK_EQ(1, fscanf(fp, "code %d\n", &code_size)); |
| 59 CHECK_EQ(1, fscanf(fp, "map %d\n", &map_size)); | 59 CHECK_EQ(1, fscanf(fp, "map %d\n", &map_size)); |
| 60 CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size)); | 60 CHECK_EQ(1, fscanf(fp, "cell %d\n", &cell_size)); |
| 61 CHECK_EQ(1, fscanf(fp, "property cell %d\n", &property_cell_size)); | 61 CHECK_EQ(1, fscanf(fp, "property cell %d\n", &property_cell_size)); |
| 62 #if V8_CC_MSVC | 62 #ifdef _MSC_VER |
| 63 #undef fscanf | 63 #undef fscanf |
| 64 #endif | 64 #endif |
| 65 fclose(fp); | 65 fclose(fp); |
| 66 deserializer->set_reservation(NEW_SPACE, new_size); | 66 deserializer->set_reservation(NEW_SPACE, new_size); |
| 67 deserializer->set_reservation(OLD_POINTER_SPACE, pointer_size); | 67 deserializer->set_reservation(OLD_POINTER_SPACE, pointer_size); |
| 68 deserializer->set_reservation(OLD_DATA_SPACE, data_size); | 68 deserializer->set_reservation(OLD_DATA_SPACE, data_size); |
| 69 deserializer->set_reservation(CODE_SPACE, code_size); | 69 deserializer->set_reservation(CODE_SPACE, code_size); |
| 70 deserializer->set_reservation(MAP_SPACE, map_size); | 70 deserializer->set_reservation(MAP_SPACE, map_size); |
| 71 deserializer->set_reservation(CELL_SPACE, cell_size); | 71 deserializer->set_reservation(CELL_SPACE, cell_size); |
| 72 deserializer->set_reservation(PROPERTY_CELL_SPACE, | 72 deserializer->set_reservation(PROPERTY_CELL_SPACE, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); | 131 deserializer.set_reservation(MAP_SPACE, context_map_space_used_); |
| 132 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); | 132 deserializer.set_reservation(CELL_SPACE, context_cell_space_used_); |
| 133 deserializer.set_reservation(PROPERTY_CELL_SPACE, | 133 deserializer.set_reservation(PROPERTY_CELL_SPACE, |
| 134 context_property_cell_space_used_); | 134 context_property_cell_space_used_); |
| 135 deserializer.DeserializePartial(&root); | 135 deserializer.DeserializePartial(&root); |
| 136 CHECK(root->IsContext()); | 136 CHECK(root->IsContext()); |
| 137 return Handle<Context>(Context::cast(root)); | 137 return Handle<Context>(Context::cast(root)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } } // namespace v8::internal | 140 } } // namespace v8::internal |
| OLD | NEW |