Skip to content

Commit 44ea425

Browse files
gahaasCommit Bot
authored andcommitted
[refactoring] Remove the isolate from signatures of ExternalReferences
In this CL I remove the isolate from signatures of ExternalReference accessor functions where the isolate is not used. The uses of the isolate were already removed in previous CLs. Changes: * I split the ExternalReference list in external-reference.h into those which need the isolate for initialization and those which do not. * I removed the public constructors and replaced them by ExternalReference::Create(). The reason is to separate external creation more clearly from internal creation, because externally created ExternalReferences sometimes need redirection, whereas internally created ExternalReferences are just stored as they are. In addition, by removing the isolate from the signature of the public constructors, they suddenly exactly matched the interal constructor. * Replace all uses of the public constructors with ExternalReference::Create(). * Remove the isolate from all call sites where necessary. This is a step towards making WebAssembly compilation independent of the isolate. Bug: v8:7570 R=mstarzinger@chromium.org Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng Change-Id: I14f511fc6acc50ab2d6a6641299f5ddbeabef0da Reviewed-on: https://chromium-review.googlesource.com/1018982 Commit-Queue: Andreas Haas <ahaas@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#52768}
1 parent 45dd38c commit 44ea425

77 files changed

Lines changed: 1022 additions & 1145 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/arm/code-stubs-arm.cc

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
142142
// should have returned the exception sentinel.
143143
if (FLAG_debug_code) {
144144
Label okay;
145-
ExternalReference pending_exception_address(
145+
ExternalReference pending_exception_address = ExternalReference::Create(
146146
IsolateAddressId::kPendingExceptionAddress, isolate());
147147
__ mov(r3, Operand(pending_exception_address));
148148
__ ldr(r3, MemOperand(r3));
@@ -168,19 +168,20 @@ void CEntryStub::Generate(MacroAssembler* masm) {
168168
// Handling of exception.
169169
__ bind(&exception_returned);
170170

171-
ExternalReference pending_handler_context_address(
171+
ExternalReference pending_handler_context_address = ExternalReference::Create(
172172
IsolateAddressId::kPendingHandlerContextAddress, isolate());
173-
ExternalReference pending_handler_entrypoint_address(
174-
IsolateAddressId::kPendingHandlerEntrypointAddress, isolate());
175-
ExternalReference pending_handler_fp_address(
173+
ExternalReference pending_handler_entrypoint_address =
174+
ExternalReference::Create(
175+
IsolateAddressId::kPendingHandlerEntrypointAddress, isolate());
176+
ExternalReference pending_handler_fp_address = ExternalReference::Create(
176177
IsolateAddressId::kPendingHandlerFPAddress, isolate());
177-
ExternalReference pending_handler_sp_address(
178+
ExternalReference pending_handler_sp_address = ExternalReference::Create(
178179
IsolateAddressId::kPendingHandlerSPAddress, isolate());
179180

180181
// Ask the runtime for help to determine the handler. This will set r0 to
181182
// contain the current pending exception, don't clobber it.
182-
ExternalReference find_handler(Runtime::kUnwindAndFindExceptionHandler,
183-
isolate());
183+
ExternalReference find_handler =
184+
ExternalReference::Create(Runtime::kUnwindAndFindExceptionHandler);
184185
{
185186
FrameScope scope(masm, StackFrame::MANUAL);
186187
__ PrepareCallCFunction(3, 0);
@@ -260,8 +261,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
260261
StackFrame::Type marker = type();
261262
__ mov(r7, Operand(StackFrame::TypeToMarker(marker)));
262263
__ mov(r6, Operand(StackFrame::TypeToMarker(marker)));
263-
__ mov(r5, Operand(ExternalReference(IsolateAddressId::kCEntryFPAddress,
264-
isolate())));
264+
__ mov(r5, Operand(ExternalReference::Create(
265+
IsolateAddressId::kCEntryFPAddress, isolate())));
265266
__ ldr(r5, MemOperand(r5));
266267
{
267268
UseScratchRegisterScope temps(masm);
@@ -279,7 +280,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
279280

280281
// If this is the outermost JS call, set js_entry_sp value.
281282
Label non_outermost_js;
282-
ExternalReference js_entry_sp(IsolateAddressId::kJSEntrySPAddress, isolate());
283+
ExternalReference js_entry_sp =
284+
ExternalReference::Create(IsolateAddressId::kJSEntrySPAddress, isolate());
283285
__ mov(r5, Operand(ExternalReference(js_entry_sp)));
284286
__ ldr(scratch, MemOperand(r5));
285287
__ cmp(scratch, Operand::Zero());
@@ -309,8 +311,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
309311
// fp will be invalid because the PushStackHandler below sets it to 0 to
310312
// signal the existence of the JSEntry frame.
311313
__ mov(scratch,
312-
Operand(ExternalReference(IsolateAddressId::kPendingExceptionAddress,
313-
isolate())));
314+
Operand(ExternalReference::Create(
315+
IsolateAddressId::kPendingExceptionAddress, isolate())));
314316
}
315317
__ str(r0, MemOperand(scratch));
316318
__ LoadRoot(r0, Heap::kExceptionRootIndex);
@@ -353,8 +355,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
353355

354356
// Restore the top frame descriptors from the stack.
355357
__ pop(r3);
356-
__ mov(scratch, Operand(ExternalReference(IsolateAddressId::kCEntryFPAddress,
357-
isolate())));
358+
__ mov(scratch, Operand(ExternalReference::Create(
359+
IsolateAddressId::kCEntryFPAddress, isolate())));
358360
__ str(r3, MemOperand(scratch));
359361

360362
// Reset the stack to the callee saved registers.
@@ -468,9 +470,8 @@ void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
468470
__ mov(r2, Operand(ExternalReference::isolate_address(isolate())));
469471

470472
ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline));
471-
__ mov(scratch,
472-
Operand(ExternalReference(
473-
&dispatcher, ExternalReference::BUILTIN_CALL, isolate())));
473+
__ mov(scratch, Operand(ExternalReference::Create(
474+
&dispatcher, ExternalReference::BUILTIN_CALL)));
474475
#endif
475476
__ Call(scratch);
476477
}
@@ -679,7 +680,7 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
679680
__ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
680681
__ add(r0, r0, Operand(3));
681682
__ Push(r3, r2);
682-
__ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate()));
683+
__ JumpToExternalReference(ExternalReference::Create(Runtime::kNewArray));
683684
}
684685

