[JSC] Remove gcc warnings on mips and armv7
[WebKit-https.git] / Source / JavaScriptCore / runtime / ScriptExecutable.cpp
index 5236096..407e3a1 100644 (file)
@@ -29,6 +29,7 @@
 #include "CodeBlock.h"
 #include "Debugger.h"
 #include "EvalCodeBlock.h"
+#include "Exception.h"
 #include "FunctionCodeBlock.h"
 #include "IsoCellSetInlines.h"
 #include "JIT.h"
@@ -337,7 +338,7 @@ static void setupJIT(VM& vm, CodeBlock* codeBlock)
 #endif
 }
 
-JSObject* ScriptExecutable::prepareForExecutionImpl(
+std::optional<Exception*> ScriptExecutable::prepareForExecutionImpl(
     VM& vm, JSFunction* function, JSScope* scope, CodeSpecializationKind kind, CodeBlock*& resultCodeBlock)
 {
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -345,7 +346,7 @@ JSObject* ScriptExecutable::prepareForExecutionImpl(
 
     if (vm.getAndClearFailNextNewCodeBlock()) {
         auto& state = *scope->globalObject(vm)->globalExec();
-        return throwException(&state, throwScope, createError(&state, "Forced Failure"_s));
+        return static_cast<Exception*>(throwException(&state, throwScope, createError(&state, "Forced Failure"_s)));
     }
 
     JSObject* exception = nullptr;
@@ -353,7 +354,7 @@ JSObject* ScriptExecutable::prepareForExecutionImpl(
     resultCodeBlock = codeBlock;
     EXCEPTION_ASSERT(!!throwScope.exception() == !codeBlock);
     if (UNLIKELY(!codeBlock))
-        return exception;
+        return static_cast<Exception*>(exception);
     
     if (Options::validateBytecode())
         codeBlock->validate();
@@ -364,7 +365,7 @@ JSObject* ScriptExecutable::prepareForExecutionImpl(
         setupJIT(vm, codeBlock);
     
     installCode(vm, codeBlock, codeBlock->codeType(), codeBlock->specializationKind());
-    return nullptr;
+    return std::nullopt;
 }
 
 CodeBlockHash ScriptExecutable::hashFor(CodeSpecializationKind kind) const