]>
Commit | Line | Data |
---|---|---|
9dae56ea | 1 | /* |
ed1e77d3 | 2 | * Copyright (C) 2008, 2012-2015 Apple Inc. All rights reserved. |
9dae56ea A |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
81345200 | 13 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of |
9dae56ea A |
14 | * its contributors may be used to endorse or promote products derived |
15 | * from this software without specific prior written permission. | |
16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #ifndef Instruction_h | |
30 | #define Instruction_h | |
31 | ||
ed1e77d3 | 32 | #include "BasicBlockLocation.h" |
ba379fdc | 33 | #include "MacroAssembler.h" |
9dae56ea | 34 | #include "Opcode.h" |
ed1e77d3 A |
35 | #include "SymbolTable.h" |
36 | #include "TypeLocation.h" | |
4e4e5a6f | 37 | #include "PropertySlot.h" |
93a37866 | 38 | #include "SpecialPointer.h" |
9dae56ea | 39 | #include "Structure.h" |
14957cd0 | 40 | #include "StructureChain.h" |
ed1e77d3 | 41 | #include "ToThisStatus.h" |
81345200 | 42 | #include "VirtualRegister.h" |
9dae56ea A |
43 | #include <wtf/VectorTraits.h> |
44 | ||
9dae56ea A |
45 | namespace JSC { |
46 | ||
93a37866 A |
47 | class ArrayAllocationProfile; |
48 | class ArrayProfile; | |
49 | class ObjectAllocationProfile; | |
ed1e77d3 | 50 | class WatchpointSet; |
93a37866 A |
51 | struct LLIntCallLinkInfo; |
52 | struct ValueProfile; | |
53 | ||
54 | struct Instruction { | |
55 | Instruction() | |
56 | { | |
57 | u.jsCell.clear(); | |
58 | } | |
6fe7ccc8 | 59 | |
93a37866 A |
60 | Instruction(Opcode opcode) |
61 | { | |
62 | #if !ENABLE(COMPUTED_GOTO_OPCODES) | |
63 | // We have to initialize one of the pointer members to ensure that | |
64 | // the entire struct is initialized, when opcode is not a pointer. | |
65 | u.jsCell.clear(); | |
6fe7ccc8 | 66 | #endif |
93a37866 A |
67 | u.opcode = opcode; |
68 | } | |
69 | ||
70 | Instruction(int operand) | |
71 | { | |
72 | // We have to initialize one of the pointer members to ensure that | |
73 | // the entire struct is initialized in 64-bit. | |
74 | u.jsCell.clear(); | |
75 | u.operand = operand; | |
76 | } | |
77 | ||
78 | Instruction(VM& vm, JSCell* owner, Structure* structure) | |
79 | { | |
80 | u.structure.clear(); | |
81 | u.structure.set(vm, owner, structure); | |
82 | } | |
83 | Instruction(VM& vm, JSCell* owner, StructureChain* structureChain) | |
84 | { | |
85 | u.structureChain.clear(); | |
86 | u.structureChain.set(vm, owner, structureChain); | |
87 | } | |
88 | Instruction(VM& vm, JSCell* owner, JSCell* jsCell) | |
89 | { | |
90 | u.jsCell.clear(); | |
91 | u.jsCell.set(vm, owner, jsCell); | |
92 | } | |
93 | ||
94 | Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; } | |
6fe7ccc8 | 95 | |
93a37866 | 96 | Instruction(LLIntCallLinkInfo* callLinkInfo) { u.callLinkInfo = callLinkInfo; } |
93a37866 A |
97 | Instruction(ValueProfile* profile) { u.profile = profile; } |
98 | Instruction(ArrayProfile* profile) { u.arrayProfile = profile; } | |
99 | Instruction(ArrayAllocationProfile* profile) { u.arrayAllocationProfile = profile; } | |
100 | Instruction(ObjectAllocationProfile* profile) { u.objectAllocationProfile = profile; } | |
ed1e77d3 | 101 | Instruction(WriteBarrier<Unknown>* variablePointer) { u.variablePointer = variablePointer; } |
93a37866 | 102 | Instruction(Special::Pointer pointer) { u.specialPointer = pointer; } |
ed1e77d3 | 103 | Instruction(UniquedStringImpl* uid) { u.uid = uid; } |
93a37866 A |
104 | Instruction(bool* predicatePointer) { u.predicatePointer = predicatePointer; } |
105 | ||
106 | union { | |
107 | Opcode opcode; | |
108 | int operand; | |
109 | WriteBarrierBase<Structure> structure; | |
ed1e77d3 | 110 | WriteBarrierBase<SymbolTable> symbolTable; |
93a37866 A |
111 | WriteBarrierBase<StructureChain> structureChain; |
112 | WriteBarrierBase<JSCell> jsCell; | |
ed1e77d3 | 113 | WriteBarrier<Unknown>* variablePointer; |
93a37866 A |
114 | Special::Pointer specialPointer; |
115 | PropertySlot::GetValueFunc getterFunc; | |
116 | LLIntCallLinkInfo* callLinkInfo; | |
ed1e77d3 | 117 | UniquedStringImpl* uid; |
93a37866 A |
118 | ValueProfile* profile; |
119 | ArrayProfile* arrayProfile; | |
120 | ArrayAllocationProfile* arrayAllocationProfile; | |
121 | ObjectAllocationProfile* objectAllocationProfile; | |
ed1e77d3 | 122 | WatchpointSet* watchpointSet; |
93a37866 A |
123 | void* pointer; |
124 | bool* predicatePointer; | |
ed1e77d3 A |
125 | ToThisStatus toThisStatus; |
126 | TypeLocation* location; | |
127 | BasicBlockLocation* basicBlockLocation; | |
93a37866 | 128 | } u; |
14957cd0 | 129 | |
93a37866 A |
130 | private: |
131 | Instruction(StructureChain*); | |
132 | Instruction(Structure*); | |
133 | }; | |
9dae56ea A |
134 | |
135 | } // namespace JSC | |
136 | ||
137 | namespace WTF { | |
138 | ||
93a37866 | 139 | template<> struct VectorTraits<JSC::Instruction> : VectorTraitsBase<true, JSC::Instruction> { }; |
9dae56ea A |
140 | |
141 | } // namespace WTF | |
142 | ||
143 | #endif // Instruction_h |