@@ -75,31 +75,34 @@ WebAssemblyMemory::NewInstance(RecyclableObject* function, CallInfo callInfo, ..
75
75
}
76
76
DynamicObject * memoryDescriptor = VarTo<DynamicObject>(args[1 ]);
77
77
78
- if (!JavascriptOperators::OP_HasProperty (memoryDescriptor, PropertyIds::initial, scriptContext))
78
+ Var initVar = JavascriptOperators::OP_GetProperty (memoryDescriptor, PropertyIds::initial, scriptContext);
79
+ if (Js::JavascriptOperators::IsUndefined (initVar))
79
80
{
80
81
JavascriptError::ThrowTypeError (scriptContext, JSERR_NeedNumber, _u (" descriptor.initial" ));
81
82
}
82
- Var initVar = JavascriptOperators::OP_GetProperty (memoryDescriptor, PropertyIds::initial, scriptContext);
83
83
uint32 initial = WebAssembly::ToNonWrappingUint32 (initVar, scriptContext);
84
84
85
85
uint32 maximum = Wasm::Limits::GetMaxMemoryMaximumPages ();
86
86
bool hasMaximum = false ;
87
- if (JavascriptOperators::OP_HasProperty (memoryDescriptor, PropertyIds::maximum, scriptContext))
87
+ Var maxVar = JavascriptOperators::OP_GetProperty (memoryDescriptor, PropertyIds::maximum, scriptContext);
88
+ if (!Js::JavascriptOperators::IsUndefined (maxVar))
88
89
{
89
90
hasMaximum = true ;
90
- Var maxVar = JavascriptOperators::OP_GetProperty (memoryDescriptor, PropertyIds::maximum, scriptContext);
91
91
maximum = WebAssembly::ToNonWrappingUint32 (maxVar, scriptContext);
92
92
}
93
93
94
94
bool isShared = false ;
95
- if (Wasm::Threads::IsEnabled () && JavascriptOperators::OP_HasProperty (memoryDescriptor, PropertyIds::shared, scriptContext) )
95
+ if (Wasm::Threads::IsEnabled ())
96
96
{
97
- if (!hasMaximum)
97
+ Var sharedVar = JavascriptOperators::OP_GetProperty (memoryDescriptor, PropertyIds::shared, scriptContext);
98
+ if (!Js::JavascriptOperators::IsUndefined (sharedVar))
98
99
{
99
- JavascriptError::ThrowTypeError (scriptContext, WASMERR_SharedNoMaximum);
100
+ isShared = JavascriptConversion::ToBool (sharedVar, scriptContext);
101
+ if (!hasMaximum)
102
+ {
103
+ JavascriptError::ThrowTypeError (scriptContext, WASMERR_SharedNoMaximum);
104
+ }
100
105
}
101
- Var sharedVar = JavascriptOperators::OP_GetProperty (memoryDescriptor, PropertyIds::shared, scriptContext);
102
- isShared = JavascriptConversion::ToBool (sharedVar, scriptContext);
103
106
}
104
107
105
108
return CreateMemoryObject (initial, maximum, isShared, scriptContext);
0 commit comments