Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (214260 => 214261)
--- trunk/Source/_javascript_Core/ChangeLog 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-03-22 17:56:29 UTC (rev 214261)
@@ -1,5 +1,45 @@
2017-03-22 JF Bastien <[email protected]>
+ WebAssembly: name ExecState consistently
+ https://bugs.webkit.org/show_bug.cgi?id=169954
+
+ Reviewed by Saam Barati.
+
+ No functional change.
+
+ * wasm/js/JSWebAssemblyCompileError.cpp:
+ (JSC::JSWebAssemblyCompileError::create):
+ (JSC::createJSWebAssemblyCompileError):
+ * wasm/js/JSWebAssemblyCompileError.h:
+ (JSC::JSWebAssemblyCompileError::create):
+ * wasm/js/JSWebAssemblyLinkError.cpp:
+ (JSC::JSWebAssemblyLinkError::create):
+ (JSC::createJSWebAssemblyLinkError):
+ * wasm/js/JSWebAssemblyLinkError.h:
+ (JSC::JSWebAssemblyLinkError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.cpp:
+ (JSC::JSWebAssemblyRuntimeError::create):
+ * wasm/js/JSWebAssemblyRuntimeError.h:
+ (JSC::JSWebAssemblyRuntimeError::create):
+ * wasm/js/WebAssemblyInstanceConstructor.cpp:
+ (JSC::callJSWebAssemblyInstance):
+ * wasm/js/WebAssemblyMemoryConstructor.cpp:
+ (JSC::callJSWebAssemblyMemory):
+ * wasm/js/WebAssemblyModuleConstructor.cpp:
+ (JSC::callJSWebAssemblyModule):
+ (JSC::WebAssemblyModuleConstructor::createModule):
+ * wasm/js/WebAssemblyModuleRecord.cpp:
+ (JSC::WebAssemblyModuleRecord::link):
+ (JSC::dataSegmentFail):
+ (JSC::WebAssemblyModuleRecord::evaluate):
+ * wasm/js/WebAssemblyPrototype.cpp:
+ (JSC::webAssemblyFunctionValidate):
+ (JSC::webAssemblyFunctionCompile):
+ * wasm/js/WebAssemblyTableConstructor.cpp:
+ (JSC::callJSWebAssemblyTable):
+
+2017-03-22 JF Bastien <[email protected]>
+
WebAssembly: constructors without new don't throw
https://bugs.webkit.org/show_bug.cgi?id=165995
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -32,12 +32,12 @@
namespace JSC {
-JSWebAssemblyCompileError* JSWebAssemblyCompileError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
+JSWebAssemblyCompileError* JSWebAssemblyCompileError::create(ExecState* exec, VM& vm, Structure* structure, const String& message)
{
auto* instance = new (NotNull, allocateCell<JSWebAssemblyCompileError>(vm.heap)) JSWebAssemblyCompileError(vm, structure);
instance->m_sourceAppender = defaultSourceAppender;
bool useCurrentFrame = true;
- instance->finishCreation(state, vm, message, useCurrentFrame);
+ instance->finishCreation(exec, vm, message, useCurrentFrame);
return instance;
}
@@ -49,11 +49,11 @@
const ClassInfo JSWebAssemblyCompileError::s_info = { "WebAssembly.CompileError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyCompileError) };
-JSObject* createJSWebAssemblyCompileError(ExecState* state, VM& vm, const String& message)
+JSObject* createJSWebAssemblyCompileError(ExecState* exec, VM& vm, const String& message)
{
ASSERT(!message.isEmpty());
- JSGlobalObject* globalObject = state->lexicalGlobalObject();
- return JSWebAssemblyCompileError::create(state, vm, globalObject->WebAssemblyCompileErrorStructure(), message);
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ return JSWebAssemblyCompileError::create(exec, vm, globalObject->WebAssemblyCompileErrorStructure(), message);
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCompileError.h 2017-03-22 17:56:29 UTC (rev 214261)
@@ -36,9 +36,9 @@
typedef ErrorInstance Base;
static JSWebAssemblyCompileError* create(ExecState*, VM&, Structure*, const String&);
- static JSWebAssemblyCompileError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
+ static JSWebAssemblyCompileError* create(ExecState* exec, VM& vm, Structure* structure, JSValue message)
{
- return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
+ return create(exec, vm, structure, message.isUndefined() ? String() : message.toWTFString(exec));
}
DECLARE_INFO;
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -32,12 +32,12 @@
namespace JSC {
-JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
+JSWebAssemblyLinkError* JSWebAssemblyLinkError::create(ExecState* exec, VM& vm, Structure* structure, const String& message)
{
auto* instance = new (NotNull, allocateCell<JSWebAssemblyLinkError>(vm.heap)) JSWebAssemblyLinkError(vm, structure);
instance->m_sourceAppender = defaultSourceAppender;
bool useCurrentFrame = true;
- instance->finishCreation(state, vm, message, useCurrentFrame);
+ instance->finishCreation(exec, vm, message, useCurrentFrame);
return instance;
}
@@ -49,11 +49,11 @@
const ClassInfo JSWebAssemblyLinkError::s_info = { "WebAssembly.LinkError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyLinkError) };
-JSObject* createJSWebAssemblyLinkError(ExecState* state, VM& vm, const String& message)
+JSObject* createJSWebAssemblyLinkError(ExecState* exec, VM& vm, const String& message)
{
ASSERT(!message.isEmpty());
- JSGlobalObject* globalObject = state->lexicalGlobalObject();
- return JSWebAssemblyLinkError::create(state, vm, globalObject->WebAssemblyLinkErrorStructure(), message);
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ return JSWebAssemblyLinkError::create(exec, vm, globalObject->WebAssemblyLinkErrorStructure(), message);
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyLinkError.h 2017-03-22 17:56:29 UTC (rev 214261)
@@ -36,9 +36,9 @@
typedef ErrorInstance Base;
static JSWebAssemblyLinkError* create(ExecState*, VM&, Structure*, const String&);
- static JSWebAssemblyLinkError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
+ static JSWebAssemblyLinkError* create(ExecState* exec, VM& vm, Structure* structure, JSValue message)
{
- return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
+ return create(exec, vm, structure, message.isUndefined() ? String() : message.toWTFString(exec));
}
DECLARE_INFO;
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -32,12 +32,12 @@
namespace JSC {
-JSWebAssemblyRuntimeError* JSWebAssemblyRuntimeError::create(ExecState* state, VM& vm, Structure* structure, const String& message)
+JSWebAssemblyRuntimeError* JSWebAssemblyRuntimeError::create(ExecState* exec, VM& vm, Structure* structure, const String& message)
{
auto* instance = new (NotNull, allocateCell<JSWebAssemblyRuntimeError>(vm.heap)) JSWebAssemblyRuntimeError(vm, structure);
instance->m_sourceAppender = defaultSourceAppender;
bool useCurrentFrame = true;
- instance->finishCreation(state, vm, message, useCurrentFrame);
+ instance->finishCreation(exec, vm, message, useCurrentFrame);
return instance;
}
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyRuntimeError.h 2017-03-22 17:56:29 UTC (rev 214261)
@@ -36,9 +36,9 @@
typedef ErrorInstance Base;
static JSWebAssemblyRuntimeError* create(ExecState*, VM&, Structure*, const String&);
- static JSWebAssemblyRuntimeError* create(ExecState* state, VM& vm, Structure* structure, JSValue message)
+ static JSWebAssemblyRuntimeError* create(ExecState* exec, VM& vm, Structure* structure, JSValue message)
{
- return create(state, vm, structure, message.isUndefined() ? String() : message.toWTFString(state));
+ return create(exec, vm, structure, message.isUndefined() ? String() : message.toWTFString(exec));
}
DECLARE_INFO;
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyInstanceConstructor.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -319,11 +319,11 @@
return instance;
}
-static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyInstance(ExecState* state)
+static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyInstance(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(state, scope, "WebAssembly.Instance"));
+ return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(exec, scope, "WebAssembly.Instance"));
}
WebAssemblyInstanceConstructor* WebAssemblyInstanceConstructor::create(VM& vm, Structure* structure, WebAssemblyInstancePrototype* thisPrototype)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -103,11 +103,11 @@
return JSValue::encode(JSWebAssemblyMemory::create(vm, exec->lexicalGlobalObject()->WebAssemblyMemoryStructure(), adoptRef(*memory.leakRef())));
}
-static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyMemory(ExecState* state)
+static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyMemory(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(state, throwScope, "WebAssembly.Memory"));
+ return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(exec, throwScope, "WebAssembly.Memory"));
}
WebAssemblyMemoryConstructor* WebAssemblyMemoryConstructor::create(VM& vm, Structure* structure, WebAssemblyMemoryPrototype* thisPrototype)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleConstructor.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -63,25 +63,25 @@
return JSValue::encode(WebAssemblyModuleConstructor::createModule(exec, exec->argument(0), structure));
}
-static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyModule(ExecState* state)
+static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyModule(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(state, scope, "WebAssembly.Module"));
+ return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(exec, scope, "WebAssembly.Module"));
}
-JSValue WebAssemblyModuleConstructor::createModule(ExecState* state, JSValue buffer, Structure* structure)
+JSValue WebAssemblyModuleConstructor::createModule(ExecState* exec, JSValue buffer, Structure* structure)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
size_t byteOffset;
size_t byteSize;
- uint8_t* base = getWasmBufferFromValue(state, buffer, byteOffset, byteSize);
+ uint8_t* base = getWasmBufferFromValue(exec, buffer, byteOffset, byteSize);
RETURN_IF_EXCEPTION(scope, { });
scope.release();
- return JSWebAssemblyModule::create(vm, state, structure, base + byteOffset, byteSize);
+ return JSWebAssemblyModule::create(vm, exec, structure, base + byteOffset, byteSize);
}
WebAssemblyModuleConstructor* WebAssemblyModuleConstructor::create(VM& vm, Structure* structure, WebAssemblyModulePrototype* thisPrototype)
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -85,12 +85,12 @@
visitor.append(thisObject->m_startFunction);
}
-void WebAssemblyModuleRecord::link(ExecState* state, JSWebAssemblyInstance* instance)
+void WebAssemblyModuleRecord::link(ExecState* exec, JSWebAssemblyInstance* instance)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(scope);
- auto* globalObject = state->lexicalGlobalObject();
+ auto* globalObject = exec->lexicalGlobalObject();
JSWebAssemblyModule* module = instance->module();
JSWebAssemblyCodeBlock* codeBlock = instance->codeBlock();
@@ -158,7 +158,7 @@
break;
case Wasm::I64:
- throwException(state, scope, createJSWebAssemblyLinkError(state, vm, ASCIILiteral("exported global cannot be an i64")));
+ throwException(exec, scope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("exported global cannot be an i64")));
return;
case Wasm::F32:
@@ -179,7 +179,7 @@
bool shouldThrowReadOnlyError = false;
bool ignoreReadOnlyErrors = true;
bool putResult = false;
- symbolTablePutTouchWatchpointSet(moduleEnvironment, state, exp.field, exportedValue, shouldThrowReadOnlyError, ignoreReadOnlyErrors, putResult);
+ symbolTablePutTouchWatchpointSet(moduleEnvironment, exec, exp.field, exportedValue, shouldThrowReadOnlyError, ignoreReadOnlyErrors, putResult);
RELEASE_ASSERT(putResult);
}
@@ -208,14 +208,14 @@
}
template <typename Scope, typename M, typename N, typename ...Args>
-NEVER_INLINE static JSValue dataSegmentFail(ExecState* state, VM& vm, Scope& scope, M memorySize, N segmentSize, N offset, Args... args)
+NEVER_INLINE static JSValue dataSegmentFail(ExecState* exec, VM& vm, Scope& scope, M memorySize, N segmentSize, N offset, Args... args)
{
- return throwException(state, scope, createJSWebAssemblyLinkError(state, vm, makeString(ASCIILiteral("Invalid data segment initialization: segment of "), String::number(segmentSize), ASCIILiteral(" bytes memory of "), String::number(memorySize), ASCIILiteral(" bytes, at offset "), String::number(offset), args...)));
+ return throwException(exec, scope, createJSWebAssemblyLinkError(exec, vm, makeString(ASCIILiteral("Invalid data segment initialization: segment of "), String::number(segmentSize), ASCIILiteral(" bytes memory of "), String::number(memorySize), ASCIILiteral(" bytes, at offset "), String::number(offset), args...)));
}
-JSValue WebAssemblyModuleRecord::evaluate(ExecState* state)
+JSValue WebAssemblyModuleRecord::evaluate(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
{
@@ -241,7 +241,7 @@
uint64_t lastWrittenIndex = static_cast<uint64_t>(tableIndex) + static_cast<uint64_t>(element.functionIndices.size()) - 1;
if (lastWrittenIndex >= table->size())
- return throwException(state, scope, createJSWebAssemblyLinkError(state, vm, ASCIILiteral("Element is trying to set an out of bounds table index")));
+ return throwException(exec, scope, createJSWebAssemblyLinkError(exec, vm, ASCIILiteral("Element is trying to set an out of bounds table index")));
for (uint32_t i = 0; i < element.functionIndices.size(); ++i) {
// FIXME: This essentially means we're exporting an import.
@@ -300,9 +300,9 @@
offset = segment->offset.constValue();
if (UNLIKELY(sizeInBytes < segment->sizeInBytes))
- return dataSegmentFail(state, vm, scope, sizeInBytes, segment->sizeInBytes, offset, ASCIILiteral(", segment is too big"));
+ return dataSegmentFail(exec, vm, scope, sizeInBytes, segment->sizeInBytes, offset, ASCIILiteral(", segment is too big"));
if (UNLIKELY(offset > sizeInBytes - segment->sizeInBytes))
- return dataSegmentFail(state, vm, scope, sizeInBytes, segment->sizeInBytes, offset, ASCIILiteral(", segment writes outside of memory"));
+ return dataSegmentFail(exec, vm, scope, sizeInBytes, segment->sizeInBytes, offset, ASCIILiteral(", segment writes outside of memory"));
RELEASE_ASSERT(memory);
memcpy(memory + offset, &segment->byte(0), segment->sizeInBytes);
}
@@ -313,7 +313,7 @@
if (JSObject* startFunction = m_startFunction.get()) {
CallData callData;
CallType callType = JSC::getCallData(startFunction, callData);
- call(state, startFunction, callType, callData, jsUndefined(), state->emptyList());
+ call(exec, startFunction, callType, callData, jsUndefined(), exec->emptyList());
RETURN_IF_EXCEPTION(scope, { });
}
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyPrototype.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -33,18 +33,18 @@
namespace JSC {
-static EncodedJSValue JSC_HOST_CALL webAssemblyFunctionValidate(ExecState* state)
+static EncodedJSValue JSC_HOST_CALL webAssemblyFunctionValidate(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the validate function property"))));
+ return JSValue::encode(throwException(exec, scope, createError(exec, ASCIILiteral("WebAssembly doesn't yet implement the validate function property"))));
}
-static EncodedJSValue JSC_HOST_CALL webAssemblyFunctionCompile(ExecState* state)
+static EncodedJSValue JSC_HOST_CALL webAssemblyFunctionCompile(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwException(state, scope, createError(state, ASCIILiteral("WebAssembly doesn't yet implement the compile function property"))));
+ return JSValue::encode(throwException(exec, scope, createError(exec, ASCIILiteral("WebAssembly doesn't yet implement the compile function property"))));
}
}
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.cpp (214260 => 214261)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.cpp 2017-03-22 17:54:36 UTC (rev 214260)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyTableConstructor.cpp 2017-03-22 17:56:29 UTC (rev 214261)
@@ -94,11 +94,11 @@
return JSValue::encode(JSWebAssemblyTable::create(exec, vm, exec->lexicalGlobalObject()->WebAssemblyTableStructure(), initial, maximum));
}
-static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyTable(ExecState* state)
+static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyTable(ExecState* exec)
{
- VM& vm = state->vm();
+ VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(state, scope, "WebAssembly.Table"));
+ return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(exec, scope, "WebAssembly.Table"));
}
WebAssemblyTableConstructor* WebAssemblyTableConstructor::create(VM& vm, Structure* structure, WebAssemblyTablePrototype* thisPrototype)