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

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

Issue 1901573002: Reland of Immediately cache compiled scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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') | test/mjsunit/osr-elements-kind.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 24046 matching lines...) Expand 10 before | Expand all | Expand 10 after
24057 v8::ScriptCompiler::Source source(v8_str("42"), origin, cached_data); 24057 v8::ScriptCompiler::Source source(v8_str("42"), origin, cached_data);
24058 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); 24058 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
24059 v8::Local<v8::Script> script = 24059 v8::Local<v8::Script> script =
24060 v8::ScriptCompiler::Compile(context, &source, option).ToLocalChecked(); 24060 v8::ScriptCompiler::Compile(context, &source, option).ToLocalChecked();
24061 CHECK(cached_data->rejected); 24061 CHECK(cached_data->rejected);
24062 CHECK_EQ( 24062 CHECK_EQ(
24063 42, 24063 42,
24064 script->Run(context).ToLocalChecked()->Int32Value(context).FromJust()); 24064 script->Run(context).ToLocalChecked()->Int32Value(context).FromJust());
24065 } 24065 }
24066 24066
24067 24067 TEST(InvalidParserCacheData) {
24068 TEST(InvalidCacheData) {
24069 v8::V8::Initialize(); 24068 v8::V8::Initialize();
24070 v8::HandleScope scope(CcTest::isolate()); 24069 v8::HandleScope scope(CcTest::isolate());
24071 LocalContext context; 24070 LocalContext context;
24072 if (i::FLAG_lazy && !(i::FLAG_ignition && i::FLAG_ignition_eager)) { 24071 if (i::FLAG_lazy && !(i::FLAG_ignition && i::FLAG_ignition_eager)) {
24073 // Cached parser data is not consumed while parsing eagerly. 24072 // Cached parser data is not consumed while parsing eagerly.
24074 TestInvalidCacheData(v8::ScriptCompiler::kConsumeParserCache); 24073 TestInvalidCacheData(v8::ScriptCompiler::kConsumeParserCache);
24075 } 24074 }
24075 }
24076
24077 TEST(InvalidCodeCacheData) {
24078 v8::V8::Initialize();
24079 v8::HandleScope scope(CcTest::isolate());
24080 LocalContext context;
24076 TestInvalidCacheData(v8::ScriptCompiler::kConsumeCodeCache); 24081 TestInvalidCacheData(v8::ScriptCompiler::kConsumeCodeCache);
24077 } 24082 }
24078 24083
24079 24084
24080 TEST(ParserCacheRejectedGracefully) { 24085 TEST(ParserCacheRejectedGracefully) {
24081 // Producing cached parser data while parsing eagerly is not supported. 24086 // Producing cached parser data while parsing eagerly is not supported.
24082 if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return; 24087 if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return;
24083 24088
24084 i::FLAG_min_preparse_length = 0; 24089 i::FLAG_min_preparse_length = 0;
24085 v8::V8::Initialize(); 24090 v8::V8::Initialize();
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
24978 } 24983 }
24979 delete garbage; 24984 delete garbage;
24980 // Check that moderate memory pressure notification sets GC into memory 24985 // Check that moderate memory pressure notification sets GC into memory
24981 // optimizing mode. 24986 // optimizing mode.
24982 isolate->MemoryPressureNotification(v8::MemoryPressureLevel::kModerate); 24987 isolate->MemoryPressureNotification(v8::MemoryPressureLevel::kModerate);
24983 CHECK(CcTest::i_isolate()->heap()->ShouldOptimizeForMemoryUsage()); 24988 CHECK(CcTest::i_isolate()->heap()->ShouldOptimizeForMemoryUsage());
24984 // Check that disabling memory pressure returns GC into normal mode. 24989 // Check that disabling memory pressure returns GC into normal mode.
24985 isolate->MemoryPressureNotification(v8::MemoryPressureLevel::kNone); 24990 isolate->MemoryPressureNotification(v8::MemoryPressureLevel::kNone);
24986 CHECK(!CcTest::i_isolate()->heap()->ShouldOptimizeForMemoryUsage()); 24991 CHECK(!CcTest::i_isolate()->heap()->ShouldOptimizeForMemoryUsage());
24987 } 24992 }
OLDNEW
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | test/mjsunit/osr-elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698