[torque] Add constexpr int31 equality operator
This CL adds a constexpr int31 == operator that returns a constexpr bool value. It also fixes a bug that this introduces because branch generation for ternary operators incorrectly assumed that the condition value was bool, whereas it can also be constexpr bool now. Change-Id: Ie7d3497c9d1112c121b4a29561fe065b5bf01fb6 Reviewed-on: https://chromium-review.googlesource.com/1106343 Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Théotime Grohens <theotime@google.com> Cr-Commit-Position: refs/heads/master@{#53867}
This commit is contained in:
parent
ca3c2b59ed
commit
d020584ac7
@ -250,6 +250,8 @@ extern operator '-' macro Int32Sub(int32, int32): int32;
|
||||
extern operator '*' macro Int32Mul(int32, int32): int32;
|
||||
extern operator '%' macro Int32Mod(int32, int32): int32;
|
||||
extern operator '&' macro Word32And(word32, word32): int32;
|
||||
extern operator '==' macro
|
||||
ConstexprInt31Equal(constexpr int31, constexpr int31): constexpr bool;
|
||||
|
||||
extern operator '==' macro Word32Equal(word32, word32): bool;
|
||||
extern operator '!=' macro Word32NotEqual(word32, word32): bool;
|
||||
|
@ -2623,6 +2623,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
|
||||
|
||||
bool ConstexprBoolNot(bool value) { return !value; }
|
||||
|
||||
bool ConstexprInt31Equal(int31_t a, int31_t b) { return a == b; }
|
||||
|
||||
void PerformStackCheck(TNode<Context> context);
|
||||
|
||||
protected:
|
||||
|
@ -351,9 +351,10 @@ VisitResult ImplementationVisitor::Visit(ConditionalExpression* expr) {
|
||||
|
||||
VisitResult condition_result = Visit(expr->condition);
|
||||
if (!condition_result.type()->IsNever()) {
|
||||
condition_result =
|
||||
GenerateImplicitConvert(TypeOracle::GetBoolType(), condition_result);
|
||||
GenerateBranch(condition_result, true_label, false_label);
|
||||
}
|
||||
|
||||
GenerateLabelBind(true_label);
|
||||
GenerateIndent();
|
||||
source_out() << result->GetValueForWrite() << " = " << f1 << "();"
|
||||
|
Loading…
Reference in New Issue
Block a user