]>
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. | |
13 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
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 A |
35 | #include "ResolveOperation.h" |
36 | #include "SpecialPointer.h" | |
9dae56ea | 37 | #include "Structure.h" |
14957cd0 | 38 | #include "StructureChain.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; | |
46 | struct LLIntCallLinkInfo; | |
47 | struct ValueProfile; | |
48 | ||
49 | struct Instruction { | |
50 | Instruction() | |
51 | { | |
52 | u.jsCell.clear(); | |
53 | } | |
6fe7ccc8 | 54 | |
93a37866 A |
55 | Instruction(Opcode opcode) |
56 | { | |
57 | #if !ENABLE(COMPUTED_GOTO_OPCODES) | |
58 | // We have to initialize one of the pointer members to ensure that | |
59 | // the entire struct is initialized, when opcode is not a pointer. | |
60 | u.jsCell.clear(); | |
6fe7ccc8 | 61 | #endif |
93a37866 A |
62 | u.opcode = opcode; |
63 | } | |
64 | ||
65 | Instruction(int operand) | |
66 | { | |
67 | // We have to initialize one of the pointer members to ensure that | |
68 | // the entire struct is initialized in 64-bit. | |
69 | u.jsCell.clear(); | |
70 | u.operand = operand; | |
71 | } | |
72 | ||
73 | Instruction(VM& vm, JSCell* owner, Structure* structure) | |
74 | { | |
75 | u.structure.clear(); | |
76 | u.structure.set(vm, owner, structure); | |
77 | } | |
78 | Instruction(VM& vm, JSCell* owner, StructureChain* structureChain) | |
79 | { | |
80 | u.structureChain.clear(); | |
81 | u.structureChain.set(vm, owner, structureChain); | |
82 | } | |
83 | Instruction(VM& vm, JSCell* owner, JSCell* jsCell) | |
84 | { | |
85 | u.jsCell.clear(); | |
86 | u.jsCell.set(vm, owner, jsCell); | |
87 | } | |
88 | ||
89 | Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; } | |
6fe7ccc8 | 90 | |
93a37866 | 91 | Instruction(LLIntCallLinkInfo* callLinkInfo) { u.callLinkInfo = callLinkInfo; } |
6fe7ccc8 | 92 | |
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; } | |
6fe7ccc8 | 97 | |
93a37866 A |
98 | Instruction(WriteBarrier<Unknown>* registerPointer) { u.registerPointer = registerPointer; } |
99 | ||
100 | Instruction(Special::Pointer pointer) { u.specialPointer = pointer; } | |
101 | ||
102 | Instruction(bool* predicatePointer) { u.predicatePointer = predicatePointer; } | |
103 | ||
104 | union { | |
105 | Opcode opcode; | |
106 | int operand; | |
107 | WriteBarrierBase<Structure> structure; | |
108 | WriteBarrierBase<StructureChain> structureChain; | |
109 | WriteBarrierBase<JSCell> jsCell; | |
110 | WriteBarrier<Unknown>* registerPointer; | |
111 | Special::Pointer specialPointer; | |
112 | PropertySlot::GetValueFunc getterFunc; | |
113 | LLIntCallLinkInfo* callLinkInfo; | |
114 | ValueProfile* profile; | |
115 | ArrayProfile* arrayProfile; | |
116 | ArrayAllocationProfile* arrayAllocationProfile; | |
117 | ObjectAllocationProfile* objectAllocationProfile; | |
118 | void* pointer; | |
119 | bool* predicatePointer; | |
120 | ResolveOperations* resolveOperations; | |
121 | PutToBaseOperation* putToBaseOperation; | |
122 | } u; | |
14957cd0 | 123 | |
93a37866 A |
124 | private: |
125 | Instruction(StructureChain*); | |
126 | Instruction(Structure*); | |
127 | }; | |
9dae56ea A |
128 | |
129 | } // namespace JSC | |
130 | ||
131 | namespace WTF { | |
132 | ||
93a37866 | 133 | template<> struct VectorTraits<JSC::Instruction> : VectorTraitsBase<true, JSC::Instruction> { }; |
9dae56ea A |
134 | |
135 | } // namespace WTF | |
136 | ||
137 | #endif // Instruction_h |