|
|
@@ -2142,7 +2142,7 @@ namespace Js
|
|
|
prototype->SetHasNoEnumerableProperties(hasNoEnumerableProperties);
|
|
|
}
|
|
|
|
|
|
-#define INIT_ERROR(error) \
|
|
|
+#define INIT_ERROR_IMPL(error, errorName) \
|
|
|
void JavascriptLibrary::Initialize##error##Constructor(DynamicObject* constructor, DeferredTypeHandlerBase* typeHandler, DeferredInitializeMode mode) \
|
|
|
{ \
|
|
|
typeHandler->Convert(constructor, mode, 3); \
|
|
|
@@ -2153,7 +2153,7 @@ namespace Js
|
|
|
if (scriptContext->GetConfig()->IsES6FunctionNameEnabled()) \
|
|
|
{ \
|
|
|
PropertyAttributes prototypeNameMessageAttributes = PropertyConfigurable; \
|
|
|
- library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u(#error)), prototypeNameMessageAttributes); \
|
|
|
+ library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u(#errorName)), prototypeNameMessageAttributes); \
|
|
|
} \
|
|
|
constructor->SetHasNoEnumerableProperties(true); \
|
|
|
} \
|
|
|
@@ -2164,21 +2164,22 @@ namespace Js
|
|
|
library->AddMember(prototype, PropertyIds::constructor, library->Get##error##Constructor()); \
|
|
|
bool hasNoEnumerableProperties = true; \
|
|
|
PropertyAttributes prototypeNameMessageAttributes = PropertyConfigurable | PropertyWritable; \
|
|
|
- library->AddMember(prototype, PropertyIds::name, library->CreateStringFromCppLiteral(_u(#error)), prototypeNameMessageAttributes); \
|
|
|
+ library->AddMember(prototype, PropertyIds::name, library->CreateStringFromCppLiteral(_u(#errorName)), prototypeNameMessageAttributes); \
|
|
|
library->AddMember(prototype, PropertyIds::message, library->GetEmptyString(), prototypeNameMessageAttributes); \
|
|
|
library->AddFunctionToLibraryObject(prototype, PropertyIds::toString, &JavascriptError::EntryInfo::ToString, 0); \
|
|
|
prototype->SetHasNoEnumerableProperties(hasNoEnumerableProperties); \
|
|
|
}
|
|
|
|
|
|
+#define INIT_ERROR(error) INIT_ERROR_IMPL(error, error)
|
|
|
INIT_ERROR(EvalError);
|
|
|
INIT_ERROR(RangeError);
|
|
|
INIT_ERROR(ReferenceError);
|
|
|
INIT_ERROR(SyntaxError);
|
|
|
INIT_ERROR(TypeError);
|
|
|
INIT_ERROR(URIError);
|
|
|
- INIT_ERROR(WebAssemblyCompileError);
|
|
|
- INIT_ERROR(WebAssemblyRuntimeError);
|
|
|
- INIT_ERROR(WebAssemblyLinkError);
|
|
|
+ INIT_ERROR_IMPL(WebAssemblyCompileError, CompileError);
|
|
|
+ INIT_ERROR_IMPL(WebAssemblyRuntimeError, RuntimeError);
|
|
|
+ INIT_ERROR_IMPL(WebAssemblyLinkError, LinkError);
|
|
|
|
|
|
#undef INIT_ERROR
|
|
|
|
|
|
@@ -2470,7 +2471,7 @@ namespace Js
|
|
|
{
|
|
|
library->AddMember(proxyConstructor, PropertyIds::name, scriptContext->GetPropertyString(PropertyIds::Proxy), PropertyConfigurable);
|
|
|
}
|
|
|
- library->AddFunctionToLibraryObject(proxyConstructor, PropertyIds::revocable, &JavascriptProxy::EntryInfo::Revocable, PropertyNone);
|
|
|
+ library->AddFunctionToLibraryObject(proxyConstructor, PropertyIds::revocable, &JavascriptProxy::EntryInfo::Revocable, 2, PropertyConfigurable);
|
|
|
|
|
|
proxyConstructor->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
@@ -2790,16 +2791,16 @@ namespace Js
|
|
|
library->AddMember(prototype, PropertyIds::constructor, library->webAssemblyTableConstructor);
|
|
|
if (scriptContext->GetConfig()->IsES6ToStringTagEnabled())
|
|
|
{
|
|
|
- library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssemblyTable")), PropertyConfigurable);
|
|
|
+ library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssembly.Table")), PropertyConfigurable);
|
|
|
}
|
|
|
scriptContext->SetBuiltInLibraryFunction(WebAssemblyTable::EntryInfo::Grow.GetOriginalEntryPoint(),
|
|
|
- library->AddFunctionToLibraryObject(prototype, PropertyIds::grow, &WebAssemblyTable::EntryInfo::Grow, PropertyEnumerable));
|
|
|
+ library->AddFunctionToLibraryObject(prototype, PropertyIds::grow, &WebAssemblyTable::EntryInfo::Grow, 1));
|
|
|
|
|
|
scriptContext->SetBuiltInLibraryFunction(WebAssemblyTable::EntryInfo::Get.GetOriginalEntryPoint(),
|
|
|
- library->AddFunctionToLibraryObject(prototype, PropertyIds::get, &WebAssemblyTable::EntryInfo::Get, PropertyEnumerable));
|
|
|
+ library->AddFunctionToLibraryObject(prototype, PropertyIds::get, &WebAssemblyTable::EntryInfo::Get, 1));
|
|
|
|
|
|
scriptContext->SetBuiltInLibraryFunction(WebAssemblyTable::EntryInfo::Set.GetOriginalEntryPoint(),
|
|
|
- library->AddFunctionToLibraryObject(prototype, PropertyIds::set, &WebAssemblyTable::EntryInfo::Set, PropertyEnumerable));
|
|
|
+ library->AddFunctionToLibraryObject(prototype, PropertyIds::set, &WebAssemblyTable::EntryInfo::Set, 2));
|
|
|
|
|
|
library->AddAccessorsToLibraryObject(prototype, PropertyIds::length, &WebAssemblyTable::EntryInfo::GetterLength, nullptr);
|
|
|
|
|
|
@@ -2815,7 +2816,7 @@ namespace Js
|
|
|
library->AddMember(constructor, PropertyIds::prototype, library->webAssemblyTablePrototype, PropertyNone);
|
|
|
if (scriptContext->GetConfig()->IsES6FunctionNameEnabled())
|
|
|
{
|
|
|
- library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("WebAssemblyTable")), PropertyConfigurable);
|
|
|
+ library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("Table")), PropertyConfigurable);
|
|
|
}
|
|
|
constructor->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
@@ -2830,10 +2831,10 @@ namespace Js
|
|
|
library->AddMember(prototype, PropertyIds::constructor, library->webAssemblyMemoryConstructor);
|
|
|
if (scriptContext->GetConfig()->IsES6ToStringTagEnabled())
|
|
|
{
|
|
|
- library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssemblyMemory")), PropertyConfigurable);
|
|
|
+ library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssembly.Memory")), PropertyConfigurable);
|
|
|
}
|
|
|
scriptContext->SetBuiltInLibraryFunction(WebAssemblyMemory::EntryInfo::Grow.GetOriginalEntryPoint(),
|
|
|
- library->AddFunctionToLibraryObject(prototype, PropertyIds::grow, &WebAssemblyMemory::EntryInfo::Grow, PropertyEnumerable));
|
|
|
+ library->AddFunctionToLibraryObject(prototype, PropertyIds::grow, &WebAssemblyMemory::EntryInfo::Grow, 1));
|
|
|
|
|
|
library->AddAccessorsToLibraryObject(prototype, PropertyIds::buffer, &WebAssemblyMemory::EntryInfo::GetterBuffer, nullptr);
|
|
|
|
|
|
@@ -2849,22 +2850,23 @@ namespace Js
|
|
|
library->AddMember(constructor, PropertyIds::prototype, library->webAssemblyMemoryPrototype, PropertyNone);
|
|
|
if (scriptContext->GetConfig()->IsES6FunctionNameEnabled())
|
|
|
{
|
|
|
- library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("WebAssemblyMemory")), PropertyConfigurable);
|
|
|
+ library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("Memory")), PropertyConfigurable);
|
|
|
}
|
|
|
constructor->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
|
|
|
void JavascriptLibrary::InitializeWebAssemblyInstancePrototype(DynamicObject* prototype, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
|
|
|
{
|
|
|
- typeHandler->Convert(prototype, mode, 2);
|
|
|
+ typeHandler->Convert(prototype, mode, 3);
|
|
|
|
|
|
JavascriptLibrary* library = prototype->GetLibrary();
|
|
|
ScriptContext* scriptContext = prototype->GetScriptContext();
|
|
|
|
|
|
library->AddMember(prototype, PropertyIds::constructor, library->webAssemblyInstanceConstructor);
|
|
|
+ library->AddAccessorsToLibraryObject(prototype, PropertyIds::exports, &WebAssemblyInstance::EntryInfo::GetterExports, nullptr);
|
|
|
if (scriptContext->GetConfig()->IsES6ToStringTagEnabled())
|
|
|
{
|
|
|
- library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssemblyInstance")), PropertyConfigurable);
|
|
|
+ library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssembly.Instance")), PropertyConfigurable);
|
|
|
}
|
|
|
prototype->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
@@ -2878,7 +2880,7 @@ namespace Js
|
|
|
library->AddMember(constructor, PropertyIds::prototype, library->webAssemblyInstancePrototype, PropertyNone);
|
|
|
if (scriptContext->GetConfig()->IsES6FunctionNameEnabled())
|
|
|
{
|
|
|
- library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("WebAssemblyInstance")), PropertyConfigurable);
|
|
|
+ library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("Instance")), PropertyConfigurable);
|
|
|
}
|
|
|
constructor->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
@@ -2893,7 +2895,7 @@ namespace Js
|
|
|
library->AddMember(prototype, PropertyIds::constructor, library->webAssemblyModuleConstructor);
|
|
|
if (scriptContext->GetConfig()->IsES6ToStringTagEnabled())
|
|
|
{
|
|
|
- library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssemblyModule")), PropertyConfigurable);
|
|
|
+ library->AddMember(prototype, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssembly.Module")), PropertyConfigurable);
|
|
|
}
|
|
|
prototype->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
@@ -2906,13 +2908,13 @@ namespace Js
|
|
|
library->AddMember(constructor, PropertyIds::length, TaggedInt::ToVarUnchecked(1), PropertyConfigurable);
|
|
|
library->AddMember(constructor, PropertyIds::prototype, library->webAssemblyModulePrototype, PropertyNone);
|
|
|
|
|
|
- library->AddFunctionToLibraryObject(constructor, PropertyIds::exports, &WebAssemblyModule::EntryInfo::Exports, 2);
|
|
|
- library->AddFunctionToLibraryObject(constructor, PropertyIds::imports, &WebAssemblyModule::EntryInfo::Imports, 2);
|
|
|
+ library->AddFunctionToLibraryObject(constructor, PropertyIds::exports, &WebAssemblyModule::EntryInfo::Exports, 1);
|
|
|
+ library->AddFunctionToLibraryObject(constructor, PropertyIds::imports, &WebAssemblyModule::EntryInfo::Imports, 1);
|
|
|
library->AddFunctionToLibraryObject(constructor, PropertyIds::customSections, &WebAssemblyModule::EntryInfo::CustomSections, 2);
|
|
|
|
|
|
if (scriptContext->GetConfig()->IsES6FunctionNameEnabled())
|
|
|
{
|
|
|
- library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("WebAssemblyModule")), PropertyConfigurable);
|
|
|
+ library->AddMember(constructor, PropertyIds::name, library->CreateStringFromCppLiteral(_u("Module")), PropertyConfigurable);
|
|
|
}
|
|
|
constructor->SetHasNoEnumerableProperties(true);
|
|
|
}
|
|
|
@@ -2920,7 +2922,7 @@ namespace Js
|
|
|
void JavascriptLibrary::InitializeWebAssemblyObject(DynamicObject* webAssemblyObject, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
|
|
|
{
|
|
|
JavascriptLibrary* library = webAssemblyObject->GetLibrary();
|
|
|
- int slots = 8;
|
|
|
+ int slots = 9;
|
|
|
#ifdef ENABLE_WABT
|
|
|
// Attaching wabt for testing
|
|
|
++slots;
|
|
|
@@ -2949,6 +2951,12 @@ namespace Js
|
|
|
library->AddFunction(webAssemblyObject, PropertyIds::LinkError, library->webAssemblyLinkErrorConstructor);
|
|
|
library->AddFunction(webAssemblyObject, PropertyIds::Memory, library->webAssemblyMemoryConstructor);
|
|
|
library->AddFunction(webAssemblyObject, PropertyIds::Table, library->webAssemblyTableConstructor);
|
|
|
+
|
|
|
+ ScriptContext* scriptContext = webAssemblyObject->GetScriptContext();
|
|
|
+ if (scriptContext->GetConfig()->IsES6FunctionNameEnabled())
|
|
|
+ {
|
|
|
+ library->AddMember(webAssemblyObject, PropertyIds::_symbolToStringTag, library->CreateStringFromCppLiteral(_u("WebAssembly")), PropertyConfigurable);
|
|
|
+ }
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
@@ -6769,7 +6777,7 @@ namespace Js
|
|
|
|
|
|
DynamicObject* JavascriptLibrary::CreateObject(RecyclableObject* prototype, uint16 requestedInlineSlotCapacity)
|
|
|
{
|
|
|
- Assert(JavascriptOperators::IsObject(prototype));
|
|
|
+ Assert(JavascriptOperators::IsObjectOrNull(prototype));
|
|
|
|
|
|
DynamicType* dynamicType = CreateObjectType(prototype, requestedInlineSlotCapacity);
|
|
|
return DynamicObject::New(this->GetRecycler(), dynamicType);
|