[cleanup] Remove is_null from tnode.h
Instead of checking for the null TNode, we can use base::Optional. Bug: v8:6949 Change-Id: I550b2fdb507c61ea6128a0631351b22a8542d4d3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2737296 Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org> Reviewed-by: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#73260}
This commit is contained in:
parent
f95db8916a
commit
b1c5a9a26f
@ -347,8 +347,6 @@ class TNode {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_null() const { return node_ == nullptr; }
|
|
||||||
|
|
||||||
operator compiler::Node*() const { return node_; }
|
operator compiler::Node*() const { return node_; }
|
||||||
|
|
||||||
static TNode UncheckedCast(compiler::Node* node) { return TNode(node); }
|
static TNode UncheckedCast(compiler::Node* node) { return TNode(node); }
|
||||||
|
@ -1088,7 +1088,7 @@ Node* CodeAssembler::CallStubRImpl(StubCallMode call_mode,
|
|||||||
Node* CodeAssembler::CallJSStubImpl(const CallInterfaceDescriptor& descriptor,
|
Node* CodeAssembler::CallJSStubImpl(const CallInterfaceDescriptor& descriptor,
|
||||||
TNode<Object> target, TNode<Object> context,
|
TNode<Object> target, TNode<Object> context,
|
||||||
TNode<Object> function,
|
TNode<Object> function,
|
||||||
TNode<Object> new_target,
|
base::Optional<TNode<Object>> new_target,
|
||||||
TNode<Int32T> arity,
|
TNode<Int32T> arity,
|
||||||
std::initializer_list<Node*> args) {
|
std::initializer_list<Node*> args) {
|
||||||
constexpr size_t kMaxNumArgs = 10;
|
constexpr size_t kMaxNumArgs = 10;
|
||||||
@ -1096,8 +1096,8 @@ Node* CodeAssembler::CallJSStubImpl(const CallInterfaceDescriptor& descriptor,
|
|||||||
NodeArray<kMaxNumArgs + 5> inputs;
|
NodeArray<kMaxNumArgs + 5> inputs;
|
||||||
inputs.Add(target);
|
inputs.Add(target);
|
||||||
inputs.Add(function);
|
inputs.Add(function);
|
||||||
if (!new_target.is_null()) {
|
if (new_target) {
|
||||||
inputs.Add(new_target);
|
inputs.Add(*new_target);
|
||||||
}
|
}
|
||||||
inputs.Add(arity);
|
inputs.Add(arity);
|
||||||
for (auto arg : args) inputs.Add(arg);
|
for (auto arg : args) inputs.Add(arg);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
// Do not include anything from src/compiler here!
|
// Do not include anything from src/compiler here!
|
||||||
#include "include/cppgc/source-location.h"
|
#include "include/cppgc/source-location.h"
|
||||||
#include "src/base/macros.h"
|
#include "src/base/macros.h"
|
||||||
|
#include "src/base/optional.h"
|
||||||
#include "src/base/type-traits.h"
|
#include "src/base/type-traits.h"
|
||||||
#include "src/builtins/builtins.h"
|
#include "src/builtins/builtins.h"
|
||||||
#include "src/codegen/code-factory.h"
|
#include "src/codegen/code-factory.h"
|
||||||
@ -1136,8 +1137,7 @@ class V8_EXPORT_PRIVATE CodeAssembler {
|
|||||||
TNode<Int32T> arity = Int32Constant(argc);
|
TNode<Int32T> arity = Int32Constant(argc);
|
||||||
TNode<Code> target = HeapConstant(callable.code());
|
TNode<Code> target = HeapConstant(callable.code());
|
||||||
return CAST(CallJSStubImpl(callable.descriptor(), target, CAST(context),
|
return CAST(CallJSStubImpl(callable.descriptor(), target, CAST(context),
|
||||||
CAST(function), TNode<Object>(), arity,
|
CAST(function), {}, arity, {receiver, args...}));
|
||||||
{receiver, args...}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... TArgs>
|
template <class... TArgs>
|
||||||
@ -1267,7 +1267,8 @@ class V8_EXPORT_PRIVATE CodeAssembler {
|
|||||||
|
|
||||||
Node* CallJSStubImpl(const CallInterfaceDescriptor& descriptor,
|
Node* CallJSStubImpl(const CallInterfaceDescriptor& descriptor,
|
||||||
TNode<Object> target, TNode<Object> context,
|
TNode<Object> target, TNode<Object> context,
|
||||||
TNode<Object> function, TNode<Object> new_target,
|
TNode<Object> function,
|
||||||
|
base::Optional<TNode<Object>> new_target,
|
||||||
TNode<Int32T> arity, std::initializer_list<Node*> args);
|
TNode<Int32T> arity, std::initializer_list<Node*> args);
|
||||||
|
|
||||||
Node* CallStubN(StubCallMode call_mode,
|
Node* CallStubN(StubCallMode call_mode,
|
||||||
|
@ -1479,12 +1479,12 @@ struct MapFrameStateParams {
|
|||||||
TNode<Object> receiver;
|
TNode<Object> receiver;
|
||||||
TNode<Object> callback;
|
TNode<Object> callback;
|
||||||
TNode<Object> this_arg;
|
TNode<Object> this_arg;
|
||||||
TNode<JSArray> a;
|
base::Optional<TNode<JSArray>> a;
|
||||||
TNode<Object> original_length;
|
TNode<Object> original_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
FrameState MapPreLoopLazyFrameState(const MapFrameStateParams& params) {
|
FrameState MapPreLoopLazyFrameState(const MapFrameStateParams& params) {
|
||||||
DCHECK(params.a.is_null());
|
DCHECK(!params.a);
|
||||||
Node* checkpoint_params[] = {params.receiver, params.callback,
|
Node* checkpoint_params[] = {params.receiver, params.callback,
|
||||||
params.this_arg, params.original_length};
|
params.this_arg, params.original_length};
|
||||||
return CreateJavaScriptBuiltinContinuationFrameState(
|
return CreateJavaScriptBuiltinContinuationFrameState(
|
||||||
@ -1497,7 +1497,7 @@ FrameState MapPreLoopLazyFrameState(const MapFrameStateParams& params) {
|
|||||||
FrameState MapLoopLazyFrameState(const MapFrameStateParams& params,
|
FrameState MapLoopLazyFrameState(const MapFrameStateParams& params,
|
||||||
TNode<Number> k) {
|
TNode<Number> k) {
|
||||||
Node* checkpoint_params[] = {
|
Node* checkpoint_params[] = {
|
||||||
params.receiver, params.callback, params.this_arg, params.a, k,
|
params.receiver, params.callback, params.this_arg, *params.a, k,
|
||||||
params.original_length};
|
params.original_length};
|
||||||
return CreateJavaScriptBuiltinContinuationFrameState(
|
return CreateJavaScriptBuiltinContinuationFrameState(
|
||||||
params.jsgraph, params.shared,
|
params.jsgraph, params.shared,
|
||||||
@ -1509,7 +1509,7 @@ FrameState MapLoopLazyFrameState(const MapFrameStateParams& params,
|
|||||||
FrameState MapLoopEagerFrameState(const MapFrameStateParams& params,
|
FrameState MapLoopEagerFrameState(const MapFrameStateParams& params,
|
||||||
TNode<Number> k) {
|
TNode<Number> k) {
|
||||||
Node* checkpoint_params[] = {
|
Node* checkpoint_params[] = {
|
||||||
params.receiver, params.callback, params.this_arg, params.a, k,
|
params.receiver, params.callback, params.this_arg, *params.a, k,
|
||||||
params.original_length};
|
params.original_length};
|
||||||
return CreateJavaScriptBuiltinContinuationFrameState(
|
return CreateJavaScriptBuiltinContinuationFrameState(
|
||||||
params.jsgraph, params.shared,
|
params.jsgraph, params.shared,
|
||||||
|
Loading…
Reference in New Issue
Block a user