From a71ab76a6059c0372ad27096cfb213fc869db8f8 Mon Sep 17 00:00:00 2001 From: Toon Verwaest Date: Thu, 17 Jun 2021 16:35:10 +0200 Subject: [PATCH] [interpreter] Remove %_Call This isn't used outside of tests, so let's just remove it. Change-Id: I06b7ec11911fd8ebc3bbabcba16d0c2a3fafddab Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2968413 Reviewed-by: Leszek Swirski Reviewed-by: Maya Lekova Commit-Queue: Toon Verwaest Cr-Commit-Position: refs/heads/master@{#75220} --- src/baseline/baseline-compiler.cc | 15 ----------- src/compiler/js-intrinsic-lowering.cc | 2 -- src/debug/debug-evaluate.cc | 1 - .../interpreter-intrinsics-generator.cc | 27 ------------------- src/interpreter/interpreter-intrinsics.h | 1 - src/runtime/runtime.h | 2 +- test/cctest/BUILD.gn | 1 - test/cctest/compiler/test-run-intrinsics.cc | 25 ----------------- .../test-interpreter-intrinsics.cc | 22 --------------- .../debug/regress/regress-crbug-405922.js | 2 +- test/mjsunit/compiler/regress-lazy-deopt.js | 2 +- test/mjsunit/es6/proxies-function.js | 21 --------------- .../call-function-in-effect-context-deopt.js | 2 +- test/mjsunit/regress/regress-3183.js | 2 +- .../bytecode-array-builder-unittest.cc | 2 +- 15 files changed, 6 insertions(+), 121 deletions(-) delete mode 100644 test/cctest/compiler/test-run-intrinsics.cc diff --git a/src/baseline/baseline-compiler.cc b/src/baseline/baseline-compiler.cc index 7210d3b350..026177f0eb 100644 --- a/src/baseline/baseline-compiler.cc +++ b/src/baseline/baseline-compiler.cc @@ -1284,21 +1284,6 @@ void BaselineCompiler::VisitIntrinsicCreateIterResultObject( CallBuiltin(args); } -void BaselineCompiler::VisitIntrinsicCall(interpreter::RegisterList args) { - // First argument register contains the function target. - __ LoadRegister(kJavaScriptCallTargetRegister, args.first_register()); - - // The arguments for the target function are from the second runtime call - // argument. - args = args.PopLeft(); - - uint32_t arg_count = args.register_count(); - CallBuiltin( - kJavaScriptCallTargetRegister, // kFunction - arg_count - 1, // kActualArgumentsCount - args); -} - void BaselineCompiler::VisitIntrinsicCreateAsyncFromSyncIterator( interpreter::RegisterList args) { CallBuiltin(args[0]); diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc index b10163c9bb..0abe6ccda9 100644 --- a/src/compiler/js-intrinsic-lowering.cc +++ b/src/compiler/js-intrinsic-lowering.cc @@ -74,8 +74,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) { return ReduceAsyncGeneratorYield(node); case Runtime::kInlineGeneratorGetResumeMode: return ReduceGeneratorGetResumeMode(node); - case Runtime::kInlineCall: - return ReduceCall(node); case Runtime::kInlineIncBlockCounter: return ReduceIncBlockCounter(node); case Runtime::kInlineGetImportMetaObject: diff --git a/src/debug/debug-evaluate.cc b/src/debug/debug-evaluate.cc index 7d682f26f2..3e3e17a61b 100644 --- a/src/debug/debug-evaluate.cc +++ b/src/debug/debug-evaluate.cc @@ -395,7 +395,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { // Intrinsics with inline versions have to be allowlisted here a second time. #define INLINE_INTRINSIC_ALLOWLIST(V) \ - V(Call) \ V(AsyncFunctionEnter) \ V(AsyncFunctionReject) \ V(AsyncFunctionResolve) diff --git a/src/interpreter/interpreter-intrinsics-generator.cc b/src/interpreter/interpreter-intrinsics-generator.cc index a6dfdbe4b8..e8ecf78d90 100644 --- a/src/interpreter/interpreter-intrinsics-generator.cc +++ b/src/interpreter/interpreter-intrinsics-generator.cc @@ -180,33 +180,6 @@ TNode IntrinsicsGenerator::CreateIterResultObject( arg_count); } -TNode IntrinsicsGenerator::Call( - const InterpreterAssembler::RegListNodePair& args, TNode context, - int arg_count) { - // First argument register contains the function target. - TNode function = __ LoadRegisterFromRegisterList(args, 0); - - // The arguments for the target function are from the second runtime call - // argument. - InterpreterAssembler::RegListNodePair target_args( - __ RegisterLocationInRegisterList(args, 1), - __ Int32Sub(args.reg_count(), __ Int32Constant(1))); - - if (FLAG_debug_code) { - InterpreterAssembler::Label arg_count_positive(assembler_); - TNode comparison = - __ Int32LessThan(target_args.reg_count(), __ Int32Constant(0)); - __ GotoIfNot(comparison, &arg_count_positive); - __ Abort(AbortReason::kWrongArgumentCountForInvokeIntrinsic); - __ Goto(&arg_count_positive); - __ BIND(&arg_count_positive); - } - - __ CallJSAndDispatch(function, context, target_args, - ConvertReceiverMode::kAny); - return TNode(); // We never return from the CallJSAndDispatch above. -} - TNode IntrinsicsGenerator::CreateAsyncFromSyncIterator( const InterpreterAssembler::RegListNodePair& args, TNode context, int arg_count) { diff --git a/src/interpreter/interpreter-intrinsics.h b/src/interpreter/interpreter-intrinsics.h index 788ce33cbd..6b82d33154 100644 --- a/src/interpreter/interpreter-intrinsics.h +++ b/src/interpreter/interpreter-intrinsics.h @@ -28,7 +28,6 @@ namespace interpreter { V(GeneratorGetResumeMode, generator_get_resume_mode, 1) \ V(GeneratorClose, generator_close, 1) \ V(GetImportMetaObject, get_import_meta_object, 0) \ - V(Call, call, -1) \ V(CopyDataProperties, copy_data_properties, 2) \ V(CreateIterResultObject, create_iter_result_object, 2) \ V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index a53a917fe8..a537a67950 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -171,7 +171,7 @@ namespace internal { FOR_EACH_INTRINSIC_TRACE_FEEDBACK(F, I) #define FOR_EACH_INTRINSIC_FUNCTION(F, I) \ - I(Call, -1 /* >= 2 */, 1) \ + F(Call, -1 /* >= 2 */, 1) \ F(FunctionGetScriptSource, 1, 1) \ F(FunctionGetScriptId, 1, 1) \ F(FunctionGetScriptSourcePosition, 1, 1) \ diff --git a/test/cctest/BUILD.gn b/test/cctest/BUILD.gn index ad29d8b86c..89a9e4bf0d 100644 --- a/test/cctest/BUILD.gn +++ b/test/cctest/BUILD.gn @@ -114,7 +114,6 @@ v8_source_set("cctest_sources") { "compiler/test-run-bytecode-graph-builder.cc", "compiler/test-run-calls-to-external-references.cc", "compiler/test-run-deopt.cc", - "compiler/test-run-intrinsics.cc", "compiler/test-run-jsbranches.cc", "compiler/test-run-jscalls.cc", "compiler/test-run-jsexceptions.cc", diff --git a/test/cctest/compiler/test-run-intrinsics.cc b/test/cctest/compiler/test-run-intrinsics.cc deleted file mode 100644 index 27b171a096..0000000000 --- a/test/cctest/compiler/test-run-intrinsics.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/codegen/optimized-compilation-info.h" -#include "src/objects/string.h" -#include "test/cctest/compiler/function-tester.h" - -namespace v8 { -namespace internal { -namespace compiler { - -uint32_t flags = OptimizedCompilationInfo::kInlining; - -TEST(Call) { - FunctionTester T("(function(a,b) { return %_Call(b, a, 1, 2, 3); })", flags); - CompileRun("function f(a,b,c) { return a + b + c + this.d; }"); - - T.CheckCall(T.Val(129), T.NewObject("({d:123})"), T.NewObject("f")); - T.CheckCall(T.Val("6x"), T.NewObject("({d:'x'})"), T.NewObject("f")); -} - -} // namespace compiler -} // namespace internal -} // namespace v8 diff --git a/test/cctest/interpreter/test-interpreter-intrinsics.cc b/test/cctest/interpreter/test-interpreter-intrinsics.cc index 430773e137..52049b478e 100644 --- a/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -60,28 +60,6 @@ class InvokeIntrinsicHelper { } // namespace -TEST(Call) { - HandleAndZoneScope handles; - Isolate* isolate = handles.main_isolate(); - Factory* factory = isolate->factory(); - InvokeIntrinsicHelper helper(isolate, handles.main_zone(), - Runtime::kInlineCall); - - CHECK_EQ(Smi::FromInt(20), - *helper.Invoke(helper.NewObject("(function() { return this.x; })"), - helper.NewObject("({ x: 20 })"))); - CHECK_EQ(Smi::FromInt(50), - *helper.Invoke(helper.NewObject("(function(arg1) { return arg1; })"), - factory->undefined_value(), - handle(Smi::FromInt(50), isolate))); - CHECK_EQ( - Smi::FromInt(20), - *helper.Invoke( - helper.NewObject("(function(a, b, c) { return a + b + c; })"), - factory->undefined_value(), handle(Smi::FromInt(10), isolate), - handle(Smi::FromInt(7), isolate), handle(Smi::FromInt(3), isolate))); -} - } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/test/debugger/debug/regress/regress-crbug-405922.js b/test/debugger/debug/regress/regress-crbug-405922.js index 2ca163ca6f..0528dd6629 100644 --- a/test/debugger/debug/regress/regress-crbug-405922.js +++ b/test/debugger/debug/regress/regress-crbug-405922.js @@ -19,7 +19,7 @@ function listener(event, exec_state, event_data, data) { Debug.setListener(listener); function f(x) { - if (x > 0) %_Call(f, null, x-1); + if (x > 0) %Call(f, null, x-1); } debugger; diff --git a/test/mjsunit/compiler/regress-lazy-deopt.js b/test/mjsunit/compiler/regress-lazy-deopt.js index a0d777fb34..38d721a955 100644 --- a/test/mjsunit/compiler/regress-lazy-deopt.js +++ b/test/mjsunit/compiler/regress-lazy-deopt.js @@ -37,7 +37,7 @@ function f(x, y) { %DeoptimizeFunction(f); return 1; } - a[0] = %_Call(f, null, x - 1); + a[0] = %Call(f, null, x - 1); return x >> a[0]; } diff --git a/test/mjsunit/es6/proxies-function.js b/test/mjsunit/es6/proxies-function.js index cb3a26c535..921bd24eb6 100644 --- a/test/mjsunit/es6/proxies-function.js +++ b/test/mjsunit/es6/proxies-function.js @@ -95,10 +95,6 @@ function TestCall(isStrict, callTrap) { receiver = 333 assertEquals(42, %Call(f, null, 11, 31)); receiver = 333 - assertEquals(42, %_Call(f, o, 11, 31)) - assertSame(o, receiver) - receiver = 333 - assertEquals(42, %_Call(f, null, 11, 31)) var ff = Function.prototype.bind.call(f, o, 12) assertTrue(ff.length <= 1) // TODO(rossberg): Not spec'ed yet, be lax. @@ -118,11 +114,6 @@ function TestCall(isStrict, callTrap) { assertEquals(23, %Call(ff, {}, 11, 3)); assertSame(o, receiver) receiver = 333 - assertEquals(34, %_Call(ff, {}, 22)) - assertSame(o, receiver) - receiver = 333 - assertEquals(34, %_Call(ff, {}, 22, 3)) - assertSame(o, receiver) var fff = Function.prototype.bind.call(ff, o, 30) assertEquals(0, fff.length) @@ -142,11 +133,6 @@ function TestCall(isStrict, callTrap) { assertEquals(42, %Call(fff, {}, 11, 3)) assertSame(o, receiver) receiver = 333 - assertEquals(42, %_Call(fff, {})) - assertSame(o, receiver) - receiver = 333 - assertEquals(42, %_Call(fff, {}, 3, 4, 5)) - assertSame(o, receiver) var f = new Proxy(()=>{}, {apply: callTrap}) receiver = 333 @@ -174,8 +160,6 @@ function TestCall(isStrict, callTrap) { assertEquals(23, %Call(f, o, 11, 12)) assertSame(o, receiver) receiver = 333 - assertEquals(42, %_Call(f, o, 18, 24)) - assertSame(o, receiver) } TestCall(false, function(_, that, [x, y]) { @@ -239,8 +223,6 @@ function TestCallThrow(callTrap) { assertThrowsEquals(() => Function.prototype.apply.call(f, {}, [1]), "myexn") assertThrowsEquals(() => %Call(f, {}), "myexn") assertThrowsEquals(() => %Call(f, {}, 1, 2), "myexn") - assertThrowsEquals(() => %_Call(f, {}), "myexn") - assertThrowsEquals(() => %_Call(f, {}, 1, 2), "myexn") var f = Object.freeze(new Proxy(()=>{}, {apply: callTrap})) assertThrowsEquals(() => f(11), "myexn") @@ -250,8 +232,6 @@ function TestCallThrow(callTrap) { assertThrowsEquals(() => Function.prototype.apply.call(f, {}, [1]), "myexn") assertThrowsEquals(() => %Call(f, {}), "myexn") assertThrowsEquals(() => %Call(f, {}, 1, 2), "myexn") - assertThrowsEquals(() => %_Call(f, {}), "myexn") - assertThrowsEquals(() => %_Call(f, {}, 1, 2), "myexn") } TestCallThrow(function() { throw "myexn" }) @@ -553,7 +533,6 @@ function TestCalls() { function(f, x, y, o) { return f.apply(o, [x, y]) }, function(f, x, y, o) { return Function.prototype.call.call(f, o, x, y) }, function(f, x, y, o) { return Function.prototype.apply.call(f, o, [x, y]) }, - function(f, x, y, o) { return %_Call(f, o, x, y) }, function(f, x, y, o) { return %Call(f, o, x, y) }, function(f, x, y, o) { return %Apply(f, o, [null, x, y, null], 1, 2) }, function(f, x, y, o) { return %Apply(f, o, arguments, 2, 2) }, diff --git a/test/mjsunit/regress/call-function-in-effect-context-deopt.js b/test/mjsunit/regress/call-function-in-effect-context-deopt.js index 4e852d8d95..77199e1038 100644 --- a/test/mjsunit/regress/call-function-in-effect-context-deopt.js +++ b/test/mjsunit/regress/call-function-in-effect-context-deopt.js @@ -29,7 +29,7 @@ function f(deopt, osr) { var result = "result"; - %_Call(function() {}, 0, 0); + %Call(function() {}, 0, 0); var dummy = deopt + 0; for (var i = 0; osr && i < 2; i++) { %PrepareFunctionForOptimization(f); diff --git a/test/mjsunit/regress/regress-3183.js b/test/mjsunit/regress/regress-3183.js index 290508226c..9228bed824 100644 --- a/test/mjsunit/regress/regress-3183.js +++ b/test/mjsunit/regress/regress-3183.js @@ -87,7 +87,7 @@ } function bar(x, deopt) { - %_Call(f1, null, 'push', [x][0], ((deopt + 0), 1)); + %Call(f1, null, 'push', [x][0], ((deopt + 0), 1)); } function foo() { return bar(arguments[0], arguments[1]); } diff --git a/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/test/unittests/interpreter/bytecode-array-builder-unittest.cc index a8c96c5fdf..418a50207b 100644 --- a/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -418,7 +418,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { builder.SwitchOnGeneratorState(reg, gen_jump_table).Bind(gen_jump_table, 0); // Intrinsics handled by the interpreter. - builder.CallRuntime(Runtime::kInlineCall, reg_list); + builder.CallRuntime(Runtime::kInlineAsyncFunctionReject, reg_list); // Emit debugger bytecode. builder.Debugger();