Revert "[ptr-cage] Better support sharing CodeRange with re-embedded builtins"
This reverts commit a61aa4919f
.
Reason for revert: Did not fix the original issue with chromium
tests toggling jitless mode after V8 has already been initialized
on Win64.
Original change's description:
> [ptr-cage] Better support sharing CodeRange with re-embedded builtins
>
> If a shared CodeRange is already allocated when creating an Isolate in
> jitless mode, the CodeRange will be used. This is to better support the
> following use pattern:
>
> ```
> FLAG_jitless = false;
> v8::Isolate::New();
> FLAG_jitless = true;
> v8::Isolate::New();
> ```
>
> Note that the other direction of toggling jitless from true to false is
> unsupported and may have undefined behavior.
>
> Bug: v8:11460
> Change-Id: I1c451c53bc160be4122056d8b309323a94d4b8b6
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2890591
> Commit-Queue: Shu-yu Guo <syg@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#74535}
TBR=ishell@chromium.org
Bug: v8:11460
Change-Id: I0acd7d0d444efbf6b9860bcc5e91034319b78601
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2893827
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#74559}
This commit is contained in:
parent
1d1ce0cd44
commit
8613ac24bc
@ -3657,7 +3657,8 @@ bool Isolate::Init(SnapshotData* startup_snapshot_data,
|
|||||||
is_short_builtin_calls_enabled_ = (heap_.MaxOldGenerationSize() >=
|
is_short_builtin_calls_enabled_ = (heap_.MaxOldGenerationSize() >=
|
||||||
kShortBuiltinCallsOldSpaceSizeThreshold);
|
kShortBuiltinCallsOldSpaceSizeThreshold);
|
||||||
if (COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL) {
|
if (COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL) {
|
||||||
CodeRange* code_range = CodeRange::GetProcessWideCodeRange().get();
|
std::shared_ptr<CodeRange> code_range =
|
||||||
|
CodeRange::GetProcessWideCodeRange();
|
||||||
if (code_range && code_range->embedded_blob_code_copy() != nullptr) {
|
if (code_range && code_range->embedded_blob_code_copy() != nullptr) {
|
||||||
is_short_builtin_calls_enabled_ = true;
|
is_short_builtin_calls_enabled_ = true;
|
||||||
}
|
}
|
||||||
@ -4973,10 +4974,7 @@ void Isolate::AddCodeRange(Address begin, size_t length_in_bytes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Isolate::RequiresCodeRange() const {
|
bool Isolate::RequiresCodeRange() const {
|
||||||
if (kPlatformRequiresCodeRange && !jitless_) return true;
|
return kPlatformRequiresCodeRange && !jitless_;
|
||||||
|
|
||||||
return COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL &&
|
|
||||||
CodeRange::GetProcessWideCodeRange().get() != nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::metrics::Recorder::ContextId Isolate::GetOrRegisterRecorderContextId(
|
v8::metrics::Recorder::ContextId Isolate::GetOrRegisterRecorderContextId(
|
||||||
|
@ -101,49 +101,6 @@ UNINITIALIZED_TEST(SharedPtrComprCageCodeRange) {
|
|||||||
isolate2->Dispose();
|
isolate2->Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
UNINITIALIZED_TEST(SharedPtrComprCageRemappedBuiltinsJitlessFalseToTrue) {
|
|
||||||
// Testing that toggling jitless from false to true use the same re-embedded
|
|
||||||
// builtins. Toggling jitless from false to true with shared pointer
|
|
||||||
// compression cage is not supported.
|
|
||||||
|
|
||||||
if (!V8_SHORT_BUILTIN_CALLS_BOOL) return;
|
|
||||||
FLAG_short_builtin_calls = true;
|
|
||||||
FLAG_jitless = false;
|
|
||||||
|
|
||||||
constexpr uint64_t kMemoryGB = 4;
|
|
||||||
v8::Isolate::CreateParams create_params;
|
|
||||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
|
||||||
create_params.constraints.ConfigureDefaults(kMemoryGB * GB, kMemoryGB * GB);
|
|
||||||
|
|
||||||
v8::Isolate* isolate1 = v8::Isolate::New(create_params);
|
|
||||||
Isolate* i_isolate1 = reinterpret_cast<Isolate*>(isolate1);
|
|
||||||
v8::Isolate* isolate2 = v8::Isolate::New(create_params);
|
|
||||||
Isolate* i_isolate2 = reinterpret_cast<Isolate*>(isolate2);
|
|
||||||
|
|
||||||
CHECK_EQ(i_isolate1->embedded_blob_code(), i_isolate2->embedded_blob_code());
|
|
||||||
CodeRange* shared_code_range = CodeRange::GetProcessWideCodeRange().get();
|
|
||||||
if (shared_code_range &&
|
|
||||||
shared_code_range->embedded_blob_code_copy() != nullptr) {
|
|
||||||
CHECK_EQ(shared_code_range->embedded_blob_code_copy(),
|
|
||||||
i_isolate1->embedded_blob_code());
|
|
||||||
CHECK_EQ(shared_code_range->embedded_blob_code_copy(),
|
|
||||||
i_isolate2->embedded_blob_code());
|
|
||||||
}
|
|
||||||
|
|
||||||
FLAG_jitless = true;
|
|
||||||
v8::Isolate* isolate3 = v8::Isolate::New(create_params);
|
|
||||||
Isolate* i_isolate3 = reinterpret_cast<Isolate*>(isolate3);
|
|
||||||
if (shared_code_range &&
|
|
||||||
shared_code_range->embedded_blob_code_copy() != nullptr) {
|
|
||||||
CHECK_EQ(shared_code_range->embedded_blob_code_copy(),
|
|
||||||
i_isolate3->embedded_blob_code());
|
|
||||||
}
|
|
||||||
|
|
||||||
isolate1->Dispose();
|
|
||||||
isolate2->Dispose();
|
|
||||||
isolate3->Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr int kIsolatesToAllocate = 25;
|
constexpr int kIsolatesToAllocate = 25;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user