Title: [214541] trunk/Source/_javascript_Core
Revision
214541
Author
jfbast...@apple.com
Date
2017-03-29 10:17:49 -0700 (Wed, 29 Mar 2017)

Log Message

WebAssembly: NFC s/goto/lambda/g
https://bugs.webkit.org/show_bug.cgi?id=170242

Reviewed by Mark Lam.

Lambdas are more in-style than the goto I just used.

* wasm/WasmMemory.cpp:
(JSC::Wasm::tryGetFastMemory):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (214540 => 214541)


--- trunk/Source/_javascript_Core/ChangeLog	2017-03-29 17:08:23 UTC (rev 214540)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-03-29 17:17:49 UTC (rev 214541)
@@ -1,3 +1,15 @@
+2017-03-29  JF Bastien  <jfbast...@apple.com>
+
+        WebAssembly: NFC s/goto/lambda/g
+        https://bugs.webkit.org/show_bug.cgi?id=170242
+
+        Reviewed by Mark Lam.
+
+        Lambdas are more in-style than the goto I just used.
+
+        * wasm/WasmMemory.cpp:
+        (JSC::Wasm::tryGetFastMemory):
+
 2017-03-28  Saam Barati  <sbar...@apple.com>
 
         AssemblyHelpers should not have a VM field

Modified: trunk/Source/_javascript_Core/wasm/WasmMemory.cpp (214540 => 214541)


--- trunk/Source/_javascript_Core/wasm/WasmMemory.cpp	2017-03-29 17:08:23 UTC (rev 214540)
+++ trunk/Source/_javascript_Core/wasm/WasmMemory.cpp	2017-03-29 17:17:49 UTC (rev 214541)
@@ -118,15 +118,21 @@
         return false;
     };
 
+    auto fail = [] () -> bool {
+        if (UNLIKELY(Options::crashIfWebAssemblyCantFastMemory()))
+            webAssemblyCouldntGetFastMemory();
+        return false;
+    };
+
     // We might GC here so we should be holding the API lock.
     // FIXME: We should be able to syncronously trigger the GC from another thread.
     ASSERT(vm.currentThreadIsHoldingAPILock());
     if (UNLIKELY(!fastMemoryEnabled()))
-        goto fail;
+        return fail();
 
     // We need to be sure we have a stub prior to running code.
     if (UNLIKELY(!vm.getCTIStub(throwExceptionFromWasmThunkGenerator).size()))
-        goto fail;
+        return fail();
 
     ASSERT(allocatedFastMemories <= maxFastMemories);
     if (dequeFastMemory())
@@ -138,7 +144,7 @@
         vm.heap.collectAllGarbage();
         if (dequeFastMemory())
             return true;
-        goto fail;
+        return fail();
     }
 
     if (mmapBytes(fastMemoryMappedBytes, memory)) {
@@ -152,13 +158,8 @@
 
     if (memory)
         return true;
-    goto fail;
 
-fail:
-    if (UNLIKELY(Options::crashIfWebAssemblyCantFastMemory()))
-        webAssemblyCouldntGetFastMemory();
-
-    return false;
+    return fail();
 }
 
 inline void releaseFastMemory(void*& memory, size_t writableSize, size_t mappedCapacity, MemoryMode mode)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to