Ejemplo n.º 1
0
void JSStack::sanitizeStack()
{
    ASSERT(getTopOfStack() <= getBaseOfStack());
    
    if (m_lastStackTop < getTopOfStack()) {
        char* begin = reinterpret_cast<char*>(m_lastStackTop);
        char* end = reinterpret_cast<char*>(getTopOfStack());
        memset(begin, 0, end - begin);
    }
    
    m_lastStackTop = getTopOfStack();
}
// compute final result of responding postfix 
ElementType compute_postfix()
{
	Stack output;
	int i;
	ElementType *p;
	int value;
	int operand1;
	int operand2;
	 
	output = createStack(Size); // create stack with length Size
	i = 0;
	p = getArray(operand); // get operand->array

	while(i < getTopOfStack(operand))
	{
		value = *(p+i++);
		if(value == ' ')
			continue;
		if(isOperator(value))
		{
			operand1 = top(output);
			pop(output);

			operand2 = top(output);
			pop(output);

			value = computeResult(operand1, operand2, value);
			push(value, output);
			continue;
		}
		push(value - 48, output);
	}
	return getArray(output)[0];
}
Ejemplo n.º 3
0
void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
{
    conservativeRoots.add(getBaseOfStack(), getTopOfStack());
}
Ejemplo n.º 4
0
void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks)
{
    conservativeRoots.add(getBaseOfStack(), getTopOfStack(), jitStubRoutines, codeBlocks);
}