Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: test/cctest/test-serialize.cc

Issue 2097023002: Reland [heap] Avoid the use of cells to point from code to new-space objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1845 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1846 Assembler::kMinimalBufferSize, &actual_size, true)); 1846 Assembler::kMinimalBufferSize, &actual_size, true));
1847 CHECK(buffer); 1847 CHECK(buffer);
1848 HandleScope handles(isolate); 1848 HandleScope handles(isolate);
1849 1849
1850 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), 1850 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size),
1851 v8::internal::CodeObjectRequired::kYes); 1851 v8::internal::CodeObjectRequired::kYes);
1852 assembler.enable_serializer(); 1852 assembler.enable_serializer();
1853 Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(0.3); 1853 Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(0.3);
1854 CHECK(isolate->heap()->InNewSpace(*number)); 1854 CHECK(isolate->heap()->InNewSpace(*number));
1855 MacroAssembler* masm = &assembler; 1855 Handle<Code> code;
1856 masm->MoveHeapObject(rax, number); 1856 {
1857 masm->ret(0); 1857 MacroAssembler* masm = &assembler;
1858 CodeDesc desc; 1858 Handle<Cell> cell = isolate->factory()->NewCell(number);
1859 masm->GetCode(&desc); 1859 masm->Move(rax, cell, RelocInfo::CELL);
1860 Handle<Code> code = isolate->factory()->NewCode( 1860 masm->movp(rax, Operand(rax, 0));
1861 desc, Code::ComputeFlags(Code::FUNCTION), masm->CodeObject()); 1861 masm->ret(0);
1862 code->set_has_reloc_info_for_serialization(true); 1862 CodeDesc desc;
1863 1863 masm->GetCode(&desc);
1864 code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION),
1865 masm->CodeObject());
1866 code->set_has_reloc_info_for_serialization(true);
1867 }
1864 RelocIterator rit1(*code, 1 << RelocInfo::CELL); 1868 RelocIterator rit1(*code, 1 << RelocInfo::CELL);
1865 CHECK_EQ(*number, rit1.rinfo()->target_cell()->value()); 1869 CHECK_EQ(*number, rit1.rinfo()->target_cell()->value());
1866 1870
1867 Handle<String> source = isolate->factory()->empty_string(); 1871 Handle<String> source = isolate->factory()->empty_string();
1868 Handle<SharedFunctionInfo> sfi = 1872 Handle<SharedFunctionInfo> sfi =
1869 isolate->factory()->NewSharedFunctionInfo(source, code, false); 1873 isolate->factory()->NewSharedFunctionInfo(source, code, false);
1870 ScriptData* script_data = CodeSerializer::Serialize(isolate, sfi, source); 1874 ScriptData* script_data = CodeSerializer::Serialize(isolate, sfi, source);
1871 1875
1872 Handle<SharedFunctionInfo> copy = 1876 Handle<SharedFunctionInfo> copy =
1873 CodeSerializer::Deserialize(isolate, script_data, source) 1877 CodeSerializer::Deserialize(isolate, script_data, source)
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 } 2126 }
2123 delete[] blob.data; 2127 delete[] blob.data;
2124 } 2128 }
2125 2129
2126 TEST(SerializationMemoryStats) { 2130 TEST(SerializationMemoryStats) {
2127 FLAG_profile_deserialization = true; 2131 FLAG_profile_deserialization = true;
2128 FLAG_always_opt = false; 2132 FLAG_always_opt = false;
2129 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); 2133 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob();
2130 delete[] blob.data; 2134 delete[] blob.data;
2131 } 2135 }
OLDNEW
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698