Commit 10d6024d authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Cleanup][CSA] TNodify Print and MakeTypeError.

BUG=v8:10021

Change-Id: Ife3bdb70968c90813ea96e3eaacaa78712ba5540
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1995396
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65729}
parent 75c11b86
......@@ -86,8 +86,8 @@ void AsyncFromSyncBuiltinsAssembler::ThrowIfNotAsyncFromSyncIterator(
// Let badIteratorError be a new TypeError exception.
TNode<HeapObject> error =
CAST(MakeTypeError(MessageTemplate::kIncompatibleMethodReceiver,
context, StringConstant(method_name), object));
MakeTypeError(MessageTemplate::kIncompatibleMethodReceiver, context,
StringConstant(method_name), object);
// Perform ! Call(promiseCapability.[[Reject]], undefined,
// « badIteratorError »).
......@@ -221,8 +221,8 @@ AsyncFromSyncBuiltinsAssembler::LoadIteratorResult(
{
// Sync iterator result is not an object --- Produce a TypeError and jump
// to the `if_exception` path.
const TNode<Object> error = CAST(MakeTypeError(
MessageTemplate::kIteratorResultNotAnObject, context, iter_result));
const TNode<Object> error = MakeTypeError(
MessageTemplate::kIteratorResultNotAnObject, context, iter_result);
*var_exception = error;
Goto(if_exception);
}
......
......@@ -12994,7 +12994,8 @@ void CodeStubAssembler::Print(const char* s) {
StringConstant(formatted.c_str()));
}
void CodeStubAssembler::Print(const char* prefix, Node* tagged_value) {
void CodeStubAssembler::Print(const char* prefix,
SloppyTNode<MaybeObject> tagged_value) {
if (prefix != nullptr) {
std::string formatted(prefix);
formatted += ": ";
......@@ -13003,7 +13004,10 @@ void CodeStubAssembler::Print(const char* prefix, Node* tagged_value) {
CallRuntime(Runtime::kGlobalPrint, NoContextConstant(),
HeapConstant(string));
}
CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value);
// CallRuntime only accepts Objects, so do an UncheckedCast to object.
// DebugPrint explicitly checks whether the tagged value is a MaybeObject.
TNode<Object> arg = UncheckedCast<Object>(tagged_value);
CallRuntime(Runtime::kDebugPrint, NoContextConstant(), arg);
}
void CodeStubAssembler::PerformStackCheck(TNode<Context> context) {
......
......@@ -3608,18 +3608,19 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Support for printf-style debugging
void Print(const char* s);
void Print(const char* prefix, Node* tagged_value);
void Print(const char* prefix, SloppyTNode<MaybeObject> tagged_value);
void Print(SloppyTNode<MaybeObject> tagged_value) {
return Print(nullptr, tagged_value);
}
template <class... TArgs>
Node* MakeTypeError(MessageTemplate message, Node* context, TArgs... args) {
TNode<HeapObject> MakeTypeError(MessageTemplate message,
TNode<Context> context, TArgs... args) {
STATIC_ASSERT(sizeof...(TArgs) <= 3);
const TNode<Object> make_type_error = LoadContextElement(
LoadNativeContext(context), Context::MAKE_TYPE_ERROR_INDEX);
return CallJS(CodeFactory::Call(isolate()), context, make_type_error,
UndefinedConstant(), SmiConstant(message), args...);
return CAST(CallJS(CodeFactory::Call(isolate()), context, make_type_error,
UndefinedConstant(), SmiConstant(message), args...));
}
void Abort(AbortReason reason) {
......
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