OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 static void Serialize() { | 150 static void Serialize() { |
151 #ifdef DEBUG | 151 #ifdef DEBUG |
152 FLAG_debug_serialization = true; | 152 FLAG_debug_serialization = true; |
153 #endif | 153 #endif |
154 StatsTable::SetCounterFunction(counter_function); | 154 StatsTable::SetCounterFunction(counter_function); |
155 | 155 |
156 v8::HandleScope scope; | 156 v8::HandleScope scope; |
157 const int kExtensionCount = 5; | 157 const int kExtensionCount = 1; |
158 const char* extension_list[kExtensionCount] = | 158 const char* extension_list[kExtensionCount] = { "v8/gc" }; |
159 { "v8/print", "v8/load", "v8/quit", "v8/version", "v8/gc" }; | |
160 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); | 159 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); |
161 v8::Persistent<v8::Context> env = v8::Context::New(&extensions); | 160 v8::Persistent<v8::Context> env = v8::Context::New(&extensions); |
162 env->Enter(); | 161 env->Enter(); |
163 | 162 |
164 Snapshot::WriteToFile(FLAG_testing_serialization_file); | 163 Snapshot::WriteToFile(FLAG_testing_serialization_file); |
165 } | 164 } |
166 | 165 |
167 | 166 |
168 // Test that the whole heap can be serialized when running from the | 167 // Test that the whole heap can be serialized when running from the |
169 // internal snapshot. | 168 // internal snapshot. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 v8::Local<v8::Script> script = v8::Script::Compile(source); | 251 v8::Local<v8::Script> script = v8::Script::Compile(source); |
253 v8::Local<v8::Value> value = script->Run(); | 252 v8::Local<v8::Value> value = script->Run(); |
254 CHECK(value->BooleanValue()); | 253 CHECK(value->BooleanValue()); |
255 } | 254 } |
256 | 255 |
257 | 256 |
258 TEST(DeserializeExtensions) { | 257 TEST(DeserializeExtensions) { |
259 v8::HandleScope scope; | 258 v8::HandleScope scope; |
260 | 259 |
261 Deserialize(); | 260 Deserialize(); |
262 const char* c_source = "print(\"abcd\");"; | 261 const char* c_source = "gc();"; |
263 v8::Local<v8::String> source = v8::String::New(c_source); | 262 v8::Local<v8::String> source = v8::String::New(c_source); |
264 v8::Local<v8::Script> script = v8::Script::Compile(source); | 263 v8::Local<v8::Script> script = v8::Script::Compile(source); |
265 v8::Local<v8::Value> value = script->Run(); | 264 v8::Local<v8::Value> value = script->Run(); |
266 CHECK(value->IsUndefined()); | 265 CHECK(value->IsUndefined()); |
267 } | 266 } |
OLD | NEW |