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

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

Issue 2083573002: [builtins] Unify Cosh, Sinh and Tanh as exports from flibm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE and windows fix. 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/compiler/test-run-machops.cc ('k') | test/unittests/base/ieee754-unittest.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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 784
785 bool IsCompiled(const char* name) { 785 bool IsCompiled(const char* name) {
786 return i::Handle<i::JSFunction>::cast( 786 return i::Handle<i::JSFunction>::cast(
787 v8::Utils::OpenHandle(*CompileRun(name))) 787 v8::Utils::OpenHandle(*CompileRun(name)))
788 ->shared() 788 ->shared()
789 ->is_compiled(); 789 ->is_compiled();
790 } 790 }
791 791
792 TEST(SnapshotDataBlobWithWarmup) { 792 TEST(SnapshotDataBlobWithWarmup) {
793 DisableTurbofan(); 793 DisableTurbofan();
794 const char* warmup = "Math.tanh(1); Math.sinh = 1;"; 794 const char* warmup = "Math.abs(1); Math.random = 1;";
795 795
796 v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(); 796 v8::StartupData cold = v8::V8::CreateSnapshotDataBlob();
797 v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup); 797 v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup);
798 delete[] cold.data; 798 delete[] cold.data;
799 799
800 v8::Isolate::CreateParams params; 800 v8::Isolate::CreateParams params;
801 params.snapshot_blob = &warm; 801 params.snapshot_blob = &warm;
802 params.array_buffer_allocator = CcTest::array_buffer_allocator(); 802 params.array_buffer_allocator = CcTest::array_buffer_allocator();
803 803
804 v8::Isolate* isolate = v8::Isolate::New(params); 804 v8::Isolate* isolate = v8::Isolate::New(params);
805 { 805 {
806 v8::Isolate::Scope i_scope(isolate); 806 v8::Isolate::Scope i_scope(isolate);
807 v8::HandleScope h_scope(isolate); 807 v8::HandleScope h_scope(isolate);
808 v8::Local<v8::Context> context = v8::Context::New(isolate); 808 v8::Local<v8::Context> context = v8::Context::New(isolate);
809 delete[] warm.data; 809 delete[] warm.data;
810 v8::Context::Scope c_scope(context); 810 v8::Context::Scope c_scope(context);
811 // Running the warmup script has effect on whether functions are 811 // Running the warmup script has effect on whether functions are
812 // pre-compiled, but does not pollute the context. 812 // pre-compiled, but does not pollute the context.
813 CHECK(IsCompiled("Math.tanh")); 813 CHECK(IsCompiled("Math.abs"));
814 CHECK(!IsCompiled("Math.cosh")); 814 CHECK(!IsCompiled("Math.sign"));
815 CHECK(CompileRun("Math.sinh")->IsFunction()); 815 CHECK(CompileRun("Math.random")->IsFunction());
816 } 816 }
817 isolate->Dispose(); 817 isolate->Dispose();
818 } 818 }
819 819
820 TEST(CustomSnapshotDataBlobWithWarmup) { 820 TEST(CustomSnapshotDataBlobWithWarmup) {
821 DisableTurbofan(); 821 DisableTurbofan();
822 const char* source = 822 const char* source =
823 "function f() { return Math.sinh(1); }\n" 823 "function f() { return Math.abs(1); }\n"
824 "function g() { return Math.cosh(1); }\n" 824 "function g() { return Math.sign(1); }\n"
825 "Math.tanh(1);" 825 "Math.asinh(1);"
826 "var a = 5"; 826 "var a = 5";
827 const char* warmup = "a = f()"; 827 const char* warmup = "a = f()";
828 828
829 v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(source); 829 v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(source);
830 v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup); 830 v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup);
831 delete[] cold.data; 831 delete[] cold.data;
832 832
833 v8::Isolate::CreateParams params; 833 v8::Isolate::CreateParams params;
834 params.snapshot_blob = &warm; 834 params.snapshot_blob = &warm;
835 params.array_buffer_allocator = CcTest::array_buffer_allocator(); 835 params.array_buffer_allocator = CcTest::array_buffer_allocator();
836 836
837 v8::Isolate* isolate = v8::Isolate::New(params); 837 v8::Isolate* isolate = v8::Isolate::New(params);
838 { 838 {
839 v8::Isolate::Scope i_scope(isolate); 839 v8::Isolate::Scope i_scope(isolate);
840 v8::HandleScope h_scope(isolate); 840 v8::HandleScope h_scope(isolate);
841 v8::Local<v8::Context> context = v8::Context::New(isolate); 841 v8::Local<v8::Context> context = v8::Context::New(isolate);
842 delete[] warm.data; 842 delete[] warm.data;
843 v8::Context::Scope c_scope(context); 843 v8::Context::Scope c_scope(context);
844 // Running the warmup script has effect on whether functions are 844 // Running the warmup script has effect on whether functions are
845 // pre-compiled, but does not pollute the context. 845 // pre-compiled, but does not pollute the context.
846 CHECK(IsCompiled("f")); 846 CHECK(IsCompiled("f"));
847 CHECK(IsCompiled("Math.sinh")); 847 CHECK(IsCompiled("Math.abs"));
848 CHECK(!IsCompiled("g")); 848 CHECK(!IsCompiled("g"));
849 CHECK(!IsCompiled("Math.cosh")); 849 CHECK(!IsCompiled("Math.sign"));
850 CHECK(!IsCompiled("Math.tanh")); 850 CHECK(!IsCompiled("Math.asinh"));
851 CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); 851 CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust());
852 } 852 }
853 isolate->Dispose(); 853 isolate->Dispose();
854 } 854 }
855 855
856 TEST(CustomSnapshotDataBlobImmortalImmovableRoots) { 856 TEST(CustomSnapshotDataBlobImmortalImmovableRoots) {
857 DisableTurbofan(); 857 DisableTurbofan();
858 // Flood the startup snapshot with shared function infos. If they are 858 // Flood the startup snapshot with shared function infos. If they are
859 // serialized before the immortal immovable root, the root will no longer end 859 // serialized before the immortal immovable root, the root will no longer end
860 // up on the first page. 860 // up on the first page.
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 } 2116 }
2117 delete[] blob.data; 2117 delete[] blob.data;
2118 } 2118 }
2119 2119
2120 TEST(SerializationMemoryStats) { 2120 TEST(SerializationMemoryStats) {
2121 FLAG_profile_deserialization = true; 2121 FLAG_profile_deserialization = true;
2122 FLAG_always_opt = false; 2122 FLAG_always_opt = false;
2123 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); 2123 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob();
2124 delete[] blob.data; 2124 delete[] blob.data;
2125 } 2125 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/unittests/base/ieee754-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698