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

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

Issue 2424403002: [builtins] Migrate Number.parseInt to TurboFan builtin. (Closed)
Patch Set: Created 4 years, 2 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 | « src/runtime/runtime-numbers.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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 v8::Isolate* isolate = v8::Isolate::New(params); 808 v8::Isolate* isolate = v8::Isolate::New(params);
809 { 809 {
810 v8::Isolate::Scope i_scope(isolate); 810 v8::Isolate::Scope i_scope(isolate);
811 v8::HandleScope h_scope(isolate); 811 v8::HandleScope h_scope(isolate);
812 v8::Local<v8::Context> context = v8::Context::New(isolate); 812 v8::Local<v8::Context> context = v8::Context::New(isolate);
813 delete[] warm.data; 813 delete[] warm.data;
814 v8::Context::Scope c_scope(context); 814 v8::Context::Scope c_scope(context);
815 // Running the warmup script has effect on whether functions are 815 // Running the warmup script has effect on whether functions are
816 // pre-compiled, but does not pollute the context. 816 // pre-compiled, but does not pollute the context.
817 CHECK(IsCompiled("Math.abs")); 817 CHECK(IsCompiled("Math.abs"));
818 CHECK(!IsCompiled("Number.parseInt")); 818 CHECK(!IsCompiled("String.raw"));
819 CHECK(CompileRun("Math.random")->IsFunction()); 819 CHECK(CompileRun("Math.random")->IsFunction());
820 } 820 }
821 isolate->Dispose(); 821 isolate->Dispose();
822 } 822 }
823 823
824 TEST(CustomSnapshotDataBlobWithWarmup) { 824 TEST(CustomSnapshotDataBlobWithWarmup) {
825 DisableTurbofan(); 825 DisableTurbofan();
826 const char* source = 826 const char* source =
827 "function f() { return Math.abs(1); }\n" 827 "function f() { return Math.abs(1); }\n"
828 "function g() { return Number.parseInt(1); }\n" 828 "function g() { return String.raw(1); }\n"
829 "Object.valueOf(1);" 829 "Object.valueOf(1);"
830 "var a = 5"; 830 "var a = 5";
831 const char* warmup = "a = f()"; 831 const char* warmup = "a = f()";
832 832
833 v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(source); 833 v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(source);
834 v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup); 834 v8::StartupData warm = v8::V8::WarmUpSnapshotDataBlob(cold, warmup);
835 delete[] cold.data; 835 delete[] cold.data;
836 836
837 v8::Isolate::CreateParams params; 837 v8::Isolate::CreateParams params;
838 params.snapshot_blob = &warm; 838 params.snapshot_blob = &warm;
839 params.array_buffer_allocator = CcTest::array_buffer_allocator(); 839 params.array_buffer_allocator = CcTest::array_buffer_allocator();
840 840
841 v8::Isolate* isolate = v8::Isolate::New(params); 841 v8::Isolate* isolate = v8::Isolate::New(params);
842 { 842 {
843 v8::Isolate::Scope i_scope(isolate); 843 v8::Isolate::Scope i_scope(isolate);
844 v8::HandleScope h_scope(isolate); 844 v8::HandleScope h_scope(isolate);
845 v8::Local<v8::Context> context = v8::Context::New(isolate); 845 v8::Local<v8::Context> context = v8::Context::New(isolate);
846 delete[] warm.data; 846 delete[] warm.data;
847 v8::Context::Scope c_scope(context); 847 v8::Context::Scope c_scope(context);
848 // Running the warmup script has effect on whether functions are 848 // Running the warmup script has effect on whether functions are
849 // pre-compiled, but does not pollute the context. 849 // pre-compiled, but does not pollute the context.
850 CHECK(IsCompiled("f")); 850 CHECK(IsCompiled("f"));
851 CHECK(IsCompiled("Math.abs")); 851 CHECK(IsCompiled("Math.abs"));
852 CHECK(!IsCompiled("g")); 852 CHECK(!IsCompiled("g"));
853 CHECK(!IsCompiled("Number.parseInt")); 853 CHECK(!IsCompiled("String.raw"));
854 CHECK(!IsCompiled("Object.valueOf")); 854 CHECK(!IsCompiled("Object.valueOf"));
855 CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); 855 CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust());
856 } 856 }
857 isolate->Dispose(); 857 isolate->Dispose();
858 } 858 }
859 859
860 TEST(CustomSnapshotDataBlobImmortalImmovableRoots) { 860 TEST(CustomSnapshotDataBlobImmortalImmovableRoots) {
861 DisableTurbofan(); 861 DisableTurbofan();
862 // Flood the startup snapshot with shared function infos. If they are 862 // Flood the startup snapshot with shared function infos. If they are
863 // serialized before the immortal immovable root, the root will no longer end 863 // serialized before the immortal immovable root, the root will no longer end
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 } 2201 }
2202 delete[] blob.data; 2202 delete[] blob.data;
2203 } 2203 }
2204 2204
2205 TEST(SerializationMemoryStats) { 2205 TEST(SerializationMemoryStats) {
2206 FLAG_profile_deserialization = true; 2206 FLAG_profile_deserialization = true;
2207 FLAG_always_opt = false; 2207 FLAG_always_opt = false;
2208 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); 2208 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob();
2209 delete[] blob.data; 2209 delete[] blob.data;
2210 } 2210 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-numbers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698