Example #1
0
bool ScriptValue::isEqual(ScriptState* scriptState, const ScriptValue& anotherValue) const
{
    if (hasNoValue())
        return anotherValue.hasNoValue();

    return JSValueIsEqual(toRef(scriptState), toRef(scriptState, jsValue()), toRef(scriptState, anotherValue.jsValue()), 0);
}
// This method used to fill a JSValue to a GPR when linking speculative -> non-speculative.
void JITCompiler::fillToJS(NodeIndex nodeIndex, GPRReg gpr)
{
    Node& node = graph()[nodeIndex];

    if (node.isArgument()) {
        loadPtr(addressForArgument(node.argumentNumber()), gprToRegisterID(gpr));
        return;
    }

    if (node.isConstant()) {
        if (isInt32Constant(nodeIndex)) {
            JSValue jsValue = jsNumber(valueOfInt32Constant(nodeIndex));
            move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gprToRegisterID(gpr));
        } else if (isDoubleConstant(nodeIndex)) {
            JSValue jsValue(JSValue::EncodeAsDouble, valueOfDoubleConstant(nodeIndex));
            move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gprToRegisterID(gpr));
        } else {
            ASSERT(isJSConstant(nodeIndex));
            JSValue jsValue = valueOfJSConstant(nodeIndex);
            move(MacroAssembler::ImmPtr(JSValue::encode(jsValue)), gprToRegisterID(gpr));
        }
        return;
    }

    loadPtr(addressFor(node.virtualRegister), gprToRegisterID(gpr));
}
Example #3
0
main()
{
  int i;
  readDat();
  jsValue();
  writeDat();
  for (i=0;i<cnt;i++)  printf("b[%d]=%d\n",i,b[i]);
}
Example #4
0
main()
{
  int i=0;
  readDat();
  jsValue();
  writeDat();
  printf("cnt=%d\n满足条件的平均值pjz1=%7.2lf\n不满足条件的平均值pjz2=%7.2lf\n",
cnt,pjz1,pjz2);
}
Example #5
0
void main()
{	
	int i,first;
	unsigned int initial_no = nondet_int();
	unsigned int size = nondet_int();
	__CPROVER_assume (size <= SIZE); 
	jsValue(initial_no,size,array);
	first = array[0];
	for(i=1;i<size;i++)
	{		
		assert( array[i]<=first);
		first=array[i];
	}

}
Example #6
0
void writeDat()
{	
	int *array;	
	int i;
	int initial_no=-10;
	int size=5;	
	array=(int *)malloc(sizeof(int)*size);	
	jsValue(initial_no,size,array);	
	for(i=0;i<size;i++)	
	{		
		printf("%d ",array[i]);	
	}	
	printf("\n");	
	return;
}
Example #7
0
CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) {
  if (!pObject)
    return nullptr;
  if (pObject->IsNode())
    RunVariablesScript(pObject->AsNode());

  auto iter = m_mapObjectToValue.find(pObject);
  if (iter != m_mapObjectToValue.end())
    return iter->second.get();

  std::unique_ptr<CFXJSE_Value> jsValue(new CFXJSE_Value(m_pIsolate));
  jsValue->SetObject(pObject, m_pJsClass);
  CFXJSE_Value* pValue = jsValue.get();
  m_mapObjectToValue.insert(std::make_pair(pObject, std::move(jsValue)));
  return pValue;
}
Example #8
0
PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow)
{
    JSValueRef exception = 0;
    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(toRef(scriptState), toRef(scriptState, jsValue()), messagePorts, arrayBuffers, &exception);
    didThrow = exception ? true : false;
    return serializedValue.release();
}
Example #9
0
PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, SerializationErrorMode throwExceptions)
{
    return SerializedScriptValue::create(scriptState, jsValue(), 0, 0, throwExceptions);
}
Example #10
0
PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow)
{
    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(scriptState, jsValue(), messagePorts, arrayBuffers);
    didThrow = scriptState->hadException();
    return serializedValue.release();
}
PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptState)
{
    return SerializedScriptValue::create(scriptState, jsValue());
}
Example #12
0
void ObjectWrapper::setBoolean(Key key, bool val) {
    JS::RootedValue jsValue(_context);
    jsValue.setBoolean(val);

    setValue(key, jsValue);
}
Example #13
0
void ObjectWrapper::setString(Key key, StringData val) {
    JS::RootedValue jsValue(_context);
    ValueReader(_context, &jsValue).fromStringData(val);

    setValue(key, jsValue);
}
Example #14
0
void ObjectWrapper::setNumber(Key key, double val) {
    JS::RootedValue jsValue(_context);
    ValueReader(_context, &jsValue).fromDouble(val);

    setValue(key, jsValue);
}
Example #15
0
main() 
{ 
	jsValue(); 
	printf("M=100,n=%d\nM=1000,n=%d\nM=10000,n=%d\n",b[0],b[1],b[2]); 
}