MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxRunScript

Function fxRunScript

xs/sources/xsRun.c:5033–5111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5031}
5032
5033void fxRunScript(txMachine* the, txScript* script, txSlot* _this, txSlot* _target, txSlot* closures, txSlot* object, txSlot* module)
5034{
5035 if (script) {
5036 mxTry(the) {
5037 txSlot* instance;
5038 txSlot* property;
5039 __JUMP__.code = C_NULL;
5040 fxRemapScript(the, script);
5041 if (script->callback) {
5042 property = the->stack;
5043 /* THIS */
5044 if (_this)
5045 mxPushSlot(_this);
5046 else
5047 mxPushUndefined();
5048 the->stack->ID = XS_NO_ID;
5049 /* FUNCTION */
5050 mxPush(mxFunctionPrototype);
5051 instance = fxNewFunctionInstance(the, closures ? mxID(_eval) : XS_NO_ID);
5052 instance->next->kind = XS_CALLBACK_KIND;
5053 instance->next->value.callback.address = script->callback;
5054 instance->next->value.callback.closures = C_NULL;
5055 property = mxFunctionInstanceHome(instance);
5056 property->value.home.object = object;
5057 property->value.home.module = module;
5058 /* RESULT */
5059 mxPushUndefined();
5060 /* FRAME */
5061 mxPushUninitialized();
5062 mxRunCount(0);
5063 }
5064 else {
5065 mxPushUndefined();
5066 }
5067 mxPull(mxHosts);
5068 mxPop();
5069
5070 /* TARGET */
5071 if (_target)
5072 mxPushSlot(_target);
5073 /* THIS */
5074 if (_this)
5075 mxPushSlot(_this);
5076 else
5077 mxPushUndefined();
5078 the->stack->ID = XS_NO_ID;
5079 /* FUNCTION */
5080 mxPush(mxFunctionPrototype);
5081 instance = fxNewFunctionInstance(the, XS_NO_ID);
5082 instance->next->kind = XS_CODE_X_KIND;
5083 instance->next->value.code.address = script->codeBuffer;
5084 instance->next->value.code.closures = closures;
5085 property = mxFunctionInstanceHome(instance);
5086 property->ID = fxGenerateProfileID(the);
5087 property->value.home.object = object;
5088 property->value.home.module = module;
5089 /* RESULT */
5090 mxPushUndefined();

Callers 15

_xsbug_script_Function · 0.85
_262_agent_start_auxFunction · 0.85
_262_evalScriptFunction · 0.85
xs_repl_evalFunction · 0.85
xs_repl_evalFunction · 0.85
xs_repl_evalFunction · 0.85
xs_repl_evalFunction · 0.85
fuzzFunction · 0.85
fuzz_ossFunction · 0.85
fx_evalScriptFunction · 0.85
fx_runScriptFunction · 0.85
fx_agent_start_auxFunction · 0.85

Calls 5

fxRemapScriptFunction · 0.85
fxNewFunctionInstanceFunction · 0.85
fxDeleteScriptFunction · 0.85
fxJumpFunction · 0.85
fxGenerateProfileIDFunction · 0.70

Tested by

no test coverage detected