Skip to content

Commit cc369f4

Browse files
committed
CR Fixes
1 parent 1fe1f79 commit cc369f4

2 files changed

Lines changed: 12 additions & 24 deletions

File tree

lib/Runtime/Library/WebAssemblyEnvironment.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ void Js::WebAssemblyEnvironment::CheckPtrIsValid(intptr_t ptr) const
4242
{
4343
if (ptr < (intptr_t)start || (intptr_t)(ptr + sizeof(T)) > (intptr_t)end)
4444
{
45-
Assert(UNREACHED);
46-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
45+
Js::Throw::InternalError();
4746
}
4847
}
4948

@@ -52,8 +51,7 @@ T* Js::WebAssemblyEnvironment::GetVarElement(Var* ptr, uint32 index, uint32 maxC
5251
{
5352
if (index >= maxCount)
5453
{
55-
Assert(UNREACHED);
56-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
54+
Js::Throw::InternalError();
5755
}
5856

5957
Var* functionPtr = ptr + index;
@@ -63,8 +61,7 @@ T* Js::WebAssemblyEnvironment::GetVarElement(Var* ptr, uint32 index, uint32 maxC
6361
{
6462
if (!T::Is(varFunc))
6563
{
66-
Assert(UNREACHED);
67-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
64+
Js::Throw::InternalError();
6865
}
6966
return T::FromVar(varFunc);
7067
}
@@ -77,8 +74,7 @@ void Js::WebAssemblyEnvironment::SetVarElement(Var* ptr, T* val, uint32 index, u
7774
if (index >= maxCount ||
7875
!T::Is(val))
7976
{
80-
Assert(UNREACHED);
81-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
77+
Js::Throw::InternalError();
8278
}
8379

8480
Var* dst = ptr + index;
@@ -92,8 +88,7 @@ AsmJsScriptFunction* WebAssemblyEnvironment::GetWasmFunction(uint32 index) const
9288
if (!(module->GetFunctionIndexType(index) == Wasm::FunctionIndexTypes::Function ||
9389
module->GetFunctionIndexType(index) == Wasm::FunctionIndexTypes::ImportThunk))
9490
{
95-
Assert(UNREACHED);
96-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
91+
Js::Throw::InternalError();
9792
}
9893
return GetVarElement<AsmJsScriptFunction>(functions, index, module->GetWasmFunctionCount());
9994
}
@@ -104,8 +99,7 @@ void WebAssemblyEnvironment::SetWasmFunction(uint32 index, AsmJsScriptFunction*
10499
module->GetFunctionIndexType(index) == Wasm::FunctionIndexTypes::ImportThunk) ||
105100
!AsmJsScriptFunction::IsWasmScriptFunction(func))
106101
{
107-
Assert(UNREACHED);
108-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
102+
Js::Throw::InternalError();
109103
}
110104
SetVarElement<AsmJsScriptFunction>(functions, func, index, module->GetWasmFunctionCount());
111105
}
@@ -156,8 +150,7 @@ Wasm::WasmConstLitNode WebAssemblyEnvironment::GetGlobalValue(Wasm::WasmGlobal*
156150
{
157151
if (!global)
158152
{
159-
Assert(UNREACHED);
160-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
153+
Js::Throw::InternalError();
161154
}
162155
Wasm::WasmConstLitNode cnst;
163156
uint32 offset = module->GetOffsetForGlobal(global);
@@ -169,8 +162,7 @@ Wasm::WasmConstLitNode WebAssemblyEnvironment::GetGlobalValue(Wasm::WasmGlobal*
169162
case Wasm::WasmTypes::F32: cnst.f32 = GetGlobalInternal<float>(offset); break;
170163
case Wasm::WasmTypes::F64: cnst.f64 = GetGlobalInternal<double>(offset); break;
171164
default:
172-
Assert(UNREACHED);
173-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
165+
Js::Throw::InternalError();
174166
}
175167
return cnst;
176168
}
@@ -179,8 +171,7 @@ void WebAssemblyEnvironment::SetGlobalValue(Wasm::WasmGlobal* global, Wasm::Wasm
179171
{
180172
if (!global)
181173
{
182-
Assert(UNREACHED);
183-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
174+
Js::Throw::InternalError();
184175
}
185176
uint32 offset = module->GetOffsetForGlobal(global);
186177

@@ -191,8 +182,7 @@ void WebAssemblyEnvironment::SetGlobalValue(Wasm::WasmGlobal* global, Wasm::Wasm
191182
case Wasm::WasmTypes::F32: SetGlobalInternal<float>(offset, cnst.f32); break;
192183
case Wasm::WasmTypes::F64: SetGlobalInternal<double>(offset, cnst.f64); break;
193184
default:
194-
Assert(UNREACHED);
195-
JavascriptError::ThrowTypeError(module->GetScriptContext(), VBSERR_InternalError);
185+
Js::Throw::InternalError();
196186
}
197187
}
198188

lib/Runtime/Library/WebAssemblyInstance.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,13 @@ void WebAssemblyInstance::LoadImports(
388388
case Wasm::WasmTypes::F64: cnst.f64 = JavascriptConversion::ToNumber(prop, ctx); break;
389389
case Wasm::WasmTypes::I64: Js::JavascriptError::ThrowTypeError(ctx, WASMERR_InvalidTypeConversion);
390390
default:
391-
Assert(UNREACHED);
392-
JavascriptError::ThrowTypeError(ctx, VBSERR_InternalError);
391+
Js::Throw::InternalError();
393392
}
394393
env->SetGlobalValue(global, cnst);
395394
break;
396395
}
397396
default:
398-
Assert(UNREACHED);
399-
JavascriptError::ThrowTypeError(ctx, VBSERR_InternalError);
397+
Js::Throw::InternalError();
400398
}
401399
++counter;
402400
}

0 commit comments

Comments
 (0)