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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 860 |
861 Handle<JSFunction> copy_fun = | 861 Handle<JSFunction> copy_fun = |
862 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 862 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
863 copy, isolate->native_context()); | 863 copy, isolate->native_context()); |
864 | 864 |
865 Handle<Object> copy_result = | 865 Handle<Object> copy_result = |
866 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); | 866 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); |
867 | 867 |
868 CHECK_EQ(6 * 1000000, Handle<String>::cast(copy_result)->length()); | 868 CHECK_EQ(6 * 1000000, Handle<String>::cast(copy_result)->length()); |
869 CHECK(isolate->heap()->InSpace(HeapObject::cast(*copy_result), LO_SPACE)); | 869 CHECK(isolate->heap()->InSpace(HeapObject::cast(*copy_result), LO_SPACE)); |
| 870 // Make sure we do not serialize too much, e.g. include the source string. |
| 871 CHECK_LT(cache->length(), 7000000); |
870 | 872 |
871 delete cache; | 873 delete cache; |
872 source.Dispose(); | 874 source.Dispose(); |
873 } | 875 } |
874 | 876 |
875 | 877 |
876 TEST(SerializeToplevelThreeBigStrings) { | 878 TEST(SerializeToplevelThreeBigStrings) { |
877 FLAG_serialize_toplevel = true; | 879 FLAG_serialize_toplevel = true; |
878 LocalContext context; | 880 LocalContext context; |
879 Isolate* isolate = CcTest::i_isolate(); | 881 Isolate* isolate = CcTest::i_isolate(); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 { | 1283 { |
1282 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 1284 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
1283 script = v8::ScriptCompiler::CompileUnbound( | 1285 script = v8::ScriptCompiler::CompileUnbound( |
1284 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 1286 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
1285 } | 1287 } |
1286 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 1288 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
1287 CHECK(result->ToString()->Equals(v8_str("XY"))); | 1289 CHECK(result->ToString()->Equals(v8_str("XY"))); |
1288 } | 1290 } |
1289 isolate2->Dispose(); | 1291 isolate2->Dispose(); |
1290 } | 1292 } |
OLD | NEW |