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

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

Issue 2116753002: [builtins] Unify most of the remaining Math builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2102223005
Patch Set: 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
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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.abs")); 813 CHECK(IsCompiled("Math.abs"));
814 CHECK(!IsCompiled("Math.sign")); 814 CHECK(!IsCompiled("Number.isFinite"));
815 CHECK(CompileRun("Math.random")->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.abs(1); }\n" 823 "function f() { return Math.abs(1); }\n"
824 "function g() { return Math.sign(1); }\n" 824 "function g() { return Number.isFinite(1); }\n"
825 "Math.asinh(1);" 825 "Number.isNaN(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.abs")); 847 CHECK(IsCompiled("Math.abs"));
848 CHECK(!IsCompiled("g")); 848 CHECK(!IsCompiled("g"));
849 CHECK(!IsCompiled("Math.sign")); 849 CHECK(!IsCompiled("Number.isFinite"));
850 CHECK(!IsCompiled("Math.asinh")); 850 CHECK(!IsCompiled("Number.isNaN"));
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

Powered by Google App Engine
This is Rietveld 408576698