Changeset 214547 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Mar 29, 2017, 10:44:59 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r214504 r214547 58 58 #include "JSTypedArrays.h" 59 59 #include "JSWebAssemblyCallee.h" 60 #include "JSWebAssemblyInstance.h" 61 #include "JSWebAssemblyMemory.h" 60 62 #include "LLIntData.h" 61 63 #include "LLIntThunks.h" … … 1085 1087 #if ENABLE(WEBASSEMBLY) 1086 1088 static EncodedJSValue JSC_HOST_CALL functionTestWasmModuleFunctions(ExecState*); 1089 static EncodedJSValue JSC_HOST_CALL functionWebAssemblyMemoryMode(ExecState*); 1087 1090 #endif 1088 1091 … … 1359 1362 #if ENABLE(WEBASSEMBLY) 1360 1363 addFunction(vm, "testWasmModuleFunctions", functionTestWasmModuleFunctions, 0); 1364 addFunction(vm, "WebAssemblyMemoryMode", functionWebAssemblyMemoryMode, 1); 1361 1365 #endif 1362 1366 … … 3247 3251 } 3248 3252 3253 static EncodedJSValue JSC_HOST_CALL functionWebAssemblyMemoryMode(ExecState* exec) 3254 { 3255 VM& vm = exec->vm(); 3256 auto scope = DECLARE_THROW_SCOPE(vm); 3257 3258 if (!Options::useWebAssembly()) 3259 return throwVMTypeError(exec, scope, ASCIILiteral("WebAssemblyMemoryMode should only be called if the useWebAssembly option is set")); 3260 3261 if (JSObject* object = exec->argument(0).getObject()) { 3262 if (auto* memory = jsDynamicCast<JSWebAssemblyMemory*>(vm, object)) 3263 return JSValue::encode(jsString(&vm, makeString(memory->memory().mode()))); 3264 if (auto* instance = jsDynamicCast<JSWebAssemblyInstance*>(vm, object)) 3265 return JSValue::encode(jsString(&vm, makeString(instance->memoryMode()))); 3266 } 3267 3268 return throwVMTypeError(exec, scope, ASCIILiteral("WebAssemblyMemoryMode expects either a WebAssembly.Memory or WebAssembly.Instance")); 3269 } 3270 3249 3271 #endif // ENABLE(WEBASSEBLY) 3250 3272
Note:
See TracChangeset
for help on using the changeset viewer.