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

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

Issue 1175503002: Turbofan: Make type feedback vector a Node. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 6 months 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/js-generic-lowering.cc ('k') | src/compiler/js-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_JS_OPERATOR_H_ 5 #ifndef V8_COMPILER_JS_OPERATOR_H_
6 #define V8_COMPILER_JS_OPERATOR_H_ 6 #define V8_COMPILER_JS_OPERATOR_H_
7 7
8 #include "src/runtime/runtime.h" 8 #include "src/runtime/runtime.h"
9 #include "src/unique.h" 9 #include "src/unique.h"
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 bool operator==(ContextAccess const&, ContextAccess const&); 105 bool operator==(ContextAccess const&, ContextAccess const&);
106 bool operator!=(ContextAccess const&, ContextAccess const&); 106 bool operator!=(ContextAccess const&, ContextAccess const&);
107 107
108 size_t hash_value(ContextAccess const&); 108 size_t hash_value(ContextAccess const&);
109 109
110 std::ostream& operator<<(std::ostream&, ContextAccess const&); 110 std::ostream& operator<<(std::ostream&, ContextAccess const&);
111 111
112 ContextAccess const& ContextAccessOf(Operator const*); 112 ContextAccess const& ContextAccessOf(Operator const*);
113 113
114 114
115 class VectorSlotPair { 115 // A ResolvedFeedbackSlot needs to query the type feedback vector to get it's
116 // index in the vector.
117 class ResolvedFeedbackSlot {
116 public: 118 public:
117 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) 119 ResolvedFeedbackSlot(Handle<TypeFeedbackVector> vector,
118 : vector_(vector), slot_(slot) {} 120 FeedbackVectorICSlot slot)
121 : slot_(slot),
122 index_(slot == FeedbackVectorICSlot::Invalid() ? -1 : vector->GetIndex(
123 slot)) {}
124 ResolvedFeedbackSlot() : slot_(FeedbackVectorICSlot::Invalid()), index_(-1) {}
119 125
120 Handle<TypeFeedbackVector> vector() const { return vector_; }
121 FeedbackVectorICSlot slot() const { return slot_; } 126 FeedbackVectorICSlot slot() const { return slot_; }
122 127 int index() const { return index_; }
123 int index() const { return vector_->GetIndex(slot_); }
124 128
125 private: 129 private:
126 const Handle<TypeFeedbackVector> vector_;
127 const FeedbackVectorICSlot slot_; 130 const FeedbackVectorICSlot slot_;
131 const int index_;
128 }; 132 };
129 133
130 134
131 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs); 135 bool operator==(ResolvedFeedbackSlot const& lhs,
136 ResolvedFeedbackSlot const& rhs);
132 137
133 138
134 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to 139 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to
135 // inline checks whether the lookup yields in a global variable. This is used as 140 // inline checks whether the lookup yields in a global variable. This is used as
136 // a parameter by JSLoadDynamicGlobal and JSStoreDynamicGlobal operators. 141 // a parameter by JSLoadDynamicGlobal and JSStoreDynamicGlobal operators.
137 class DynamicGlobalAccess final { 142 class DynamicGlobalAccess final {
138 public: 143 public:
139 DynamicGlobalAccess(const Handle<String>& name, uint32_t check_bitset, 144 DynamicGlobalAccess(const Handle<String>& name, uint32_t check_bitset,
140 const VectorSlotPair& feedback, ContextualMode mode); 145 const ResolvedFeedbackSlot& feedback,
146 ContextualMode mode);
141 147
142 const Handle<String>& name() const { return name_; } 148 const Handle<String>& name() const { return name_; }
143 uint32_t check_bitset() const { return check_bitset_; } 149 uint32_t check_bitset() const { return check_bitset_; }
144 const VectorSlotPair& feedback() const { return feedback_; } 150 const ResolvedFeedbackSlot& feedback() const { return feedback_; }
145 ContextualMode mode() const { return mode_; } 151 ContextualMode mode() const { return mode_; }
146 152
147 // Indicates that an inline check is disabled. 153 // Indicates that an inline check is disabled.
148 bool RequiresFullCheck() const { 154 bool RequiresFullCheck() const {
149 return check_bitset() == kFullCheckRequired; 155 return check_bitset() == kFullCheckRequired;
150 } 156 }
151 157
152 // Limit of context chain length to which inline check is possible. 158 // Limit of context chain length to which inline check is possible.
153 static const int kMaxCheckDepth = 30; 159 static const int kMaxCheckDepth = 30;
154 160
155 // Sentinel for {check_bitset} disabling inline checks. 161 // Sentinel for {check_bitset} disabling inline checks.
156 static const uint32_t kFullCheckRequired = -1; 162 static const uint32_t kFullCheckRequired = -1;
157 163
158 private: 164 private:
159 const Handle<String> name_; 165 const Handle<String> name_;
160 const uint32_t check_bitset_; 166 const uint32_t check_bitset_;
161 const VectorSlotPair feedback_; 167 const ResolvedFeedbackSlot feedback_;
162 const ContextualMode mode_; 168 const ContextualMode mode_;
163 }; 169 };
164 170
165 size_t hash_value(DynamicGlobalAccess const&); 171 size_t hash_value(DynamicGlobalAccess const&);
166 172
167 bool operator==(DynamicGlobalAccess const&, DynamicGlobalAccess const&); 173 bool operator==(DynamicGlobalAccess const&, DynamicGlobalAccess const&);
168 bool operator!=(DynamicGlobalAccess const&, DynamicGlobalAccess const&); 174 bool operator!=(DynamicGlobalAccess const&, DynamicGlobalAccess const&);
169 175
170 std::ostream& operator<<(std::ostream&, DynamicGlobalAccess const&); 176 std::ostream& operator<<(std::ostream&, DynamicGlobalAccess const&);
171 177
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 214
209 std::ostream& operator<<(std::ostream&, DynamicContextAccess const&); 215 std::ostream& operator<<(std::ostream&, DynamicContextAccess const&);
210 216
211 DynamicContextAccess const& DynamicContextAccessOf(Operator const*); 217 DynamicContextAccess const& DynamicContextAccessOf(Operator const*);
212 218
213 219
214 // Defines the property being loaded from an object by a named load. This is 220 // Defines the property being loaded from an object by a named load. This is
215 // used as a parameter by JSLoadNamed operators. 221 // used as a parameter by JSLoadNamed operators.
216 class LoadNamedParameters final { 222 class LoadNamedParameters final {
217 public: 223 public:
218 LoadNamedParameters(const Unique<Name>& name, const VectorSlotPair& feedback, 224 LoadNamedParameters(const Unique<Name>& name,
225 const ResolvedFeedbackSlot& feedback,
219 ContextualMode contextual_mode) 226 ContextualMode contextual_mode)
220 : name_(name), feedback_(feedback), contextual_mode_(contextual_mode) {} 227 : name_(name), feedback_(feedback), contextual_mode_(contextual_mode) {}
221 228
222 const Unique<Name>& name() const { return name_; } 229 const Unique<Name>& name() const { return name_; }
223 ContextualMode contextual_mode() const { return contextual_mode_; } 230 ContextualMode contextual_mode() const { return contextual_mode_; }
224 231
225 const VectorSlotPair& feedback() const { return feedback_; } 232 const ResolvedFeedbackSlot& feedback() const { return feedback_; }
226 233
227 private: 234 private:
228 const Unique<Name> name_; 235 const Unique<Name> name_;
229 const VectorSlotPair feedback_; 236 const ResolvedFeedbackSlot feedback_;
230 const ContextualMode contextual_mode_; 237 const ContextualMode contextual_mode_;
231 }; 238 };
232 239
233 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); 240 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&);
234 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); 241 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&);
235 242
236 size_t hash_value(LoadNamedParameters const&); 243 size_t hash_value(LoadNamedParameters const&);
237 244
238 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); 245 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&);
239 246
240 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); 247 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op);
241 248
242 249
243 // Defines the property being loaded from an object. This is 250 // Defines the property being loaded from an object. This is
244 // used as a parameter by JSLoadProperty operators. 251 // used as a parameter by JSLoadProperty operators.
245 class LoadPropertyParameters final { 252 class LoadPropertyParameters final {
246 public: 253 public:
247 explicit LoadPropertyParameters(const VectorSlotPair& feedback) 254 explicit LoadPropertyParameters(const ResolvedFeedbackSlot& feedback)
248 : feedback_(feedback) {} 255 : feedback_(feedback) {}
249 256
250 const VectorSlotPair& feedback() const { return feedback_; } 257 const ResolvedFeedbackSlot& feedback() const { return feedback_; }
251 258
252 private: 259 private:
253 const VectorSlotPair feedback_; 260 const ResolvedFeedbackSlot feedback_;
254 }; 261 };
255 262
256 bool operator==(LoadPropertyParameters const&, LoadPropertyParameters const&); 263 bool operator==(LoadPropertyParameters const&, LoadPropertyParameters const&);
257 bool operator!=(LoadPropertyParameters const&, LoadPropertyParameters const&); 264 bool operator!=(LoadPropertyParameters const&, LoadPropertyParameters const&);
258 265
259 size_t hash_value(LoadPropertyParameters const&); 266 size_t hash_value(LoadPropertyParameters const&);
260 267
261 std::ostream& operator<<(std::ostream&, LoadPropertyParameters const&); 268 std::ostream& operator<<(std::ostream&, LoadPropertyParameters const&);
262 269
263 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op); 270 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 PretenureFlag pretenure); 361 PretenureFlag pretenure);
355 const Operator* CreateLiteralArray(int literal_flags); 362 const Operator* CreateLiteralArray(int literal_flags);
356 const Operator* CreateLiteralObject(int literal_flags); 363 const Operator* CreateLiteralObject(int literal_flags);
357 364
358 const Operator* CallFunction(size_t arity, CallFunctionFlags flags, 365 const Operator* CallFunction(size_t arity, CallFunctionFlags flags,
359 LanguageMode language_mode); 366 LanguageMode language_mode);
360 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); 367 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
361 368
362 const Operator* CallConstruct(int arguments); 369 const Operator* CallConstruct(int arguments);
363 370
364 const Operator* LoadProperty(const VectorSlotPair& feedback); 371 const Operator* LoadProperty(const ResolvedFeedbackSlot& feedback);
365 const Operator* LoadNamed(const Unique<Name>& name, 372 const Operator* LoadNamed(const Unique<Name>& name,
366 const VectorSlotPair& feedback, 373 const ResolvedFeedbackSlot& feedback,
367 ContextualMode contextual_mode = NOT_CONTEXTUAL); 374 ContextualMode contextual_mode = NOT_CONTEXTUAL);
368 375
369 const Operator* StoreProperty(LanguageMode language_mode); 376 const Operator* StoreProperty(LanguageMode language_mode);
370 const Operator* StoreNamed(LanguageMode language_mode, 377 const Operator* StoreNamed(LanguageMode language_mode,
371 const Unique<Name>& name); 378 const Unique<Name>& name);
372 379
373 const Operator* DeleteProperty(LanguageMode language_mode); 380 const Operator* DeleteProperty(LanguageMode language_mode);
374 381
375 const Operator* HasProperty(); 382 const Operator* HasProperty();
376 383
377 const Operator* LoadContext(size_t depth, size_t index, bool immutable); 384 const Operator* LoadContext(size_t depth, size_t index, bool immutable);
378 const Operator* StoreContext(size_t depth, size_t index); 385 const Operator* StoreContext(size_t depth, size_t index);
379 386
380 const Operator* LoadDynamicGlobal(const Handle<String>& name, 387 const Operator* LoadDynamicGlobal(const Handle<String>& name,
381 uint32_t check_bitset, 388 uint32_t check_bitset,
382 const VectorSlotPair& feedback, 389 const ResolvedFeedbackSlot& feedback,
383 ContextualMode mode); 390 ContextualMode mode);
384 const Operator* LoadDynamicContext(const Handle<String>& name, 391 const Operator* LoadDynamicContext(const Handle<String>& name,
385 uint32_t check_bitset, size_t depth, 392 uint32_t check_bitset, size_t depth,
386 size_t index); 393 size_t index);
387 394
388 const Operator* TypeOf(); 395 const Operator* TypeOf();
389 const Operator* InstanceOf(); 396 const Operator* InstanceOf();
390 397
391 const Operator* ForInDone(); 398 const Operator* ForInDone();
392 const Operator* ForInNext(); 399 const Operator* ForInNext();
(...skipping 17 matching lines...) Expand all
410 Zone* const zone_; 417 Zone* const zone_;
411 418
412 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); 419 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
413 }; 420 };
414 421
415 } // namespace compiler 422 } // namespace compiler
416 } // namespace internal 423 } // namespace internal
417 } // namespace v8 424 } // namespace v8
418 425
419 #endif // V8_COMPILER_JS_OPERATOR_H_ 426 #endif // V8_COMPILER_JS_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698