Commit 9219b369 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[test, arm] Take isolate as argument for AssembleCode

AssembleCode used CcTest::i_isolate() to load the isolate, however this
might not be the isolate that should be used. Therefore take the isolate
as an explicit argument.

Note that this changes behavior of ExecuteMemoryAccess in
test-sync-primitives-arm.cc. I think this test inadvertently created
the assembly code in the isolate of another thread, while it didn't
use the isolate it sets the handle scope up for.

This change is required for relanding https://crrev.com/c/2543399.

Bug: v8:10315
Change-Id: I754f4b45cec93727309fa73723011afe976f3689
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2546682Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71257}
parent 102def8b
......@@ -12,8 +12,8 @@
namespace v8 {
namespace internal {
Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble) {
Isolate* isolate = CcTest::i_isolate();
Handle<Code> AssembleCodeImpl(Isolate* isolate,
std::function<void(MacroAssembler&)> assemble) {
MacroAssembler assm(isolate, CodeObjectRequired::kYes);
assemble(assm);
......
......@@ -21,12 +21,14 @@ using F_ppiii = void*(void* p0, void* p1, int p2, int p3, int p4);
using F_pppii = void*(void* p0, void* p1, void* p2, int p3, int p4);
using F_ippii = void*(int p0, void* p1, void* p2, int p3, int p4);
Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble);
Handle<Code> AssembleCodeImpl(Isolate* isolate,
std::function<void(MacroAssembler&)> assemble);
template <typename Signature>
GeneratedCode<Signature> AssembleCode(
std::function<void(MacroAssembler&)> assemble) {
return GeneratedCode<Signature>::FromCode(*AssembleCodeImpl(assemble));
Isolate* isolate, std::function<void(MacroAssembler&)> assemble) {
return GeneratedCode<Signature>::FromCode(
*AssembleCodeImpl(isolate, assemble));
}
} // namespace internal
......
......@@ -4113,7 +4113,7 @@ TEST(vabs_32) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
auto f = AssembleCode<F_iiiii>([](Assembler& assm) {
auto f = AssembleCode<F_iiiii>(isolate, [](Assembler& assm) {
__ vmov(s0, r0);
__ vabs(s0, s0);
__ vmov(r0, s0);
......@@ -4131,7 +4131,7 @@ TEST(vabs_64) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
auto f = AssembleCode<F_iiiii>([](Assembler& assm) {
auto f = AssembleCode<F_iiiii>(isolate, [](Assembler& assm) {
__ vmov(d0, r0, r1);
__ vabs(d0, d0);
__ vmov(r1, r0, d0);
......@@ -4151,7 +4151,7 @@ TEST(vneg_32) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
auto f = AssembleCode<F_iiiii>([](Assembler& assm) {
auto f = AssembleCode<F_iiiii>(isolate, [](Assembler& assm) {
__ vmov(s0, r0);
__ vneg(s0, s0);
__ vmov(r0, s0);
......@@ -4169,7 +4169,7 @@ TEST(vneg_64) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
auto f = AssembleCode<F_iiiii>([](Assembler& assm) {
auto f = AssembleCode<F_iiiii>(isolate, [](Assembler& assm) {
__ vmov(d0, r0, r1);
__ vneg(d0, d0);
__ vmov(r1, r0, d0);
......@@ -4189,7 +4189,7 @@ TEST(move_pair) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
auto f = AssembleCode<F_piiii>([](MacroAssembler& assm) {
auto f = AssembleCode<F_piiii>(isolate, [](MacroAssembler& assm) {
RegList used_callee_saved =
r4.bit() | r5.bit() | r6.bit() | r7.bit() | r8.bit();
__ stm(db_w, sp, used_callee_saved);
......
......@@ -198,11 +198,12 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1,
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
auto f = AssembleCode<int(TestData*, int, int, int)>([&](Assembler& assm) {
AssembleLoadExcl(&assm, access1, r1, r1);
AssembleMemoryAccess(&assm, access2, r3, r2, r1);
AssembleStoreExcl(&assm, access3, r0, r3, r1);
});
auto f = AssembleCode<int(TestData*, int, int, int)>(
isolate, [&](Assembler& assm) {
AssembleLoadExcl(&assm, access1, r1, r1);
AssembleMemoryAccess(&assm, access2, r3, r2, r1);
AssembleStoreExcl(&assm, access3, r0, r3, r1);
});
TestData t = initial_data;
......@@ -266,9 +267,10 @@ namespace {
int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data,
MemoryAccess access) {
HandleScope scope(isolate);
auto f = AssembleCode<int(TestData*, int, int)>([&](Assembler& assm) {
AssembleMemoryAccess(&assm, access, r0, r2, r1);
});
auto f =
AssembleCode<int(TestData*, int, int)>(isolate, [&](Assembler& assm) {
AssembleMemoryAccess(&assm, access, r0, r2, r1);
});
return f.Call(test_data, 0, 0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment