Commit dd6af4e6 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[builtins] Move builtin constants into read_only_space

Create a new function NewHeapNumberForCodeAssembler used only by
CodeAssembler that allocates in read_only_space whenever it is writable
(e.g. when constructing builtins). This can allocate in old_space for
CSA tests that run after read_only_space is sealed.

This move 512 bytes from old_space to read_only_space.

Bug: v8:7464
Change-Id: I3e29b38a8c062fa74feed63ecf0d07625c04347f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1752855
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63220}
parent ea9eff84
......@@ -259,7 +259,7 @@ TNode<Number> CodeAssembler::NumberConstant(double value) {
// (see AllocateAndInstallRequestedHeapObjects) since that makes it easier
// to generate constant lookups for embedded builtins.
return UncheckedCast<Number>(HeapConstant(
isolate()->factory()->NewHeapNumber(value, AllocationType::kOld)));
isolate()->factory()->NewHeapNumberForCodeAssembler(value)));
}
}
......
......@@ -2226,6 +2226,12 @@ Handle<HeapNumber> Factory::NewHeapNumber(AllocationType allocation) {
return handle(HeapNumber::cast(result), isolate());
}
Handle<HeapNumber> Factory::NewHeapNumberForCodeAssembler(double value) {
return NewHeapNumber(value, isolate()->heap()->CanAllocateInReadOnlySpace()
? AllocationType::kReadOnly
: AllocationType::kOld);
}
Handle<MutableHeapNumber> Factory::NewMutableHeapNumber(
AllocationType allocation) {
STATIC_ASSERT(HeapNumber::kSize <= kMaxRegularHeapObjectSize);
......
......@@ -587,6 +587,10 @@ class V8_EXPORT_PRIVATE Factory {
Handle<HeapNumber> NewHeapNumber(
AllocationType allocation = AllocationType::kYoung);
// Creates a new HeapNumber in read-only space if possible otherwise old
// space.
Handle<HeapNumber> NewHeapNumberForCodeAssembler(double value);
Handle<MutableHeapNumber> NewMutableHeapNumber(
AllocationType allocation = AllocationType::kYoung);
inline Handle<MutableHeapNumber> NewMutableHeapNumber(
......
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