bool CodeOrigin::isApproximatelyEqualTo(const CodeOrigin& other) const { CodeOrigin a = *this; CodeOrigin b = other; if (!a.isSet()) return !b.isSet(); if (!b.isSet()) return false; if (a.isHashTableDeletedValue()) return b.isHashTableDeletedValue(); if (b.isHashTableDeletedValue()) return false; for (;;) { ASSERT(a.isSet()); ASSERT(b.isSet()); if (a.bytecodeIndex != b.bytecodeIndex) return false; if ((!!a.inlineCallFrame) != (!!b.inlineCallFrame)) return false; if (!a.inlineCallFrame) return true; if (a.inlineCallFrame->executable.get() != b.inlineCallFrame->executable.get()) return false; a = a.inlineCallFrame->caller; b = b.inlineCallFrame->caller; } }
void storeCodeOrigin(State& state, CCallHelpers& jit, CodeOrigin codeOrigin) { if (!codeOrigin.isSet()) return; unsigned index = state.jitCode->common.addCodeOrigin(codeOrigin); unsigned locationBits = CallFrame::Location::encodeAsCodeOriginIndex(index); jit.store32( CCallHelpers::TrustedImm32(locationBits), CCallHelpers::tagFor(static_cast<VirtualRegister>(JSStack::ArgumentCount))); }
OriginStack::OriginStack(Database& database, CodeBlock* codeBlock, const CodeOrigin& codeOrigin) { Vector<CodeOrigin> stack = codeOrigin.inlineStack(); append(Origin(database, codeBlock, stack[0].bytecodeIndex)); for (unsigned i = 1; i < stack.size(); ++i) { append(Origin( database.ensureBytecodesFor(stack[i].inlineCallFrame->baselineCodeBlock.get()), stack[i].bytecodeIndex)); } }