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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 Deserializer deserializer(&snapshot_data); | 627 Deserializer deserializer(&snapshot_data); |
628 root = | 628 root = |
629 deserializer.DeserializePartial(isolate, global_proxy, | 629 deserializer.DeserializePartial(isolate, global_proxy, |
630 &outdated_contexts).ToHandleChecked(); | 630 &outdated_contexts).ToHandleChecked(); |
631 CHECK_EQ(2, outdated_contexts->length()); | 631 CHECK_EQ(2, outdated_contexts->length()); |
632 CHECK(root->IsContext()); | 632 CHECK(root->IsContext()); |
633 Handle<Context> context = Handle<Context>::cast(root); | 633 Handle<Context> context = Handle<Context>::cast(root); |
634 CHECK(context->global_proxy() == *global_proxy); | 634 CHECK(context->global_proxy() == *global_proxy); |
635 Handle<String> o = isolate->factory()->NewStringFromAsciiChecked("o"); | 635 Handle<String> o = isolate->factory()->NewStringFromAsciiChecked("o"); |
636 Handle<JSObject> global_object(context->global_object(), isolate); | 636 Handle<JSObject> global_object(context->global_object(), isolate); |
637 Handle<Object> property = JSReceiver::GetDataProperty(global_object, o); | 637 Handle<Object> property = JSObject::GetDataProperty(global_object, o); |
638 CHECK(property.is_identical_to(global_proxy)); | 638 CHECK(property.is_identical_to(global_proxy)); |
639 | 639 |
640 v8::Handle<v8::Context> v8_context = v8::Utils::ToLocal(context); | 640 v8::Handle<v8::Context> v8_context = v8::Utils::ToLocal(context); |
641 v8::Context::Scope context_scope(v8_context); | 641 v8::Context::Scope context_scope(v8_context); |
642 double r = CompileRun("r")->ToNumber(v8_isolate)->Value(); | 642 double r = CompileRun("r")->ToNumber(v8_isolate)->Value(); |
643 CHECK(r >= 1 && r <= 2); | 643 CHECK(r >= 1 && r <= 2); |
644 int f = CompileRun("f()")->ToNumber(v8_isolate)->Int32Value(); | 644 int f = CompileRun("f()")->ToNumber(v8_isolate)->Int32Value(); |
645 CHECK_EQ(5, f); | 645 CHECK_EQ(5, f); |
646 f = CompileRun("e('f()')")->ToNumber(v8_isolate)->Int32Value(); | 646 f = CompileRun("e('f()')")->ToNumber(v8_isolate)->Int32Value(); |
647 CHECK_EQ(5, f); | 647 CHECK_EQ(5, f); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 CHECK_NE(*orig, *copy); | 1002 CHECK_NE(*orig, *copy); |
1003 | 1003 |
1004 Handle<JSFunction> copy_fun = | 1004 Handle<JSFunction> copy_fun = |
1005 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1005 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
1006 copy, isolate->native_context()); | 1006 copy, isolate->native_context()); |
1007 | 1007 |
1008 Handle<Object> copy_result = | 1008 Handle<Object> copy_result = |
1009 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); | 1009 Execution::Call(isolate, copy_fun, global, 0, NULL).ToHandleChecked(); |
1010 | 1010 |
1011 CHECK_EQ(6 * 1999999, Handle<String>::cast(copy_result)->length()); | 1011 CHECK_EQ(6 * 1999999, Handle<String>::cast(copy_result)->length()); |
1012 Handle<Object> property = JSReceiver::GetDataProperty( | 1012 Handle<Object> property = JSObject::GetDataProperty( |
1013 isolate->global_object(), f->NewStringFromAsciiChecked("s")); | 1013 isolate->global_object(), f->NewStringFromAsciiChecked("s")); |
1014 CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE)); | 1014 CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE)); |
1015 property = JSReceiver::GetDataProperty(isolate->global_object(), | 1015 property = JSObject::GetDataProperty(isolate->global_object(), |
1016 f->NewStringFromAsciiChecked("t")); | 1016 f->NewStringFromAsciiChecked("t")); |
1017 CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE)); | 1017 CHECK(isolate->heap()->InSpace(HeapObject::cast(*property), LO_SPACE)); |
1018 // Make sure we do not serialize too much, e.g. include the source string. | 1018 // Make sure we do not serialize too much, e.g. include the source string. |
1019 CHECK_LT(cache->length(), 13000000); | 1019 CHECK_LT(cache->length(), 13000000); |
1020 | 1020 |
1021 delete cache; | 1021 delete cache; |
1022 source_s.Dispose(); | 1022 source_s.Dispose(); |
1023 source_t.Dispose(); | 1023 source_t.Dispose(); |
1024 } | 1024 } |
1025 | 1025 |
1026 | 1026 |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 isolate->Dispose(); | 1569 isolate->Dispose(); |
1570 } | 1570 } |
1571 | 1571 |
1572 | 1572 |
1573 TEST(SerializationMemoryStats) { | 1573 TEST(SerializationMemoryStats) { |
1574 FLAG_profile_deserialization = true; | 1574 FLAG_profile_deserialization = true; |
1575 FLAG_always_opt = false; | 1575 FLAG_always_opt = false; |
1576 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1576 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
1577 delete[] blob.data; | 1577 delete[] blob.data; |
1578 } | 1578 } |
OLD | NEW |