Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8b88946

Browse files
sjindel-googlecommit-bot@chromium.org
authored andcommitted
[vm] Fix Meteor regression in "[vm] Enable multiple entry-points for unoptimized calls."
Change-Id: I3ffcdd67ae80b05339861a3376a56b0a6ce642c7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127462 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
1 parent 7fcaafb commit 8b88946

File tree

2 files changed

+58
-24
lines changed

2 files changed

+58
-24
lines changed

runtime/vm/compiler/stub_code_compiler_arm.cc

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,10 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
20062006
Optimized optimized,
20072007
CallType type,
20082008
Exactness exactness) {
2009-
GenerateRecordEntryPoint(assembler);
2009+
const bool save_entry_point = kind == Token::kILLEGAL;
2010+
if (save_entry_point) {
2011+
GenerateRecordEntryPoint(assembler);
2012+
}
20102013

20112014
if (optimized == kOptimized) {
20122015
GenerateOptimizedUsageCounterIncrement(assembler);
@@ -2141,8 +2144,12 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
21412144
__ LoadImmediate(R0, 0);
21422145
// Preserve IC data object and arguments descriptor array and
21432146
// setup space on stack for result (target code object).
2144-
__ SmiTag(R3);
2145-
__ PushList((1 << R0) | (1 << R4) | (1 << R9) | (1 << R3));
2147+
RegList regs = (1 << R0) | (1 << R4) | (1 << R9);
2148+
if (save_entry_point) {
2149+
__ SmiTag(R3);
2150+
regs |= 1 << R3;
2151+
}
2152+
__ PushList(regs);
21462153
// Push call arguments.
21472154
for (intptr_t i = 0; i < num_args; i++) {
21482155
__ LoadFromOffset(kWord, IP, NOTFP, -i * target::kWordSize);
@@ -2155,8 +2162,10 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
21552162
__ Drop(num_args + 1);
21562163
// Pop returned function object into R0.
21572164
// Restore arguments descriptor array and IC data array.
2158-
__ PopList((1 << R0) | (1 << R4) | (1 << R9) | (1 << R3));
2159-
__ SmiUntag(R3);
2165+
__ PopList(regs);
2166+
if (save_entry_point) {
2167+
__ SmiUntag(R3);
2168+
}
21602169
__ RestoreCodePointer();
21612170
__ LeaveStubFrame();
21622171
Label call_target_function;
@@ -2187,7 +2196,11 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
21872196
// R0: target function.
21882197
__ ldr(CODE_REG, FieldAddress(R0, target::Function::code_offset()));
21892198

2190-
__ Branch(Address(R0, R3));
2199+
if (save_entry_point) {
2200+
__ Branch(Address(R0, R3));
2201+
} else {
2202+
__ Branch(FieldAddress(R0, target::Function::entry_point_offset()));
2203+
}
21912204

21922205
#if !defined(PRODUCT)
21932206
if (optimized == kUnoptimized) {
@@ -2196,11 +2209,17 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
21962209
if (type == kInstanceCall) {
21972210
__ Push(R0); // Preserve receiver.
21982211
}
2199-
__ SmiTag(R3); // Entry-point is not Smi.
2200-
__ PushList((1 << R3) | (1 << R9)); // Preserve IC data and entry-point.
2212+
RegList regs = 1 << R9;
2213+
if (save_entry_point) {
2214+
regs |= 1 << R3;
2215+
__ SmiTag(R3); // Entry-point is not Smi.
2216+
}
2217+
__ PushList(regs); // Preserve IC data and entry-point.
22012218
__ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
2202-
__ PopList((1 << R3) | (1 << R9)); // Restore IC data and entry-point
2203-
__ SmiUntag(R3);
2219+
__ PopList(regs); // Restore IC data and entry-point
2220+
if (save_entry_point) {
2221+
__ SmiUntag(R3);
2222+
}
22042223
if (type == kInstanceCall) {
22052224
__ Pop(R0);
22062225
}

runtime/vm/compiler/stub_code_compiler_x64.cc

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,10 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
20832083
Optimized optimized,
20842084
CallType type,
20852085
Exactness exactness) {
2086-
GenerateRecordEntryPoint(assembler);
2086+
const bool save_entry_point = kind == Token::kILLEGAL;
2087+
if (save_entry_point) {
2088+
GenerateRecordEntryPoint(assembler);
2089+
}
20872090

20882091
if (optimized == kOptimized) {
20892092
GenerateOptimizedUsageCounterIncrement(assembler);
@@ -2205,8 +2208,10 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
22052208
__ movq(RAX, FieldAddress(R10, target::ArgumentsDescriptor::count_offset()));
22062209
__ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi.
22072210
__ EnterStubFrame();
2208-
__ SmiTag(R8); // Entry-point offset is not Smi.
2209-
__ pushq(R8); // Preserve entry point.
2211+
if (save_entry_point) {
2212+
__ SmiTag(R8); // Entry-point offset is not Smi.
2213+
__ pushq(R8); // Preserve entry point.
2214+
}
22102215
__ pushq(R10); // Preserve arguments descriptor array.
22112216
__ pushq(RBX); // Preserve IC data object.
22122217
__ pushq(Immediate(0)); // Result slot.
@@ -2221,11 +2226,13 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
22212226
for (intptr_t i = 0; i < num_args + 1; i++) {
22222227
__ popq(RAX);
22232228
}
2224-
__ popq(RAX); // Pop returned function object into RAX.
2225-
__ popq(RBX); // Restore IC data array.
2226-
__ popq(R10); // Restore arguments descriptor array.
2227-
__ popq(R8); // Restore entry point.
2228-
__ SmiUntag(R8); // Entry-point offset is not Smi.
2229+
__ popq(RAX); // Pop returned function object into RAX.
2230+
__ popq(RBX); // Restore IC data array.
2231+
__ popq(R10); // Restore arguments descriptor array.
2232+
if (save_entry_point) {
2233+
__ popq(R8); // Restore entry point.
2234+
__ SmiUntag(R8); // Entry-point offset is not Smi.
2235+
}
22292236
__ RestoreCodePointer();
22302237
__ LeaveStubFrame();
22312238
Label call_target_function;
@@ -2277,8 +2284,12 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
22772284
__ Bind(&call_target_function);
22782285
// RAX: Target function.
22792286
__ movq(CODE_REG, FieldAddress(RAX, target::Function::code_offset()));
2280-
__ addq(R8, RAX);
2281-
__ jmp(Address(R8, 0));
2287+
if (save_entry_point) {
2288+
__ addq(R8, RAX);
2289+
__ jmp(Address(R8, 0));
2290+
} else {
2291+
__ jmp(FieldAddress(RAX, target::Function::entry_point_offset()));
2292+
}
22822293

22832294
if (exactness == kCheckExactness) {
22842295
__ Bind(&call_target_function_through_unchecked_entry);
@@ -2301,11 +2312,15 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub(
23012312
__ pushq(RDX); // Preserve receiver.
23022313
}
23032314
__ pushq(RBX); // Preserve ICData.
2304-
__ SmiTag(R8); // Entry-point offset is not Smi.
2305-
__ pushq(R8); // Preserve entry point.
2315+
if (save_entry_point) {
2316+
__ SmiTag(R8); // Entry-point offset is not Smi.
2317+
__ pushq(R8); // Preserve entry point.
2318+
}
23062319
__ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
2307-
__ popq(R8); // Restore entry point.
2308-
__ SmiUntag(R8);
2320+
if (save_entry_point) {
2321+
__ popq(R8); // Restore entry point.
2322+
__ SmiUntag(R8);
2323+
}
23092324
__ popq(RBX); // Restore ICData.
23102325
if (type == kInstanceCall) {
23112326
__ popq(RDX); // Restore receiver.

0 commit comments

Comments
 (0)