]>
Commit | Line | Data |
---|---|---|
9dae56ea | 1 | /* |
93a37866 | 2 | * Copyright (C) 2008, 2012, 2013 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 | ||
ba379fdc | 32 | #include "MacroAssembler.h" |
9dae56ea | 33 | #include "Opcode.h" |
4e4e5a6f | 34 | #include "PropertySlot.h" |
93a37866 | 35 | #include "SpecialPointer.h" |
9dae56ea | 36 | #include "Structure.h" |
14957cd0 | 37 | #include "StructureChain.h" |
81345200 | 38 | #include "VirtualRegister.h" |
9dae56ea A |
39 | #include <wtf/VectorTraits.h> |
40 | ||
9dae56ea A |
41 | namespace JSC { |
42 | ||
93a37866 A |
43 | class ArrayAllocationProfile; |
44 | class ArrayProfile; | |
45 | class ObjectAllocationProfile; | |
81345200 | 46 | class VariableWatchpointSet; |
93a37866 A |
47 | struct LLIntCallLinkInfo; |
48 | struct ValueProfile; | |
49 | ||
50 | struct Instruction { | |
51 | Instruction() | |
52 | { | |
53 | u.jsCell.clear(); | |
54 | } | |
6fe7ccc8 | 55 | |
93a37866 A |
56 | Instruction(Opcode opcode) |
57 | { | |
58 | #if !ENABLE(COMPUTED_GOTO_OPCODES) | |
59 | // We have to initialize one of the pointer members to ensure that | |
60 | // the entire struct is initialized, when opcode is not a pointer. | |
61 | u.jsCell.clear(); | |
6fe7ccc8 | 62 | #endif |
93a37866 A |
63 | u.opcode = opcode; |
64 | } | |
65 | ||
66 | Instruction(int operand) | |
67 | { | |
68 | // We have to initialize one of the pointer members to ensure that | |
69 | // the entire struct is initialized in 64-bit. | |
70 | u.jsCell.clear(); | |
71 | u.operand = operand; | |
72 | } | |
73 | ||
74 | Instruction(VM& vm, JSCell* owner, Structure* structure) | |
75 | { | |
76 | u.structure.clear(); | |
77 | u.structure.set(vm, owner, structure); | |
78 | } | |
79 | Instruction(VM& vm, JSCell* owner, StructureChain* structureChain) | |
80 | { | |
81 | u.structureChain.clear(); | |
82 | u.structureChain.set(vm, owner, structureChain); | |
83 | } | |
84 | Instruction(VM& vm, JSCell* owner, JSCell* jsCell) | |
85 | { | |
86 | u.jsCell.clear(); | |
87 | u.jsCell.set(vm, owner, jsCell); | |
88 | } | |
89 | ||
90 | Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; } | |
6fe7ccc8 | 91 | |
93a37866 | 92 | Instruction(LLIntCallLinkInfo* callLinkInfo) { u.callLinkInfo = callLinkInfo; } |
93a37866 A |
93 | Instruction(ValueProfile* profile) { u.profile = profile; } |
94 | Instruction(ArrayProfile* profile) { u.arrayProfile = profile; } | |
95 | Instruction(ArrayAllocationProfile* profile) { u.arrayAllocationProfile = profile; } | |
96 | Instruction(ObjectAllocationProfile* profile) { u.objectAllocationProfile = profile; } | |
93a37866 | 97 | Instruction(WriteBarrier<Unknown>* registerPointer) { u.registerPointer = registerPointer; } |
93a37866 | 98 | Instruction(Special::Pointer pointer) { u.specialPointer = pointer; } |
81345200 | 99 | Instruction(StringImpl* uid) { u.uid = uid; } |
93a37866 A |
100 | Instruction(bool* predicatePointer) { u.predicatePointer = predicatePointer; } |
101 | ||
102 | union { | |
103 | Opcode opcode; | |
104 | int operand; | |
105 | WriteBarrierBase<Structure> structure; | |
106 | WriteBarrierBase<StructureChain> structureChain; | |
107 | WriteBarrierBase<JSCell> jsCell; | |
108 | WriteBarrier<Unknown>* registerPointer; | |
109 | Special::Pointer specialPointer; | |
110 | PropertySlot::GetValueFunc getterFunc; | |
111 | LLIntCallLinkInfo* callLinkInfo; | |
81345200 | 112 | StringImpl* uid; |
93a37866 A |
113 | ValueProfile* profile; |
114 | ArrayProfile* arrayProfile; | |
115 | ArrayAllocationProfile* arrayAllocationProfile; | |
116 | ObjectAllocationProfile* objectAllocationProfile; | |
81345200 A |
117 | VariableWatchpointSet* watchpointSet; |
118 | WriteBarrierBase<JSActivation> activation; | |
93a37866 A |
119 | void* pointer; |
120 | bool* predicatePointer; | |
93a37866 | 121 | } u; |
14957cd0 | 122 | |
93a37866 A |
123 | private: |
124 | Instruction(StructureChain*); | |
125 | Instruction(Structure*); | |
126 | }; | |
9dae56ea A |
127 | |
128 | } // namespace JSC | |
129 | ||
130 | namespace WTF { | |
131 | ||
93a37866 | 132 | template<> struct VectorTraits<JSC::Instruction> : VectorTraitsBase<true, JSC::Instruction> { }; |
9dae56ea A |
133 | |
134 | } // namespace WTF | |
135 | ||
136 | #endif // Instruction_h |