summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sbe/vm/vm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/sbe/vm/vm.cpp')
-rw-r--r--src/mongo/db/exec/sbe/vm/vm.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/exec/sbe/vm/vm.cpp b/src/mongo/db/exec/sbe/vm/vm.cpp
index b5890497f45..ba7c849431b 100644
--- a/src/mongo/db/exec/sbe/vm/vm.cpp
+++ b/src/mongo/db/exec/sbe/vm/vm.cpp
@@ -96,6 +96,7 @@ int Instruction::stackOffset[Instruction::Tags::lastInstruction] = {
0, // isString
0, // isNumber
0, // isBinData
+ 0, // isDate
0, // typeMatch
0, // function is special, the stack offset is encoded in the instruction itself
@@ -314,6 +315,10 @@ void CodeFragment::appendIsBinData() {
appendSimpleInstruction(Instruction::isBinData);
}
+void CodeFragment::appendIsDate() {
+ appendSimpleInstruction(Instruction::isDate);
+}
+
void CodeFragment::appendTypeMatch(uint32_t typeMask) {
Instruction i;
i.tag = Instruction::typeMatch;
@@ -1814,6 +1819,18 @@ std::tuple<uint8_t, value::TypeTags, value::Value> ByteCode::run(const CodeFragm
}
break;
}
+ case Instruction::isDate: {
+ auto [owned, tag, val] = getFromStack(0);
+
+ if (tag != value::TypeTags::Nothing) {
+ topStack(false, value::TypeTags::Boolean, tag == value::TypeTags::Date);
+ }
+
+ if (owned) {
+ value::releaseValue(tag, val);
+ }
+ break;
+ }
case Instruction::typeMatch: {
auto typeMask = value::readFromMemory<uint32_t>(pcPointer);
pcPointer += sizeof(typeMask);