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

[ic] Clean up StoreHandler code methods

Clean up a couple of the StoreHandler methods returning Builtins to
directly return the Code object, so that it can be used as a handler
straight away without having to go via the MakeCodeHandler helper (which
wasn't making anything anymore).

Change-Id: I4976829d25e2bdad0cf41088b76121ac9b500cd5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663083
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80720}
parent f2265d0c
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
inline Handle<Object> MakeCodeHandler(Isolate* isolate, Builtin builtin) {
return isolate->builtins()->code_handle(builtin);
}
OBJECT_CONSTRUCTORS_IMPL(LoadHandler, DataHandler) OBJECT_CONSTRUCTORS_IMPL(LoadHandler, DataHandler)
CAST_ACCESSOR(LoadHandler) CAST_ACCESSOR(LoadHandler)
...@@ -159,47 +155,56 @@ Handle<Smi> StoreHandler::StoreInterceptor(Isolate* isolate) { ...@@ -159,47 +155,56 @@ Handle<Smi> StoreHandler::StoreInterceptor(Isolate* isolate) {
return handle(Smi::FromInt(config), isolate); return handle(Smi::FromInt(config), isolate);
} }
Builtin StoreHandler::StoreSloppyArgumentsBuiltin(KeyedAccessStoreMode mode) { Handle<CodeT> StoreHandler::StoreSloppyArgumentsBuiltin(
Isolate* isolate, KeyedAccessStoreMode mode) {
switch (mode) { switch (mode) {
case STANDARD_STORE: case STANDARD_STORE:
return Builtin::kKeyedStoreIC_SloppyArguments_Standard; return BUILTIN_CODE(isolate, KeyedStoreIC_SloppyArguments_Standard);
case STORE_AND_GROW_HANDLE_COW: case STORE_AND_GROW_HANDLE_COW:
return Builtin::kKeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW; return BUILTIN_CODE(
isolate, KeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW);
case STORE_IGNORE_OUT_OF_BOUNDS: case STORE_IGNORE_OUT_OF_BOUNDS:
return Builtin::kKeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB; return BUILTIN_CODE(isolate,
KeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB);
case STORE_HANDLE_COW: case STORE_HANDLE_COW:
return Builtin::kKeyedStoreIC_SloppyArguments_NoTransitionHandleCOW; return BUILTIN_CODE(isolate,
KeyedStoreIC_SloppyArguments_NoTransitionHandleCOW);
default: default:
UNREACHABLE(); UNREACHABLE();
} }
} }
Builtin StoreHandler::StoreFastElementBuiltin(KeyedAccessStoreMode mode) { Handle<CodeT> StoreHandler::StoreFastElementBuiltin(Isolate* isolate,
KeyedAccessStoreMode mode) {
switch (mode) { switch (mode) {
case STANDARD_STORE: case STANDARD_STORE:
return Builtin::kStoreFastElementIC_Standard; return BUILTIN_CODE(isolate, StoreFastElementIC_Standard);
case STORE_AND_GROW_HANDLE_COW: case STORE_AND_GROW_HANDLE_COW:
return Builtin::kStoreFastElementIC_GrowNoTransitionHandleCOW; return BUILTIN_CODE(isolate,
StoreFastElementIC_GrowNoTransitionHandleCOW);
case STORE_IGNORE_OUT_OF_BOUNDS: case STORE_IGNORE_OUT_OF_BOUNDS:
return Builtin::kStoreFastElementIC_NoTransitionIgnoreOOB; return BUILTIN_CODE(isolate, StoreFastElementIC_NoTransitionIgnoreOOB);
case STORE_HANDLE_COW: case STORE_HANDLE_COW:
return Builtin::kStoreFastElementIC_NoTransitionHandleCOW; return BUILTIN_CODE(isolate, StoreFastElementIC_NoTransitionHandleCOW);
default: default:
UNREACHABLE(); UNREACHABLE();
} }
} }
Builtin StoreHandler::ElementsTransitionAndStoreBuiltin( Handle<CodeT> StoreHandler::ElementsTransitionAndStoreBuiltin(
KeyedAccessStoreMode mode) { Isolate* isolate, KeyedAccessStoreMode mode) {
switch (mode) { switch (mode) {
case STANDARD_STORE: case STANDARD_STORE:
return Builtin::kElementsTransitionAndStore_Standard; return BUILTIN_CODE(isolate, ElementsTransitionAndStore_Standard);
case STORE_AND_GROW_HANDLE_COW: case STORE_AND_GROW_HANDLE_COW:
return Builtin::kElementsTransitionAndStore_GrowNoTransitionHandleCOW; return BUILTIN_CODE(isolate,
ElementsTransitionAndStore_GrowNoTransitionHandleCOW);
case STORE_IGNORE_OUT_OF_BOUNDS: case STORE_IGNORE_OUT_OF_BOUNDS:
return Builtin::kElementsTransitionAndStore_NoTransitionIgnoreOOB; return BUILTIN_CODE(isolate,
ElementsTransitionAndStore_NoTransitionIgnoreOOB);
case STORE_HANDLE_COW: case STORE_HANDLE_COW:
return Builtin::kElementsTransitionAndStore_NoTransitionHandleCOW; return BUILTIN_CODE(isolate,
ElementsTransitionAndStore_NoTransitionHandleCOW);
default: default:
UNREACHABLE(); UNREACHABLE();
} }
......
...@@ -205,8 +205,7 @@ KeyedAccessStoreMode StoreHandler::GetKeyedAccessStoreMode( ...@@ -205,8 +205,7 @@ KeyedAccessStoreMode StoreHandler::GetKeyedAccessStoreMode(
Handle<Object> StoreHandler::StoreElementTransition( Handle<Object> StoreHandler::StoreElementTransition(
Isolate* isolate, Handle<Map> receiver_map, Handle<Map> transition, Isolate* isolate, Handle<Map> receiver_map, Handle<Map> transition,
KeyedAccessStoreMode store_mode, MaybeHandle<Object> prev_validity_cell) { KeyedAccessStoreMode store_mode, MaybeHandle<Object> prev_validity_cell) {
Handle<Object> code = Handle<Object> code = ElementsTransitionAndStoreBuiltin(isolate, store_mode);
MakeCodeHandler(isolate, ElementsTransitionAndStoreBuiltin(store_mode));
Handle<Object> validity_cell; Handle<Object> validity_cell;
if (!prev_validity_cell.ToHandle(&validity_cell)) { if (!prev_validity_cell.ToHandle(&validity_cell)) {
validity_cell = validity_cell =
......
...@@ -354,10 +354,12 @@ class StoreHandler final : public DataHandler { ...@@ -354,10 +354,12 @@ class StoreHandler final : public DataHandler {
// Creates a Smi-handler for storing a property to an interceptor. // Creates a Smi-handler for storing a property to an interceptor.
static inline Handle<Smi> StoreInterceptor(Isolate* isolate); static inline Handle<Smi> StoreInterceptor(Isolate* isolate);
static inline Builtin StoreSloppyArgumentsBuiltin(KeyedAccessStoreMode mode); static inline Handle<CodeT> StoreSloppyArgumentsBuiltin(
static inline Builtin StoreFastElementBuiltin(KeyedAccessStoreMode mode); Isolate* isolate, KeyedAccessStoreMode mode);
static inline Builtin ElementsTransitionAndStoreBuiltin( static inline Handle<CodeT> StoreFastElementBuiltin(
KeyedAccessStoreMode mode); Isolate* isolate, KeyedAccessStoreMode mode);
static inline Handle<CodeT> ElementsTransitionAndStoreBuiltin(
Isolate* isolate, KeyedAccessStoreMode mode);
// Creates a Smi-handler for storing a property. // Creates a Smi-handler for storing a property.
static inline Handle<Smi> StoreSlow( static inline Handle<Smi> StoreSlow(
......
...@@ -924,10 +924,6 @@ Handle<Smi> MakeLoadWasmStructFieldHandler(Isolate* isolate, ...@@ -924,10 +924,6 @@ Handle<Smi> MakeLoadWasmStructFieldHandler(Isolate* isolate,
} // namespace } // namespace
Handle<Object> IC::CodeHandler(Builtin builtin) {
return MakeCodeHandler(isolate(), builtin);
}
Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) { Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
Handle<Object> receiver = lookup->GetReceiver(); Handle<Object> receiver = lookup->GetReceiver();
ReadOnlyRoots roots(isolate()); ReadOnlyRoots roots(isolate());
...@@ -940,13 +936,13 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) { ...@@ -940,13 +936,13 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
if (lookup_start_object->IsString() && if (lookup_start_object->IsString() &&
*lookup->name() == roots.length_string()) { *lookup->name() == roots.length_string()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_StringLength); TRACE_HANDLER_STATS(isolate(), LoadIC_StringLength);
return CodeHandler(Builtin::kLoadIC_StringLength); return BUILTIN_CODE(isolate(), LoadIC_StringLength);
} }
if (lookup_start_object->IsStringWrapper() && if (lookup_start_object->IsStringWrapper() &&
*lookup->name() == roots.length_string()) { *lookup->name() == roots.length_string()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_StringWrapperLength); TRACE_HANDLER_STATS(isolate(), LoadIC_StringWrapperLength);
return CodeHandler(Builtin::kLoadIC_StringWrapperLength); return BUILTIN_CODE(isolate(), LoadIC_StringWrapperLength);
} }
// Use specialized code for getting prototype of functions. // Use specialized code for getting prototype of functions.
...@@ -955,7 +951,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) { ...@@ -955,7 +951,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
!JSFunction::cast(*lookup_start_object) !JSFunction::cast(*lookup_start_object)
.PrototypeRequiresRuntimeLookup()) { .PrototypeRequiresRuntimeLookup()) {
TRACE_HANDLER_STATS(isolate(), LoadIC_FunctionPrototypeStub); TRACE_HANDLER_STATS(isolate(), LoadIC_FunctionPrototypeStub);
return CodeHandler(Builtin::kLoadIC_FunctionPrototype); return BUILTIN_CODE(isolate(), LoadIC_FunctionPrototype);
} }
} }
...@@ -1356,8 +1352,8 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map, ...@@ -1356,8 +1352,8 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map,
!receiver_map->GetIndexedInterceptor().non_masking()) { !receiver_map->GetIndexedInterceptor().non_masking()) {
// TODO(jgruber): Update counter name. // TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_LoadIndexedInterceptorStub); TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_LoadIndexedInterceptorStub);
return IsAnyHas() ? CodeHandler(Builtin::kHasIndexedInterceptorIC) return IsAnyHas() ? BUILTIN_CODE(isolate(), HasIndexedInterceptorIC)
: CodeHandler(Builtin::kLoadIndexedInterceptorIC); : BUILTIN_CODE(isolate(), LoadIndexedInterceptorIC);
} }
InstanceType instance_type = receiver_map->instance_type(); InstanceType instance_type = receiver_map->instance_type();
...@@ -1385,8 +1381,8 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map, ...@@ -1385,8 +1381,8 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map,
if (IsSloppyArgumentsElementsKind(elements_kind)) { if (IsSloppyArgumentsElementsKind(elements_kind)) {
// TODO(jgruber): Update counter name. // TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_KeyedLoadSloppyArgumentsStub); TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_KeyedLoadSloppyArgumentsStub);
return IsAnyHas() ? CodeHandler(Builtin::kKeyedHasIC_SloppyArguments) return IsAnyHas() ? BUILTIN_CODE(isolate(), KeyedHasIC_SloppyArguments)
: CodeHandler(Builtin::kKeyedLoadIC_SloppyArguments); : BUILTIN_CODE(isolate(), KeyedLoadIC_SloppyArguments);
} }
bool is_js_array = instance_type == JS_ARRAY_TYPE; bool is_js_array = instance_type == JS_ARRAY_TYPE;
if (elements_kind == DICTIONARY_ELEMENTS) { if (elements_kind == DICTIONARY_ELEMENTS) {
...@@ -2345,13 +2341,13 @@ Handle<Object> KeyedStoreIC::StoreElementHandler( ...@@ -2345,13 +2341,13 @@ Handle<Object> KeyedStoreIC::StoreElementHandler(
if (receiver_map->has_sloppy_arguments_elements()) { if (receiver_map->has_sloppy_arguments_elements()) {
// TODO(jgruber): Update counter name. // TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_KeyedStoreSloppyArgumentsStub); TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_KeyedStoreSloppyArgumentsStub);
code = CodeHandler(StoreHandler::StoreSloppyArgumentsBuiltin(store_mode)); code = StoreHandler::StoreSloppyArgumentsBuiltin(isolate(), store_mode);
} else if (receiver_map->has_fast_elements() || } else if (receiver_map->has_fast_elements() ||
receiver_map->has_sealed_elements() || receiver_map->has_sealed_elements() ||
receiver_map->has_nonextensible_elements() || receiver_map->has_nonextensible_elements() ||
receiver_map->has_typed_array_or_rab_gsab_typed_array_elements()) { receiver_map->has_typed_array_or_rab_gsab_typed_array_elements()) {
TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreFastElementStub); TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreFastElementStub);
code = CodeHandler(StoreHandler::StoreFastElementBuiltin(store_mode)); code = StoreHandler::StoreFastElementBuiltin(isolate(), store_mode);
if (receiver_map->has_typed_array_or_rab_gsab_typed_array_elements()) { if (receiver_map->has_typed_array_or_rab_gsab_typed_array_elements()) {
return code; return code;
} }
......
...@@ -79,8 +79,6 @@ class IC { ...@@ -79,8 +79,6 @@ class IC {
bool is_vector_set() { return vector_set_; } bool is_vector_set() { return vector_set_; }
inline bool vector_needs_update(); inline bool vector_needs_update();
inline Handle<Object> CodeHandler(Builtin builtin);
// Configure for most states. // Configure for most states.
bool ConfigureVectorState(IC::State new_state, Handle<Object> key); bool ConfigureVectorState(IC::State new_state, Handle<Object> key);
// Configure the vector for MONOMORPHIC. // Configure the vector for MONOMORPHIC.
......
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