Commit bd9a71c9 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[cleanup] Remove unused IsTypedArray runtime function

This CL also removes the corresponding intrinsic lowering of
IsTypedArray in TurboFan and Ignition.

Drive-by: Remove unused ArrayBufferViewWasDetached runtime function.

Bug: v8:9183
Change-Id: I2767b22fbdfb679cba30b9fbc555c8d41c7f4345
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1617930Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61677}
parent be014256
......@@ -66,8 +66,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceGeneratorGetResumeMode(node);
case Runtime::kInlineIsArray:
return ReduceIsInstanceType(node, JS_ARRAY_TYPE);
case Runtime::kInlineIsTypedArray:
return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
case Runtime::kInlineIsJSReceiver:
return ReduceIsJSReceiver(node);
case Runtime::kInlineIsSmi:
......
......@@ -205,7 +205,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) {
case Runtime::kInlineIsJSReceiver:
case Runtime::kInlineIsRegExp:
case Runtime::kInlineIsSmi:
case Runtime::kInlineIsTypedArray:
return false;
default:
......
......@@ -1809,7 +1809,6 @@ Type Typer::Visitor::TypeJSCallRuntime(Node* node) {
case Runtime::kInlineIsSmi:
return TypeUnaryOp(node, ObjectIsSmi);
case Runtime::kInlineIsArray:
case Runtime::kInlineIsTypedArray:
case Runtime::kInlineIsRegExp:
return Type::Boolean();
case Runtime::kInlineCreateIterResultObject:
......
......@@ -255,7 +255,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
V(IsJSReceiver) \
V(IsRegExp) \
V(IsSmi) \
V(IsTypedArray) \
/* Loads */ \
V(LoadLookupSlotForCall) \
V(GetProperty) \
......
......@@ -159,12 +159,6 @@ Node* IntrinsicsGenerator::IsArray(
return IsInstanceType(input, JS_ARRAY_TYPE);
}
Node* IntrinsicsGenerator::IsTypedArray(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
return IsInstanceType(input, JS_TYPED_ARRAY_TYPE);
}
Node* IntrinsicsGenerator::IsSmi(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
......
......@@ -36,7 +36,6 @@ namespace interpreter {
V(IsArray, is_array, 1) \
V(IsJSReceiver, is_js_receiver, 1) \
V(IsSmi, is_smi, 1) \
V(IsTypedArray, is_typed_array, 1) \
V(ToStringRT, to_string, 1) \
V(ToLength, to_length, 1) \
V(ToObject, to_object, 1)
......
......@@ -60,12 +60,6 @@ RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) {
return accessor->CopyElements(source, target, length);
}
RUNTIME_FUNCTION(Runtime_ArrayBufferViewWasDetached) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(JSTypedArray::cast(args[0])->WasDetached());
}
RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......@@ -173,12 +167,6 @@ RUNTIME_FUNCTION(Runtime_TypedArraySortFast) {
return *array;
}
RUNTIME_FUNCTION(Runtime_IsTypedArray) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(args[0]->IsJSTypedArray());
}
// 22.2.3.23 %TypedArray%.prototype.set ( overloaded [ , offset ] )
RUNTIME_FUNCTION(Runtime_TypedArraySet) {
HandleScope scope(isolate);
......
......@@ -515,8 +515,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_TYPEDARRAY(F, I) \
F(ArrayBufferDetach, 1, 1) \
F(ArrayBufferViewWasDetached, 1, 1) \
I(IsTypedArray, 1, 1) \
F(TypedArrayCopyElements, 3, 1) \
F(TypedArrayGetBuffer, 1, 1) \
F(TypedArraySet, 2, 1) \
......
......@@ -95,37 +95,6 @@ TEST(IsArray) {
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42")));
}
TEST(IsTypedArray) {
HandleAndZoneScope handles;
InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
Runtime::kInlineIsTypedArray);
Factory* factory = handles.main_isolate()->factory();
CHECK_EQ(*factory->false_value(),
*helper.Invoke(helper.NewObject("new Date()")));
CHECK_EQ(*factory->false_value(),
*helper.Invoke(helper.NewObject("(function() {})")));
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])")));
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})")));
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)")));
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined()));
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null()));
CHECK_EQ(*factory->false_value(),
*helper.Invoke(helper.NewObject("'string'")));
CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42")));
CHECK_EQ(
*factory->true_value(),
*helper.Invoke(helper.NewObject("new Uint8Array(new ArrayBuffer(1));")));
CHECK_EQ(
*factory->true_value(),
*helper.Invoke(helper.NewObject("new Uint16Array(new ArrayBuffer(2));")));
CHECK_EQ(
*factory->true_value(),
*helper.Invoke(helper.NewObject("new Int32Array(new ArrayBuffer(4));")));
}
TEST(IsSmi) {
HandleAndZoneScope handles;
......
......@@ -96,37 +96,6 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsArray) {
}
// -----------------------------------------------------------------------------
// %_IsTypedArray
TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) {
Node* const input = Parameter(0);
Node* const context = Parameter(1);
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->CallRuntime(Runtime::kInlineIsTypedArray, 1), input,
context, effect, control));
ASSERT_TRUE(r.Changed());
Node* phi = r.replacement();
Capture<Node*> branch, if_false;
EXPECT_THAT(
phi,
IsPhi(
MachineRepresentation::kTagged, IsFalseConstant(),
IsNumberEqual(IsLoadField(AccessBuilder::ForMapInstanceType(),
IsLoadField(AccessBuilder::ForMap(), input,
effect, CaptureEq(&if_false)),
_, _),
IsNumberConstant(JS_TYPED_ARRAY_TYPE)),
IsMerge(IsIfTrue(AllOf(CaptureEq(&branch),
IsBranch(IsObjectIsSmi(input), control))),
AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
}
// -----------------------------------------------------------------------------
// %_IsJSReceiver
......
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