Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: src/compiler/simplified-operator.h

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/compiler/simplified-operator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/compiler/machine-type.h" 10 #include "src/compiler/machine-type.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } 46 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
47 }; 47 };
48 48
49 bool operator==(FieldAccess const&, FieldAccess const&); 49 bool operator==(FieldAccess const&, FieldAccess const&);
50 bool operator!=(FieldAccess const&, FieldAccess const&); 50 bool operator!=(FieldAccess const&, FieldAccess const&);
51 51
52 size_t hash_value(FieldAccess const&); 52 size_t hash_value(FieldAccess const&);
53 53
54 std::ostream& operator<<(std::ostream&, FieldAccess const&); 54 std::ostream& operator<<(std::ostream&, FieldAccess const&);
55 55
56 56 const FieldAccess& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT;
57 // The bound checking mode for ElementAccess below.
58 enum BoundsCheckMode { kNoBoundsCheck, kTypedArrayBoundsCheck };
59
60 std::ostream& operator<<(std::ostream&, BoundsCheckMode);
61 57
62 58
63 // An access descriptor for loads/stores of indexed structures like characters 59 // An access descriptor for loads/stores of indexed structures like characters
64 // in strings or off-heap backing stores. Accesses from either tagged or 60 // in strings or off-heap backing stores. Accesses from either tagged or
65 // untagged base pointers are supported; untagging is done automatically during 61 // untagged base pointers are supported; untagging is done automatically during
66 // lowering. 62 // lowering.
67 struct ElementAccess { 63 struct ElementAccess {
68 BoundsCheckMode bounds_check; // specifies the bounds checking mode.
69 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged. 64 BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
70 int header_size; // size of the header, without tag. 65 int header_size; // size of the header, without tag.
71 Type* type; // type of the element. 66 Type* type; // type of the element.
72 MachineType machine_type; // machine type of the element. 67 MachineType machine_type; // machine type of the element.
73 68
74 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; } 69 int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
75 }; 70 };
76 71
77 bool operator==(ElementAccess const&, ElementAccess const&); 72 bool operator==(ElementAccess const&, ElementAccess const&);
78 bool operator!=(ElementAccess const&, ElementAccess const&); 73 bool operator!=(ElementAccess const&, ElementAccess const&);
79 74
80 size_t hash_value(ElementAccess const&); 75 size_t hash_value(ElementAccess const&);
81 76
82 std::ostream& operator<<(std::ostream&, ElementAccess const&); 77 std::ostream& operator<<(std::ostream&, ElementAccess const&);
83 78
84
85 // If the accessed object is not a heap object, add this to the header_size.
86 static const int kNonHeapObjectHeaderSize = kHeapObjectTag;
87
88
89 const FieldAccess& FieldAccessOf(const Operator* op) WARN_UNUSED_RESULT;
90 const ElementAccess& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT; 79 const ElementAccess& ElementAccessOf(const Operator* op) WARN_UNUSED_RESULT;
91 80
92 81
82 // TODO(bmeurer)
83 class BufferAccess FINAL {
84 public:
85 BufferAccess(ExternalArrayType external_array_type, size_t guard_size)
86 : external_array_type_(external_array_type), guard_size_(guard_size) {}
87
88 ExternalArrayType external_array_type() const { return external_array_type_; }
89 MachineType machine_type() const;
90 size_t guard_size() const { return guard_size_; }
91
92 private:
93 ExternalArrayType external_array_type_;
94 size_t guard_size_;
95 };
96
97 bool operator==(BufferAccess const&, BufferAccess const&);
98 bool operator!=(BufferAccess const&, BufferAccess const&);
99
100 size_t hash_value(BufferAccess const&);
101
102 std::ostream& operator<<(std::ostream&, BufferAccess const&);
103
104 BufferAccess const& BufferAccessOf(const Operator* op) WARN_UNUSED_RESULT;
105
106
93 // Interface for building simplified operators, which represent the 107 // Interface for building simplified operators, which represent the
94 // medium-level operations of V8, including adding numbers, allocating objects, 108 // medium-level operations of V8, including adding numbers, allocating objects,
95 // indexing into objects and arrays, etc. 109 // indexing into objects and arrays, etc.
96 // All operators are typed but many are representation independent. 110 // All operators are typed but many are representation independent.
97 111
98 // Number values from JS can be in one of these representations: 112 // Number values from JS can be in one of these representations:
99 // - Tagged: word-sized integer that is either 113 // - Tagged: word-sized integer that is either
100 // - a signed small integer (31 or 32 bits plus a tag) 114 // - a signed small integer (31 or 32 bits plus a tag)
101 // - a tagged pointer to a HeapNumber object that has a float64 field 115 // - a tagged pointer to a HeapNumber object that has a float64 field
102 // - Int32: an untagged signed 32-bit integer 116 // - Int32: an untagged signed 32-bit integer
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const Operator* ChangeBitToBool(); 161 const Operator* ChangeBitToBool();
148 162
149 const Operator* ObjectIsSmi(); 163 const Operator* ObjectIsSmi();
150 const Operator* ObjectIsNonNegativeSmi(); 164 const Operator* ObjectIsNonNegativeSmi();
151 165
152 const Operator* LoadField(const FieldAccess&); 166 const Operator* LoadField(const FieldAccess&);
153 const Operator* StoreField(const FieldAccess&); 167 const Operator* StoreField(const FieldAccess&);
154 168
155 // load-element [base + index], length 169 // load-element [base + index], length
156 const Operator* LoadElement(ElementAccess const&); 170 const Operator* LoadElement(ElementAccess const&);
157
158 // store-element [base + index], length, value 171 // store-element [base + index], length, value
159 const Operator* StoreElement(ElementAccess const&); 172 const Operator* StoreElement(ElementAccess const&);
160 173
174 // load-buffer [base + offset], length
175 const Operator* LoadBuffer(BufferAccess const&);
176 // store-buffer [base + offset], length, value
177 const Operator* StoreBuffer(BufferAccess const&);
178 // bounds-check(guard) offset, length
179 const Operator* BoundsCheck(size_t);
180
161 private: 181 private:
162 Zone* zone() const { return zone_; } 182 Zone* zone() const { return zone_; }
163 183
164 const SimplifiedOperatorGlobalCache& cache_; 184 const SimplifiedOperatorGlobalCache& cache_;
165 Zone* const zone_; 185 Zone* const zone_;
166 186
167 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); 187 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder);
168 }; 188 };
169 189
170 } // namespace compiler 190 } // namespace compiler
171 } // namespace internal 191 } // namespace internal
172 } // namespace v8 192 } // namespace v8
173 193
174 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ 194 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/compiler/simplified-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698