Commit 7b417038 authored by Théotime Grohens's avatar Théotime Grohens Committed by Commit Bot

[torque][cleanup] Move ToBoolean to base.tq

This CL moves the ToBoolean function from data-view.tq to base.tq.

It used to be in data-view.tq because we couldn't call macros
from one file to the other but this has been fixed now, and it
makes more sense to have it there.

Change-Id: Id201979eacbeb4307ff7d515db48377490d5bed7
Reviewed-on: https://chromium-review.googlesource.com/1104683Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Théotime Grohens <theotime@google.com>
Cr-Commit-Position: refs/heads/master@{#53837}
parent f5a8352b
......@@ -668,3 +668,15 @@ macro NumberIsNaN(number: Number): bool {
let value: float64 = convert<float64>(unsafe_cast<HeapNumber>(number));
return value != value;
}
extern macro BranchIfToBooleanIsTrue(Object): never labels Taken, NotTaken;
macro ToBoolean(obj: Object): bool {
try {
BranchIfToBooleanIsTrue(obj) otherwise Taken, NotTaken;
} label Taken {
return true;
} label NotTaken {
return false;
}
}
......@@ -59,20 +59,6 @@ module data_view {
return data_view.byte_offset;
}
extern macro BranchIfToBooleanIsTrue(Object): never labels Taken, NotTaken;
// TODO(theotime): This function should be moved to base.tq, we can't call
// functions that were defined in another Torque file for now.
macro ToBoolean(obj: Object): bool {
try {
BranchIfToBooleanIsTrue(obj) otherwise Taken, NotTaken;
} label Taken {
return true;
} label NotTaken {
return false;
}
}
extern macro BitcastInt32ToFloat32(word32): float32;
extern macro BitcastFloat32ToInt32(float32): word32;
extern macro Float64ExtractLowWord32(float64): word32;
......
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