Commit 5f0e7dd4 authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[ic] Shadow smi_handler on LoadHandler to always be Smi

StoreHandlers can store either a Code object or a Smi, so the
smi_handler field on DataHandler is a Code|Smi. But, LoadHandlers can
only store Smis here so add a shadowing smi_handler definition which
only allows / returns Smis.

Change-Id: Icc1c508db268950990b9c84b9e682b9a9b1f43e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663745
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80775}
parent 3065af53
......@@ -136,6 +136,15 @@ Handle<Smi> LoadHandler::LoadWasmArrayElement(Isolate* isolate,
return handle(Smi::FromInt(config), isolate);
}
DEF_GETTER(LoadHandler, smi_handler, Smi) {
// Only StoreHandler smi_handler can ever be a Code object.
return Smi::cast(DataHandler::smi_handler(cage_base));
}
void LoadHandler::set_smi_handler(Smi value) {
DataHandler::set_smi_handler(value, SKIP_WRITE_BARRIER);
}
OBJECT_CONSTRUCTORS_IMPL(StoreHandler, DataHandler)
CAST_ACCESSOR(StoreHandler)
......
......@@ -232,6 +232,9 @@ class LoadHandler final : public DataHandler {
static void PrintHandler(Object handler, std::ostream& os);
#endif // defined(OBJECT_PRINT)
DECL_GETTER(smi_handler, Smi)
inline void set_smi_handler(Smi value);
OBJECT_CONSTRUCTORS(LoadHandler, DataHandler);
};
......
......@@ -7,8 +7,7 @@
#include "src/execution/isolate.h"
#include "src/heap/factory.h"
#include "src/heap/heap-inl.h"
#include "src/ic/handler-configuration.h"
#include "src/objects/data-handler-inl.h"
#include "src/ic/handler-configuration-inl.h"
#include "src/objects/smi.h"
#include "test/cctest/cctest.h"
#include "test/cctest/heap/heap-tester.h"
......
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