diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /js/src/jit/WarpBuilder.cpp | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit/WarpBuilder.cpp')
-rw-r--r-- | js/src/jit/WarpBuilder.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/js/src/jit/WarpBuilder.cpp b/js/src/jit/WarpBuilder.cpp index cad28fa535..4ca882c4b1 100644 --- a/js/src/jit/WarpBuilder.cpp +++ b/js/src/jit/WarpBuilder.cpp @@ -21,6 +21,7 @@ #include "vm/GeneratorObject.h" #include "vm/Interpreter.h" #include "vm/Opcodes.h" +#include "vm/TypeofEqOperand.h" // TypeofEqOperand #include "gc/ObjectKind-inl.h" #include "vm/BytecodeIterator-inl.h" @@ -1564,6 +1565,30 @@ bool WarpBuilder::build_TypeofExpr(BytecodeLocation loc) { return build_Typeof(loc); } +bool WarpBuilder::build_TypeofEq(BytecodeLocation loc) { + auto operand = loc.getTypeofEqOperand(); + JSType type = operand.type(); + JSOp compareOp = operand.compareOp(); + MDefinition* input = current->pop(); + + if (const auto* typesSnapshot = getOpSnapshot<WarpPolymorphicTypes>(loc)) { + auto* typeOf = MTypeOf::New(alloc(), input); + typeOf->setObservedTypes(typesSnapshot->list()); + current->add(typeOf); + + auto* typeInt = MConstant::New(alloc(), Int32Value(type)); + current->add(typeInt); + + auto* ins = MCompare::New(alloc(), typeOf, typeInt, compareOp, + MCompare::Compare_Int32); + current->add(ins); + current->push(ins); + return true; + } + + return buildIC(loc, CacheKind::TypeOfEq, {input}); +} + bool WarpBuilder::build_Arguments(BytecodeLocation loc) { auto* snapshot = getOpSnapshot<WarpArguments>(loc); MOZ_ASSERT(info().needsArgsObj()); @@ -3402,6 +3427,23 @@ bool WarpBuilder::buildIC(BytecodeLocation loc, CacheKind kind, current->push(ins); return true; } + case CacheKind::TypeOfEq: { + MOZ_ASSERT(numInputs == 1); + auto operand = loc.getTypeofEqOperand(); + JSType type = operand.type(); + JSOp compareOp = operand.compareOp(); + auto* typeOf = MTypeOf::New(alloc(), getInput(0)); + current->add(typeOf); + + auto* typeInt = MConstant::New(alloc(), Int32Value(type)); + current->add(typeInt); + + auto* ins = MCompare::New(alloc(), typeOf, typeInt, compareOp, + MCompare::Compare_Int32); + current->add(ins); + current->push(ins); + return true; + } case CacheKind::NewObject: { auto* templateConst = constant(NullValue()); MNewObject* ins = MNewObject::NewVM( @@ -3482,6 +3524,7 @@ bool WarpBuilder::buildBailoutForColdIC(BytecodeLocation loc, CacheKind kind) { case CacheKind::CheckPrivateField: case CacheKind::InstanceOf: case CacheKind::OptimizeGetIterator: + case CacheKind::TypeOfEq: resultType = MIRType::Boolean; break; case CacheKind::SetProp: |