685686

@@ -812,8 +813,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
812813
__ PushSafepointRegisters();
813814
__ PrepareCallCFunction(1);
814815
__ mov(r0, Operand(ExternalReference::isolate_address(isolate)));
815-
__ CallCFunction(ExternalReference::log_enter_external_function(isolate),
816-
1);
816+
__ CallCFunction(ExternalReference::log_enter_external_function(), 1);
817817
__ PopSafepointRegisters();
818818
}
819819

@@ -828,8 +828,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
828828
__ PushSafepointRegisters();
829829
__ PrepareCallCFunction(1);
830830
__ mov(r0, Operand(ExternalReference::isolate_address(isolate)));
831-
__ CallCFunction(ExternalReference::log_leave_external_function(isolate),
832-
1);
831+
__ CallCFunction(ExternalReference::log_leave_external_function(), 1);
833832
__ PopSafepointRegisters();
834833
}
835834

@@ -884,8 +883,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
884883
__ mov(r4, r0);
885884
__ PrepareCallCFunction(1);
886885
__ mov(r0, Operand(ExternalReference::isolate_address(isolate)));
887-
__ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate),
888-
1);
886+
__ CallCFunction(ExternalReference::delete_handle_scope_extensions(), 1);
889887
__ mov(r0, r4);
890888
__ jmp(&leave_exit_frame);
891889
}
@@ -961,8 +959,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
961959
__ mov(scratch0, Operand(argc()));
962960
__ str(scratch0, MemOperand(r0, 2 * kPointerSize));
963961

964-
ExternalReference thunk_ref =
965-
ExternalReference::invoke_function_callback(masm->isolate());
962+
ExternalReference thunk_ref = ExternalReference::invoke_function_callback();
966963

