CacheIRCloner.h (2160B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef jit_CacheIRCloner_h 8 #define jit_CacheIRCloner_h 9 10 #include "mozilla/Attributes.h" 11 12 #include <stdint.h> 13 14 #include "NamespaceImports.h" 15 16 #include "jit/CacheIR.h" 17 #include "jit/CacheIROpsGenerated.h" 18 #include "jit/CacheIRReader.h" 19 #include "jit/CacheIRWriter.h" 20 #include "js/Id.h" 21 #include "js/Value.h" 22 23 class JSAtom; 24 class JSObject; 25 class JSString; 26 27 namespace JS { 28 class Symbol; 29 } 30 31 namespace js { 32 33 class BaseScript; 34 class GetterSetter; 35 class Shape; 36 37 namespace gc { 38 class AllocSite; 39 } 40 41 namespace jit { 42 43 class CacheIRStubInfo; 44 class ICCacheIRStub; 45 class JitCode; 46 47 class MOZ_RAII CacheIRCloner { 48 public: 49 explicit CacheIRCloner(ICCacheIRStub* stubInfo); 50 51 void cloneOp(CacheOp op, CacheIRReader& reader, CacheIRWriter& writer); 52 53 CACHE_IR_CLONE_GENERATED 54 55 private: 56 const CacheIRStubInfo* stubInfo_; 57 const uint8_t* stubData_; 58 59 uintptr_t readStubWord(uint32_t offset); 60 int64_t readStubInt64(uint32_t offset); 61 62 Shape* getShapeField(uint32_t stubOffset); 63 Shape* getWeakShapeField(uint32_t stubOffset); 64 JSObject* getObjectField(uint32_t stubOffset); 65 JSObject* getWeakObjectField(uint32_t stubOffset); 66 JSString* getStringField(uint32_t stubOffset); 67 JSAtom* getAtomField(uint32_t stubOffset); 68 JS::Symbol* getSymbolField(uint32_t stubOffset); 69 BaseScript* getWeakBaseScriptField(uint32_t stubOffset); 70 JitCode* getJitCodeField(uint32_t stubOffset); 71 uint32_t getRawInt32Field(uint32_t stubOffset); 72 const void* getRawPointerField(uint32_t stubOffset); 73 jsid getIdField(uint32_t stubOffset); 74 Value getValueField(uint32_t stubOffset); 75 Value getWeakValueField(uint32_t stubOffset); 76 uint64_t getRawInt64Field(uint32_t stubOffset); 77 double getDoubleField(uint32_t stubOffset); 78 gc::AllocSite* getAllocSiteField(uint32_t stubOffset); 79 }; 80 81 } // namespace jit 82 } // namespace js 83 84 #endif /* jit_CacheIRCloner_h */