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

Unified Diff: test/cctest/test-compiler.cc

Issue 2257143002: [interpreter] Fix self-healing with preserved bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added ports and test. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-compiler.cc
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index aed84d3a01d2081c6df7c021478ec0ac100647e4..68cea9bf522d5e396e728ede7148796bb30ddfb4 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -785,7 +785,8 @@ TEST(IgnitionBaselineOnReturn) {
FLAG_always_opt = false;
CcTest::InitializeVM();
FLAG_ignition = true;
- reinterpret_cast<i::Isolate*>(CcTest::isolate())->interpreter()->Initialize();
+ Isolate* isolate = CcTest::i_isolate();
+ isolate->interpreter()->Initialize();
v8::HandleScope scope(CcTest::isolate());
InstallIsBaselineCompiledHelper(CcTest::isolate());
@@ -803,3 +804,36 @@ TEST(IgnitionBaselineOnReturn) {
CHECK_EQ(true, GetGlobalProperty("is_baseline_after_return")->BooleanValue());
CHECK_EQ(1234.0, GetGlobalProperty("return_val")->Number());
}
+
+TEST(IgnitionEntryTrampolineSelfHealing) {
+ FLAG_allow_natives_syntax = true;
+ FLAG_always_opt = false;
+ CcTest::InitializeVM();
+ FLAG_ignition = true;
+ Isolate* isolate = CcTest::i_isolate();
+ isolate->interpreter()->Initialize();
+ v8::HandleScope scope(CcTest::isolate());
+
+ CompileRun(
+ "function MkFun() {"
+ " function f() { return 23 }"
+ " return f"
+ "}"
+ "var f1 = MkFun(); f1();"
+ "var f2 = MkFun(); f2();"
+ "%BaselineFunctionOnNextCall(f1);");
+ Handle<JSFunction> f1 = Handle<JSFunction>::cast(GetGlobalProperty("f1"));
+ Handle<JSFunction> f2 = Handle<JSFunction>::cast(GetGlobalProperty("f2"));
+
+ // Function {f1} is marked for baseline.
+ CompileRun("var result1 = f1()");
+ CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code());
+ CHECK_EQ(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code());
+ CHECK_EQ(23.0, GetGlobalProperty("result1")->Number());
+
+ // Function {f2} will self-heal now.
+ CompileRun("var result2 = f2()");
+ CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f1->code());
+ CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code());
+ CHECK_EQ(23.0, GetGlobalProperty("result2")->Number());
+}
« no previous file with comments | « src/builtins/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698