967964
AllowExternalCallThatCantCauseGC scope(masm);
968965
// Stores return the first js argument
@@ -1024,7 +1021,7 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
10241021
__ add(r1, sp, Operand(1 * kPointerSize)); // r1 = v8::PropertyCallbackInfo&
10251022

10261023
ExternalReference thunk_ref =
1027-
ExternalReference::invoke_accessor_getter_callback(isolate());
1024+
ExternalReference::invoke_accessor_getter_callback();
10281025

10291026
__ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
10301027
__ ldr(api_function_address,

src/arm/deoptimizer-arm.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
5858
{
5959
UseScratchRegisterScope temps(masm());
6060
Register scratch = temps.Acquire();
61-
__ mov(scratch, Operand(ExternalReference(
61+
__ mov(scratch, Operand(ExternalReference::Create(
6262
IsolateAddressId::kCEntryFPAddress, isolate())));
6363
__ str(fp, MemOperand(scratch));
6464
}
@@ -95,7 +95,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
9595
// Call Deoptimizer::New().
9696
{
9797
AllowExternalCallThatCantCauseGC scope(masm());
98-
__ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
98+
__ CallCFunction(ExternalReference::new_deoptimizer_function(), 6);
9999
}
100100

101101
// Preserve "deoptimizer" object in register r0 and get the input
@@ -164,8 +164,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
164164
// Call Deoptimizer::ComputeOutputFrames().
165165
{
166166
AllowExternalCallThatCantCauseGC scope(masm());
167-
__ CallCFunction(
168-
ExternalReference::compute_output_frames_function(isolate()), 1);
167+
__ CallCFunction(ExternalReference::compute_output_frames_function(), 1);
169168
}
170169
__ pop(r0); // Restore deoptimizer object (class Deoptimizer).
171170

src/arm/macro-assembler-arm.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,11 +1141,11 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
11411141
str(scratch, MemOperand(fp, ExitFrameConstants::kCodeOffset));
11421142

11431143
// Save the frame pointer and the context in top.
1144-
mov(scratch, Operand(ExternalReference(IsolateAddressId::kCEntryFPAddress,
1145-
isolate())));
1144+
mov(scratch, Operand(ExternalReference::Create(
1145+
IsolateAddressId::kCEntryFPAddress, isolate())));
11461146
str(fp, MemOperand(scratch));
1147-
mov(scratch,
1148-
Operand(ExternalReference(IsolateAddressId::kContextAddress, isolate())));
1147+
mov(scratch, Operand(ExternalReference::Create(
1148+
IsolateAddressId::kContextAddress, isolate())));
11491149
str(cp, MemOperand(scratch));
11501150

11511151
// Optionally save all double registers.
@@ -1204,18 +1204,18 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count,
12041204

12051205
// Clear top frame.
12061206
mov(r3, Operand::Zero());
1207-
mov(scratch, Operand(ExternalReference(IsolateAddressId::kCEntryFPAddress,
1208-
isolate())));
1207+
mov(scratch, Operand(ExternalReference::Create(
1208+
IsolateAddressId::kCEntryFPAddress, isolate())));
12091209
str(r3, MemOperand(scratch));
12101210

12111211
// Restore current context from top and clear it in debug mode.
1212-
mov(scratch,
1213-
Operand(ExternalReference(IsolateAddressId::kContextAddress, isolate())));
1212+
mov(scratch, Operand(ExternalReference::Create(
1213+
IsolateAddressId::kContextAddress, isolate())));
12141214
ldr(cp, MemOperand(scratch));
12151215
#ifdef DEBUG
12161216
mov(r3, Operand(Context::kInvalidContext));
1217-
mov(scratch,
1218-
Operand(ExternalReference(IsolateAddressId::kContextAddress, isolate())));
1217+
mov(scratch, Operand(ExternalReference::Create(
1218+
IsolateAddressId::kContextAddress, isolate())));
12191219
str(r3, MemOperand(scratch));
12201220
#endif
12211221

@@ -1516,8 +1516,8 @@ void MacroAssembler::PushStackHandler() {
15161516

15171517
Push(Smi::kZero); // Padding.
15181518
// Link the current handler as the next handler.
1519-
mov(r6,
1520-
Operand(ExternalReference(IsolateAddressId::kHandlerAddress, isolate())));
1519+
mov(r6, Operand(ExternalReference::Create(IsolateAddressId::kHandlerAddress,
1520+
isolate())));
15211521
ldr(r5, MemOperand(r6));
15221522
push(r5);
15231523
// Set this new handler as the current one.
@@ -1530,8 +1530,8 @@ void MacroAssembler::PopStackHandler() {
15301530
Register scratch = temps.Acquire();
15311531
STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
15321532
pop(r1);
1533-
mov(scratch,
1534-
Operand(ExternalReference(IsolateAddressId::kHandlerAddress, isolate())));
1533+
mov(scratch, Operand(ExternalReference::Create(
1534+
IsolateAddressId::kHandlerAddress, isolate())));
15351535
str(r1, MemOperand(scratch));
15361536
add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize));
15371537
}
@@ -1676,7 +1676,7 @@ void TurboAssembler::CallRuntimeDelayed(Zone* zone, Runtime::FunctionId fid,
16761676
// should remove this need and make the runtime routine entry code
16771677
// smarter.
16781678
mov(r0, Operand(f->nargs));
1679-
mov(r1, Operand(ExternalReference(f, isolate())));
1679+
mov(r1, Operand(ExternalReference::Create(f)));
16801680
CallStubDelayed(new (zone) CEntryStub(nullptr, 1, save_doubles));
16811681
}
16821682

@@ -1695,7 +1695,7 @@ void MacroAssembler::CallRuntime(const Runtime::Function* f,
16951695
// should remove this need and make the runtime routine entry code
16961696
// smarter.
16971697
mov(r0, Operand(num_arguments));
1698-
mov(r1, Operand(ExternalReference(f, isolate())));
1698+
mov(r1, Operand(ExternalReference::Create(f)));
16991699
CEntryStub stub(isolate(), 1, save_doubles);
17001700
CallStub(&stub);
17011701
}
@@ -1710,7 +1710,7 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
17101710
// smarter.
17111711
mov(r0, Operand(function->nargs));
17121712
}
1713-
JumpToExternalReference(ExternalReference(fid, isolate()));
1713+
JumpToExternalReference(ExternalReference::Create(fid));
17141714
}
17151715

17161716
void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
@@ -1742,7 +1742,7 @@ void MacroAssembler::IncrementCounter(StatsCounter* counter, int value,
17421742
Register scratch1, Register scratch2) {
17431743
DCHECK_GT(value, 0);
17441744
if (FLAG_native_code_counters && counter->Enabled()) {
1745-
mov(scratch2, Operand(ExternalReference(counter)));
1745+
mov(scratch2, Operand(ExternalReference::Create(counter)));
17461746
ldr(scratch1, MemOperand(scratch2));
17471747
add(scratch1, scratch1, Operand(value));
17481748
str(scratch1, MemOperand(scratch2));
@@ -1754,7 +1754,7 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
17541754
Register scratch1, Register scratch2) {
17551755
DCHECK_GT(value, 0);
17561756
if (FLAG_native_code_counters && counter->Enabled()) {
1757-
mov(scratch2, Operand(ExternalReference(counter)));
1757+
mov(scratch2, Operand(ExternalReference::Create(counter)));
17581758
ldr(scratch1, MemOperand(scratch2));
17591759
sub(scratch1, scratch1, Operand(value));
17601760
str(scratch1, MemOperand(scratch2));
@@ -1974,7 +1974,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
19741974

19751975

19761976
void TurboAssembler::CheckFor32DRegs(Register scratch) {
1977-
mov(scratch, Operand(ExternalReference::cpu_features(isolate())));
1977+
mov(scratch, Operand(ExternalReference::cpu_features()));
19781978
ldr(scratch, MemOperand(scratch));
19791979
tst(scratch, Operand(1u << VFP32DREGS));
19801980
}

0 commit comments

Comments
 (0)