Commit 7ab3fff7 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Cleanup][CSA] TNodify ThrowRange/TypeError.

BUG=v8:10021

Change-Id: I4057928dcac9cbca58fe329dc7c65d6c11699de9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995389
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65709}
parent 8b5596ba
......@@ -5568,43 +5568,52 @@ void CodeStubAssembler::ThrowIfNotCallable(TNode<Context> context,
BIND(&out);
}
void CodeStubAssembler::ThrowRangeError(Node* context, MessageTemplate message,
Node* arg0, Node* arg1, Node* arg2) {
void CodeStubAssembler::ThrowRangeError(TNode<Context> context,
MessageTemplate message,
base::Optional<TNode<Object>> arg0,
base::Optional<TNode<Object>> arg1,
base::Optional<TNode<Object>> arg2) {
TNode<Smi> template_index = SmiConstant(static_cast<int>(message));
if (arg0 == nullptr) {
if (!arg0) {
CallRuntime(Runtime::kThrowRangeError, context, template_index);
} else if (arg1 == nullptr) {
CallRuntime(Runtime::kThrowRangeError, context, template_index, arg0);
} else if (arg2 == nullptr) {
CallRuntime(Runtime::kThrowRangeError, context, template_index, arg0, arg1);
} else if (!arg1) {
CallRuntime(Runtime::kThrowRangeError, context, template_index, *arg0);
} else if (!arg2) {
CallRuntime(Runtime::kThrowRangeError, context, template_index, *arg0,
*arg1);
} else {
CallRuntime(Runtime::kThrowRangeError, context, template_index, arg0, arg1,
arg2);
CallRuntime(Runtime::kThrowRangeError, context, template_index, *arg0,
*arg1, *arg2);
}
Unreachable();
}
void CodeStubAssembler::ThrowTypeError(Node* context, MessageTemplate message,
void CodeStubAssembler::ThrowTypeError(TNode<Context> context,
MessageTemplate message,
char const* arg0, char const* arg1) {
Node* arg0_node = nullptr;
base::Optional<TNode<Object>> arg0_node;
if (arg0) arg0_node = StringConstant(arg0);
Node* arg1_node = nullptr;
base::Optional<TNode<Object>> arg1_node;
if (arg1) arg1_node = StringConstant(arg1);
ThrowTypeError(context, message, arg0_node, arg1_node);
}
void CodeStubAssembler::ThrowTypeError(Node* context, MessageTemplate message,
Node* arg0, Node* arg1, Node* arg2) {
void CodeStubAssembler::ThrowTypeError(TNode<Context> context,
MessageTemplate message,
base::Optional<TNode<Object>> arg0,
base::Optional<TNode<Object>> arg1,
base::Optional<TNode<Object>> arg2) {
TNode<Smi> template_index = SmiConstant(static_cast<int>(message));
if (arg0 == nullptr) {
if (!arg0) {
CallRuntime(Runtime::kThrowTypeError, context, template_index);
} else if (arg1 == nullptr) {
CallRuntime(Runtime::kThrowTypeError, context, template_index, arg0);
} else if (arg2 == nullptr) {
CallRuntime(Runtime::kThrowTypeError, context, template_index, arg0, arg1);
} else if (!arg1) {
CallRuntime(Runtime::kThrowTypeError, context, template_index, *arg0);
} else if (!arg2) {
CallRuntime(Runtime::kThrowTypeError, context, template_index, *arg0,
*arg1);
} else {
CallRuntime(Runtime::kThrowTypeError, context, template_index, arg0, arg1,
arg2);
CallRuntime(Runtime::kThrowTypeError, context, template_index, *arg0, *arg1,
*arg2);
}
Unreachable();
}
......
......@@ -2433,13 +2433,16 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
void ThrowIfNotCallable(TNode<Context> context, TNode<Object> value,
const char* method_name);
void ThrowRangeError(Node* context, MessageTemplate message,
Node* arg0 = nullptr, Node* arg1 = nullptr,
Node* arg2 = nullptr);
void ThrowTypeError(Node* context, MessageTemplate message,
void ThrowRangeError(TNode<Context> context, MessageTemplate message,
base::Optional<TNode<Object>> arg0 = base::nullopt,
base::Optional<TNode<Object>> arg1 = base::nullopt,
base::Optional<TNode<Object>> arg2 = base::nullopt);
void ThrowTypeError(TNode<Context> context, MessageTemplate message,
char const* arg0 = nullptr, char const* arg1 = nullptr);
void ThrowTypeError(Node* context, MessageTemplate message, Node* arg0,
Node* arg1 = nullptr, Node* arg2 = nullptr);
void ThrowTypeError(TNode<Context> context, MessageTemplate message,
base::Optional<TNode<Object>> arg0,
base::Optional<TNode<Object>> arg1 = base::nullopt,
base::Optional<TNode<Object>> arg2 = base::nullopt);
// Type checks.
// Check whether the map is for an object with special properties, such as a
......
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