[tests] Fix cctests to work with lazy feedback allocation

Bug: v8:8394
Change-Id: Ica3e1bfc1b272ad0e5e45cc0cae870a30822b624
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1601265
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61382}
This commit is contained in:
Mythri A 2019-05-08 16:54:26 +01:00 committed by Commit Bot
parent 9dff517a3d
commit 6282c56d2d
4 changed files with 10 additions and 0 deletions

View File

@ -115,6 +115,7 @@ class BytecodeGraphTester {
.ToLocalChecked());
Handle<JSFunction> function =
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function));
JSFunction::EnsureFeedbackVector(function);
CHECK(function->shared()->HasBytecodeArray());
Zone zone(isolate_->allocator(), ZONE_NAME);

View File

@ -4379,6 +4379,7 @@ TEST(WeakFunctionInConstructor) {
if (FLAG_always_opt) return;
FLAG_stress_compaction = false;
FLAG_stress_incremental_marking = false;
FLAG_allow_natives_syntax = true;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
LocalContext env;
@ -4399,6 +4400,8 @@ TEST(WeakFunctionInConstructor) {
const char* source =
" (function() {"
" function hat() { this.x = 5; }"
" %EnsureFeedbackVectorForFunction(hat);"
" %EnsureFeedbackVectorForFunction(createObj);"
" createObj(hat);"
" createObj(hat);"
" return hat;"

View File

@ -11004,6 +11004,7 @@ THREADED_TEST(ShadowObjectAndDataProperty) {
// efficient access and good feedback for optimization.
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
i::FLAG_allow_natives_syntax = true;
Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
LocalContext context(nullptr, global_template);
@ -11022,6 +11023,7 @@ THREADED_TEST(ShadowObjectAndDataProperty) {
CompileRun(
"function foo(x) { i = x; }"
"%EnsureFeedbackVectorForFunction(foo);"
"foo(0)");
i::Handle<i::JSFunction> foo(i::Handle<i::JSFunction>::cast(

View File

@ -2320,6 +2320,8 @@ TEST(DeoptAtSecondLevelInlinedSource) {
"\n"
"startProfiling();\n"
"\n"
"%EnsureFeedbackVectorForFunction(opt_function);\n"
"%EnsureFeedbackVectorForFunction(test2);\n"
"%PrepareFunctionForOptimization(test1);\n"
"\n"
"test1(10, 10);\n"
@ -2394,6 +2396,7 @@ TEST(DeoptUntrackedFunction) {
const char* source =
"function test(left, right) { return opt_function(left, right); }\n"
"\n"
"%EnsureFeedbackVectorForFunction(opt_function);"
"%PrepareFunctionForOptimization(test);\n"
"\n"
"test(10, 10);\n"
@ -3071,6 +3074,7 @@ UNINITIALIZED_TEST(DetailedSourcePositionAPI_Inlining) {
return x;
}
%EnsureFeedbackVectorForFunction(bar);
%PrepareFunctionForOptimization(foo);
foo(5);
%OptimizeFunctionOnNextCall(foo);