Commit 2345f952 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[cleanup] Cleanup unused macros/intrinsics.

This removes a couple of intrinsics/runtime functions/macros that are no
longer needed at all (or not in TurboFan for performance reasons).

Bug: v8:8015
Change-Id: I08ae8de7cc63019eb30d3b71dd1c824d6392076a
Reviewed-on: https://chromium-review.googlesource.com/1183481Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55277}
parent 0f5973d6
......@@ -56,10 +56,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
case Runtime::kInlineIsJSProxy:
return ReduceIsInstanceType(node, JS_PROXY_TYPE);
case Runtime::kInlineIsJSWeakMap:
return ReduceIsInstanceType(node, JS_WEAK_MAP_TYPE);
case Runtime::kInlineIsJSWeakSet:
return ReduceIsInstanceType(node, JS_WEAK_SET_TYPE);
case Runtime::kInlineIsJSReceiver:
return ReduceIsJSReceiver(node);
case Runtime::kInlineIsSmi:
......@@ -80,19 +76,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceToString(node);
case Runtime::kInlineCall:
return ReduceCall(node);
case Runtime::kInlineGetSuperConstructor:
return ReduceGetSuperConstructor(node);
case Runtime::kInlineArrayBufferViewWasNeutered:
return ReduceArrayBufferViewWasNeutered(node);
case Runtime::kInlineMaxSmi:
return ReduceMaxSmi(node);
case Runtime::kInlineTypedArrayGetLength:
return ReduceArrayBufferViewField(node,
AccessBuilder::ForJSTypedArrayLength());
case Runtime::kInlineTheHole:
return ReduceTheHole(node);
case Runtime::kInlineStringMaxLength:
return ReduceStringMaxLength(node);
default:
break;
}
......@@ -322,66 +305,6 @@ Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) {
return Changed(node);
}
Reduction JSIntrinsicLowering::ReduceArrayBufferViewField(
Node* node, FieldAccess const& access) {
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
// Load the {receiver}s field.
Node* value = effect = graph()->NewNode(simplified()->LoadField(access),
receiver, effect, control);
// Check if the {receiver}s buffer was neutered.
Node* receiver_buffer = effect = graph()->NewNode(
simplified()->LoadField(AccessBuilder::ForJSArrayBufferViewBuffer()),
receiver, effect, control);
Node* check = effect = graph()->NewNode(
simplified()->ArrayBufferWasNeutered(), receiver_buffer, effect, control);
// Default to zero if the {receiver}s buffer was neutered.
value = graph()->NewNode(
common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse),
check, jsgraph()->ZeroConstant(), value);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
}
Reduction JSIntrinsicLowering::ReduceArrayBufferViewWasNeutered(Node* node) {
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
// Check if the {receiver}s buffer was neutered.
Node* receiver_buffer = effect = graph()->NewNode(
simplified()->LoadField(AccessBuilder::ForJSArrayBufferViewBuffer()),
receiver, effect, control);
Node* value = effect = graph()->NewNode(
simplified()->ArrayBufferWasNeutered(), receiver_buffer, effect, control);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
}
Reduction JSIntrinsicLowering::ReduceMaxSmi(Node* node) {
Node* value = jsgraph()->Constant(Smi::kMaxValue);
ReplaceWithValue(node, value);
return Replace(value);
}
Reduction JSIntrinsicLowering::ReduceTheHole(Node* node) {
Node* value = jsgraph()->TheHoleConstant();
ReplaceWithValue(node, value);
return Replace(value);
}
Reduction JSIntrinsicLowering::ReduceStringMaxLength(Node* node) {
Node* value = jsgraph()->Constant(String::kMaxLength);
ReplaceWithValue(node, value);
return Replace(value);
}
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Node* b) {
RelaxControls(node);
......
......@@ -63,18 +63,6 @@ class V8_EXPORT_PRIVATE JSIntrinsicLowering final
Reduction ReduceCall(Node* node);
Reduction ReduceGetSuperConstructor(Node* node);
// TODO(turbofan): typedarray.js support; drop once TypedArrays are
// converted to proper CodeStubAssembler based builtins.
Reduction ReduceArrayBufferViewField(Node* node, FieldAccess const& access);
Reduction ReduceArrayBufferViewWasNeutered(Node* node);
Reduction ReduceMaxSmi(Node* node);
// TODO(turbofan): collection.js support; drop once Maps and Sets are
// converted to proper CodeStubAssembler based builtins.
Reduction ReduceTheHole(Node* node);
Reduction ReduceStringMaxLength(Node* node);
Reduction Change(Node* node, const Operator* op);
Reduction Change(Node* node, const Operator* op, Node* a, Node* b);
Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c);
......
......@@ -184,8 +184,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) {
case Runtime::kInlineGeneratorGetResumeMode:
case Runtime::kInlineCreateJSGeneratorObject:
case Runtime::kInlineIsArray:
case Runtime::kInlineIsJSWeakMap:
case Runtime::kInlineIsJSWeakSet:
case Runtime::kInlineIsJSReceiver:
case Runtime::kInlineIsRegExp:
case Runtime::kInlineIsSmi:
......
......@@ -270,8 +270,6 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
V(IsFunction) \
V(IsJSProxy) \
V(IsJSReceiver) \
V(IsJSWeakMap) \
V(IsJSWeakSet) \
V(IsRegExp) \
V(IsSmi) \
V(IsTypedArray) \
......
......@@ -171,18 +171,6 @@ Node* IntrinsicsGenerator::IsTypedArray(
return IsInstanceType(input, JS_TYPED_ARRAY_TYPE);
}
Node* IntrinsicsGenerator::IsJSWeakMap(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
return IsInstanceType(input, JS_WEAK_MAP_TYPE);
}
Node* IntrinsicsGenerator::IsJSWeakSet(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
return IsInstanceType(input, JS_WEAK_SET_TYPE);
}
Node* IntrinsicsGenerator::IsSmi(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
......
......@@ -30,8 +30,6 @@ namespace interpreter {
V(IsArray, is_array, 1) \
V(IsJSProxy, is_js_proxy, 1) \
V(IsJSReceiver, is_js_receiver, 1) \
V(IsJSWeakMap, is_js_weak_map, 1) \
V(IsJSWeakSet, is_js_weak_set, 1) \
V(IsSmi, is_smi, 1) \
V(IsTypedArray, is_typed_array, 1) \
V(RejectPromise, reject_promise, 3) \
......
......@@ -33,9 +33,6 @@ define READ_ONLY = 1;
define DONT_ENUM = 2;
define DONT_DELETE = 4;
# 2^53 - 1
define kMaxSafeInteger = 9007199254740991;
# 2^32 - 1
define kMaxUint32 = 4294967295;
......@@ -45,15 +42,12 @@ define kMaxUint32 = 4294967295;
# It will *not* generate a runtime typeof call for the most important
# values of 'bar'.
macro IS_ARRAY(arg) = (%_IsArray(arg));
macro IS_FUNCTION(arg) = (%IsFunction(arg));
macro IS_NULL(arg) = (arg === null);
macro IS_NULL_OR_UNDEFINED(arg) = (arg == null);
macro IS_NUMBER(arg) = (typeof(arg) === 'number');
macro IS_STRING(arg) = (typeof(arg) === 'string');
macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol');
macro IS_UNDEFINED(arg) = (arg === (void 0));
macro IS_WEAKMAP(arg) = (%_IsJSWeakMap(arg));
macro IS_WEAKSET(arg) = (%_IsJSWeakSet(arg));
# Macro for ES queries of the type: "Type(O) is Object."
macro IS_RECEIVER(arg) = (%_IsJSReceiver(arg));
......
......@@ -53,7 +53,7 @@ utils.Import(function(from) {
function ValidateTypedArray(array, methodName) {
if (!IS_TYPEDARRAY(array)) throw %make_type_error(kNotTypedArray);
if (%_ArrayBufferViewWasNeutered(array))
if (%ArrayBufferViewWasNeutered(array))
throw %make_type_error(kDetachedOperation, methodName);
}
......@@ -67,7 +67,7 @@ DEFINE_METHOD(
var locales = arguments[0];
var options = arguments[1];
var length = %_TypedArrayGetLength(this);
var length = %TypedArrayGetLength(this);
return InnerArrayToLocaleString(this, length, locales, options);
}
);
......@@ -79,7 +79,7 @@ DEFINE_METHOD(
join(separator) {
ValidateTypedArray(this, "%TypedArray%.prototype.join");
var length = %_TypedArrayGetLength(this);
var length = %TypedArrayGetLength(this);
return InnerArrayJoin(separator, this, length);
}
......
......@@ -833,19 +833,5 @@ RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Sloppy) {
LanguageMode::kSloppy));
}
RUNTIME_FUNCTION(Runtime_GetSuperConstructor) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(JSFunction, active_function, 0);
Object* prototype = active_function->map()->prototype();
if (!prototype->IsConstructor()) {
HandleScope scope(isolate);
return ThrowNotSuperConstructor(isolate, handle(prototype, isolate),
handle(active_function, isolate));
}
return prototype;
}
} // namespace internal
} // namespace v8
......@@ -142,19 +142,5 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
return *weak_collection;
}
RUNTIME_FUNCTION(Runtime_IsJSWeakMap) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, obj, 0);
return isolate->heap()->ToBoolean(obj->IsJSWeakMap());
}
RUNTIME_FUNCTION(Runtime_IsJSWeakSet) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, obj, 0);
return isolate->heap()->ToBoolean(obj->IsJSWeakSet());
}
} // namespace internal
} // namespace v8
......@@ -80,7 +80,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_CLASSES(F) \
F(DefineClass, -1 /* >= 3 */, 1) \
F(GetSuperConstructor, 1, 1) \
F(HomeObjectSymbol, 0, 1) \
F(LoadFromSuper, 3, 1) \
F(LoadKeyedFromSuper, 3, 1) \
......@@ -98,8 +97,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_COLLECTIONS(F) \
F(GetWeakMapEntries, 2, 1) \
F(GetWeakSetValues, 2, 1) \
F(IsJSWeakMap, 1, 1) \
F(IsJSWeakSet, 1, 1) \
F(MapGrow, 1, 1) \
F(MapIteratorClone, 1, 1) \
F(MapShrink, 1, 1) \
......
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