diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 4a21a8a2f8de6c..27bd92a6a31889 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1094,7 +1094,7 @@ int32_t IndexOfNumber(const uint8_t* buffer_data, return ptr != nullptr ? static_cast(ptr_uint8 - buffer_data) : -1; } -void SlowIndexOfNumber(const FunctionCallbackInfo& args) { +void IndexOfNumber(const FunctionCallbackInfo& args) { CHECK(args[1]->IsUint32()); CHECK(args[2]->IsNumber()); CHECK(args[3]->IsBoolean()); @@ -1110,20 +1110,6 @@ void SlowIndexOfNumber(const FunctionCallbackInfo& args) { buffer.data(), buffer.length(), needle, offset_i64, is_forward)); } -int32_t FastIndexOfNumber(v8::Local, - const FastApiTypedArray& buffer, - uint32_t needle, - int64_t offset_i64, - bool is_forward) { - uint8_t* buffer_data; - CHECK(buffer.getStorageIfAligned(&buffer_data)); - return IndexOfNumber( - buffer_data, buffer.length(), needle, offset_i64, is_forward); -} - -static v8::CFunction fast_index_of_number( - v8::CFunction::Make(FastIndexOfNumber)); - void Swap16(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); THROW_AND_RETURN_UNLESS_BUFFER(env, args[0]); @@ -1434,11 +1420,7 @@ void Initialize(Local target, SetMethodNoSideEffect(context, target, "compareOffset", CompareOffset); SetMethod(context, target, "fill", Fill); SetMethodNoSideEffect(context, target, "indexOfBuffer", IndexOfBuffer); - SetFastMethodNoSideEffect(context, - target, - "indexOfNumber", - SlowIndexOfNumber, - &fast_index_of_number); + SetMethodNoSideEffect(context, target, "indexOfNumber", IndexOfNumber); SetMethodNoSideEffect(context, target, "indexOfString", IndexOfString); SetMethod(context, target, "detachArrayBuffer", DetachArrayBuffer); @@ -1497,9 +1479,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(CompareOffset); registry->Register(Fill); registry->Register(IndexOfBuffer); - registry->Register(SlowIndexOfNumber); - registry->Register(FastIndexOfNumber); - registry->Register(fast_index_of_number.GetTypeInfo()); + registry->Register(IndexOfNumber); registry->Register(IndexOfString); registry->Register(Swap16);