Changeset 214979 in webkit for trunk/Source/JavaScriptCore/interpreter
- Timestamp:
- Apr 5, 2017, 4:59:11 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore/interpreter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r214905 r214979 88 88 static const int headerSizeInRegisters = CallFrameSlot::argumentCount + 1; 89 89 90 JSValue calleeAsValue() const 90 // This function should only be called in very specific circumstances 91 // when you've guaranteed the callee can't be a Wasm callee, and can 92 // be an arbitrary JSValue. This function should basically never be used. 93 // Its only use right now is when we are making a call, and we're not 94 // yet sure if the callee is a cell. In general, a JS callee is guaranteed 95 // to be a cell, however, there is a brief window where we need to check 96 // to see if it's a cell, and if it's not, we throw an exception. 97 JSValue guaranteedJSValueCallee() const 91 98 { 92 99 ASSERT(!callee().isWasm()); -
trunk/Source/JavaScriptCore/interpreter/CalleeBits.h
r214905 r214979 26 26 #pragma once 27 27 28 #include "JSCJSValue.h" 28 29 #include <wtf/StdLibExtras.h> 29 30 … … 37 38 38 39 class CalleeBits { 39 static constexpr uintptr_t wasmTag = 1;40 40 public: 41 41 CalleeBits() = default; … … 49 49 } 50 50 51 #if ENABLE(WEBASSEMBLY) 51 52 static void* boxWasm(Wasm::Callee* callee) 52 53 { 53 ASSERT(!(bitwise_cast<uintptr_t>(callee) & wasmTag)); 54 return bitwise_cast<void*>(bitwise_cast<uintptr_t>(callee) | wasmTag); 54 CalleeBits result(bitwise_cast<void*>(bitwise_cast<uintptr_t>(callee) | TagBitsWasm)); 55 ASSERT(result.isWasm()); 56 return result.rawPtr(); 55 57 } 58 #endif 56 59 57 bool isWasm() const { return bitwise_cast<uintptr_t>(m_ptr) & wasmTag; } 60 bool isWasm() const 61 { 62 #if ENABLE(WEBASSEMBLY) 63 return (bitwise_cast<uintptr_t>(m_ptr) & TagWasmMask) == TagBitsWasm; 64 #else 65 return false; 66 #endif 67 } 58 68 bool isCell() const { return !isWasm(); } 59 69 … … 64 74 } 65 75 76 #if ENABLE(WEBASSEMBLY) 66 77 Wasm::Callee* asWasmCallee() const 67 78 { 68 79 ASSERT(isWasm()); 69 return bitwise_cast<Wasm::Callee*>(bitwise_cast<uintptr_t>(m_ptr) & ~ wasmTag);80 return bitwise_cast<Wasm::Callee*>(bitwise_cast<uintptr_t>(m_ptr) & ~TagBitsWasm); 70 81 } 82 #endif 71 83 72 84 void* rawPtr() const { return m_ptr; }
Note:
See TracChangeset
for help on using the changeset viewer.