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

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

Issue 2900683002: [compiler] Delay allocation of code-embedded heap numbers. (Closed)
Patch Set: Fix rebase. Created 3 years, 6 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/test-run-wasm-relocation-x64.cc ('k') | test/cctest/test-simulator-arm.cc » ('j') | 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 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(0.3); 1870 Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(0.3);
1871 CHECK(isolate->heap()->InNewSpace(*number)); 1871 CHECK(isolate->heap()->InNewSpace(*number));
1872 Handle<Code> code; 1872 Handle<Code> code;
1873 { 1873 {
1874 MacroAssembler* masm = &assembler; 1874 MacroAssembler* masm = &assembler;
1875 Handle<Cell> cell = isolate->factory()->NewCell(number); 1875 Handle<Cell> cell = isolate->factory()->NewCell(number);
1876 masm->Move(rax, cell, RelocInfo::CELL); 1876 masm->Move(rax, cell, RelocInfo::CELL);
1877 masm->movp(rax, Operand(rax, 0)); 1877 masm->movp(rax, Operand(rax, 0));
1878 masm->ret(0); 1878 masm->ret(0);
1879 CodeDesc desc; 1879 CodeDesc desc;
1880 masm->GetCode(&desc); 1880 masm->GetCode(isolate, &desc);
1881 code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION), 1881 code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION),
1882 masm->CodeObject()); 1882 masm->CodeObject());
1883 code->set_has_reloc_info_for_serialization(true); 1883 code->set_has_reloc_info_for_serialization(true);
1884 } 1884 }
1885 RelocIterator rit1(*code, 1 << RelocInfo::CELL); 1885 RelocIterator rit1(*code, 1 << RelocInfo::CELL);
1886 CHECK_EQ(*number, rit1.rinfo()->target_cell()->value()); 1886 CHECK_EQ(*number, rit1.rinfo()->target_cell()->value());
1887 1887
1888 Handle<String> source = isolate->factory()->empty_string(); 1888 Handle<String> source = isolate->factory()->empty_string();
1889 Handle<SharedFunctionInfo> sfi = 1889 Handle<SharedFunctionInfo> sfi =
1890 isolate->factory()->NewSharedFunctionInfo(source, code, false); 1890 isolate->factory()->NewSharedFunctionInfo(source, code, false);
(...skipping 28 matching lines...) Expand all
1919 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), 1919 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size),
1920 v8::internal::CodeObjectRequired::kYes); 1920 v8::internal::CodeObjectRequired::kYes);
1921 assembler.enable_serializer(); 1921 assembler.enable_serializer();
1922 Handle<Object> number = isolate->factory()->NewHeapNumber(0.3); 1922 Handle<Object> number = isolate->factory()->NewHeapNumber(0.3);
1923 CHECK(isolate->heap()->InNewSpace(*number)); 1923 CHECK(isolate->heap()->InNewSpace(*number));
1924 Handle<Code> code; 1924 Handle<Code> code;
1925 { 1925 {
1926 MacroAssembler* masm = &assembler; 1926 MacroAssembler* masm = &assembler;
1927 masm->Push(number); 1927 masm->Push(number);
1928 CodeDesc desc; 1928 CodeDesc desc;
1929 masm->GetCode(&desc); 1929 masm->GetCode(isolate, &desc);
1930 code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION), 1930 code = isolate->factory()->NewCode(desc, Code::ComputeFlags(Code::FUNCTION),
1931 masm->CodeObject()); 1931 masm->CodeObject());
1932 code->set_has_reloc_info_for_serialization(true); 1932 code->set_has_reloc_info_for_serialization(true);
1933 } 1933 }
1934 RelocIterator rit1(*code, RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); 1934 RelocIterator rit1(*code, RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT));
1935 CHECK_EQ(*number, rit1.rinfo()->target_object()); 1935 CHECK_EQ(*number, rit1.rinfo()->target_object());
1936 1936
1937 Handle<String> source = isolate->factory()->empty_string(); 1937 Handle<String> source = isolate->factory()->empty_string();
1938 Handle<SharedFunctionInfo> sfi = 1938 Handle<SharedFunctionInfo> sfi =
1939 isolate->factory()->NewSharedFunctionInfo(source, code, false); 1939 isolate->factory()->NewSharedFunctionInfo(source, code, false);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 } 2547 }
2548 delete[] blob.data; 2548 delete[] blob.data;
2549 } 2549 }
2550 2550
2551 TEST(SerializationMemoryStats) { 2551 TEST(SerializationMemoryStats) {
2552 FLAG_profile_deserialization = true; 2552 FLAG_profile_deserialization = true;
2553 FLAG_always_opt = false; 2553 FLAG_always_opt = false;
2554 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); 2554 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob();
2555 delete[] blob.data; 2555 delete[] blob.data;
2556 } 2556 }
OLDNEW
« no previous file with comments | « test/cctest/test-run-wasm-relocation-x64.cc ('k') | test/cctest/test-simulator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698