blob: 8390cbd902899b2f2a4516993c3635741397a147 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_JS_OPERATOR_H_
6#define V8_COMPILER_JS_OPERATOR_H_
7
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00008#include "src/compiler/type-hints.h"
Emily Bernierd0a1eb72015-03-24 16:35:39 -04009#include "src/runtime/runtime.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +000010
11namespace v8 {
12namespace internal {
13namespace compiler {
14
Emily Bernierd0a1eb72015-03-24 16:35:39 -040015// Forward declarations.
16class Operator;
17struct JSOperatorGlobalCache;
18
19
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000020// Defines a pair of {TypeFeedbackVector} and {TypeFeedbackVectorSlot}, which
21// is used to access the type feedback for a certain {Node}.
22class VectorSlotPair {
Emily Bernierd0a1eb72015-03-24 16:35:39 -040023 public:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000024 VectorSlotPair();
25 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot)
26 : vector_(vector), slot_(slot) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -040027
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000028 bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
29
30 Handle<TypeFeedbackVector> vector() const { return vector_; }
31 FeedbackVectorSlot slot() const { return slot_; }
32
33 int index() const;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040034
35 private:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000036 const Handle<TypeFeedbackVector> vector_;
37 const FeedbackVectorSlot slot_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040038};
39
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000040bool operator==(VectorSlotPair const&, VectorSlotPair const&);
41bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
42
43size_t hash_value(VectorSlotPair const&);
44
45
46// The ConvertReceiverMode is used as parameter by JSConvertReceiver operators.
47ConvertReceiverMode ConvertReceiverModeOf(Operator const* op);
48
49
50// The ToBooleanHints are used as parameter by JSToBoolean operators.
51ToBooleanHints ToBooleanHintsOf(Operator const* op);
52
53
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000054// Defines the arity and the feedback for a JavaScript constructor call. This is
55// used as a parameter by JSCallConstruct operators.
56class CallConstructParameters final {
57 public:
58 CallConstructParameters(size_t arity, VectorSlotPair const& feedback)
59 : arity_(arity), feedback_(feedback) {}
60
61 size_t arity() const { return arity_; }
62 VectorSlotPair const& feedback() const { return feedback_; }
63
64 private:
65 size_t const arity_;
66 VectorSlotPair const feedback_;
67};
68
69bool operator==(CallConstructParameters const&, CallConstructParameters const&);
70bool operator!=(CallConstructParameters const&, CallConstructParameters const&);
71
72size_t hash_value(CallConstructParameters const&);
73
74std::ostream& operator<<(std::ostream&, CallConstructParameters const&);
75
76CallConstructParameters const& CallConstructParametersOf(Operator const*);
77
78
79// Defines the arity and the call flags for a JavaScript function call. This is
80// used as a parameter by JSCallFunction operators.
81class CallFunctionParameters final {
82 public:
Ben Murdoch097c5b22016-05-18 11:27:45 +010083 CallFunctionParameters(size_t arity, VectorSlotPair const& feedback,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000084 TailCallMode tail_call_mode,
85 ConvertReceiverMode convert_mode)
86 : bit_field_(ArityField::encode(arity) |
87 ConvertReceiverModeField::encode(convert_mode) |
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000088 TailCallModeField::encode(tail_call_mode)),
89 feedback_(feedback) {}
90
91 size_t arity() const { return ArityField::decode(bit_field_); }
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000092 ConvertReceiverMode convert_mode() const {
93 return ConvertReceiverModeField::decode(bit_field_);
94 }
95 TailCallMode tail_call_mode() const {
96 return TailCallModeField::decode(bit_field_);
97 }
98 VectorSlotPair const& feedback() const { return feedback_; }
99
100 bool operator==(CallFunctionParameters const& that) const {
101 return this->bit_field_ == that.bit_field_ &&
102 this->feedback_ == that.feedback_;
103 }
104 bool operator!=(CallFunctionParameters const& that) const {
105 return !(*this == that);
106 }
107
108 private:
109 friend size_t hash_value(CallFunctionParameters const& p) {
110 return base::hash_combine(p.bit_field_, p.feedback_);
111 }
112
Ben Murdoch097c5b22016-05-18 11:27:45 +0100113 typedef BitField<size_t, 0, 29> ArityField;
114 typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000115 typedef BitField<TailCallMode, 31, 1> TailCallModeField;
116
117 const uint32_t bit_field_;
118 const VectorSlotPair feedback_;
119};
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400120
121size_t hash_value(CallFunctionParameters const&);
122
123std::ostream& operator<<(std::ostream&, CallFunctionParameters const&);
124
125const CallFunctionParameters& CallFunctionParametersOf(const Operator* op);
126
127
128// Defines the arity and the ID for a runtime function call. This is used as a
129// parameter by JSCallRuntime operators.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000130class CallRuntimeParameters final {
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400131 public:
132 CallRuntimeParameters(Runtime::FunctionId id, size_t arity)
133 : id_(id), arity_(arity) {}
134
135 Runtime::FunctionId id() const { return id_; }
136 size_t arity() const { return arity_; }
137
138 private:
139 const Runtime::FunctionId id_;
140 const size_t arity_;
141};
142
143bool operator==(CallRuntimeParameters const&, CallRuntimeParameters const&);
144bool operator!=(CallRuntimeParameters const&, CallRuntimeParameters const&);
145
146size_t hash_value(CallRuntimeParameters const&);
147
148std::ostream& operator<<(std::ostream&, CallRuntimeParameters const&);
149
150const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op);
151
152
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000153// Defines the location of a context slot relative to a specific scope. This is
154// used as a parameter by JSLoadContext and JSStoreContext operators and allows
155// accessing a context-allocated variable without keeping track of the scope.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000156class ContextAccess final {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000157 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400158 ContextAccess(size_t depth, size_t index, bool immutable);
159
160 size_t depth() const { return depth_; }
161 size_t index() const { return index_; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000162 bool immutable() const { return immutable_; }
163
164 private:
165 // For space reasons, we keep this tightly packed, otherwise we could just use
166 // a simple int/int/bool POD.
167 const bool immutable_;
168 const uint16_t depth_;
169 const uint32_t index_;
170};
171
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400172bool operator==(ContextAccess const&, ContextAccess const&);
173bool operator!=(ContextAccess const&, ContextAccess const&);
174
175size_t hash_value(ContextAccess const&);
176
177std::ostream& operator<<(std::ostream&, ContextAccess const&);
178
179ContextAccess const& ContextAccessOf(Operator const*);
180
181
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000182// Defines the property of an object for a named access. This is
183// used as a parameter by the JSLoadNamed and JSStoreNamed operators.
184class NamedAccess final {
185 public:
186 NamedAccess(LanguageMode language_mode, Handle<Name> name,
187 VectorSlotPair const& feedback)
188 : name_(name), feedback_(feedback), language_mode_(language_mode) {}
189
190 Handle<Name> name() const { return name_; }
191 LanguageMode language_mode() const { return language_mode_; }
192 VectorSlotPair const& feedback() const { return feedback_; }
193
194 private:
195 Handle<Name> const name_;
196 VectorSlotPair const feedback_;
197 LanguageMode const language_mode_;
198};
199
200bool operator==(NamedAccess const&, NamedAccess const&);
201bool operator!=(NamedAccess const&, NamedAccess const&);
202
203size_t hash_value(NamedAccess const&);
204
205std::ostream& operator<<(std::ostream&, NamedAccess const&);
206
207const NamedAccess& NamedAccessOf(const Operator* op);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400208
209
210// Defines the property being loaded from an object by a named load. This is
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000211// used as a parameter by JSLoadGlobal operator.
212class LoadGlobalParameters final {
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400213 public:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000214 LoadGlobalParameters(const Handle<Name>& name, const VectorSlotPair& feedback,
215 TypeofMode typeof_mode)
216 : name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400217
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000218 const Handle<Name>& name() const { return name_; }
219 TypeofMode typeof_mode() const { return typeof_mode_; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400220
221 const VectorSlotPair& feedback() const { return feedback_; }
222
223 private:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000224 const Handle<Name> name_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400225 const VectorSlotPair feedback_;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000226 const TypeofMode typeof_mode_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000227};
228
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000229bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&);
230bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400231
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000232size_t hash_value(LoadGlobalParameters const&);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400233
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000234std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400235
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000236const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400237
238
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000239// Defines the property being stored to an object by a named store. This is
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000240// used as a parameter by JSStoreGlobal operator.
241class StoreGlobalParameters final {
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400242 public:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000243 StoreGlobalParameters(LanguageMode language_mode,
244 const VectorSlotPair& feedback,
245 const Handle<Name>& name)
246 : language_mode_(language_mode), name_(name), feedback_(feedback) {}
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400247
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000248 LanguageMode language_mode() const { return language_mode_; }
249 const VectorSlotPair& feedback() const { return feedback_; }
250 const Handle<Name>& name() const { return name_; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400251
252 private:
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000253 const LanguageMode language_mode_;
254 const Handle<Name> name_;
255 const VectorSlotPair feedback_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000256};
257
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000258bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&);
259bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400260
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000261size_t hash_value(StoreGlobalParameters const&);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400262
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000263std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400264
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000265const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op);
266
267
268// Defines the property of an object for a keyed access. This is used
269// as a parameter by the JSLoadProperty and JSStoreProperty operators.
270class PropertyAccess final {
271 public:
272 PropertyAccess(LanguageMode language_mode, VectorSlotPair const& feedback)
273 : feedback_(feedback), language_mode_(language_mode) {}
274
275 LanguageMode language_mode() const { return language_mode_; }
276 VectorSlotPair const& feedback() const { return feedback_; }
277
278 private:
279 VectorSlotPair const feedback_;
280 LanguageMode const language_mode_;
281};
282
283bool operator==(PropertyAccess const&, PropertyAccess const&);
284bool operator!=(PropertyAccess const&, PropertyAccess const&);
285
286size_t hash_value(PropertyAccess const&);
287
288std::ostream& operator<<(std::ostream&, PropertyAccess const&);
289
290PropertyAccess const& PropertyAccessOf(const Operator* op);
291
292
Ben Murdoch097c5b22016-05-18 11:27:45 +0100293// CreateArgumentsType is used as parameter to JSCreateArguments nodes.
294CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000295
296
297// Defines shared information for the array that should be created. This is
298// used as parameter by JSCreateArray operators.
299class CreateArrayParameters final {
300 public:
301 explicit CreateArrayParameters(size_t arity, Handle<AllocationSite> site)
302 : arity_(arity), site_(site) {}
303
304 size_t arity() const { return arity_; }
305 Handle<AllocationSite> site() const { return site_; }
306
307 private:
308 size_t const arity_;
309 Handle<AllocationSite> const site_;
310};
311
312bool operator==(CreateArrayParameters const&, CreateArrayParameters const&);
313bool operator!=(CreateArrayParameters const&, CreateArrayParameters const&);
314
315size_t hash_value(CreateArrayParameters const&);
316
317std::ostream& operator<<(std::ostream&, CreateArrayParameters const&);
318
319const CreateArrayParameters& CreateArrayParametersOf(const Operator* op);
320
321
322// Defines shared information for the closure that should be created. This is
323// used as a parameter by JSCreateClosure operators.
324class CreateClosureParameters final {
325 public:
326 CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,
327 PretenureFlag pretenure)
328 : shared_info_(shared_info), pretenure_(pretenure) {}
329
330 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
331 PretenureFlag pretenure() const { return pretenure_; }
332
333 private:
334 const Handle<SharedFunctionInfo> shared_info_;
335 const PretenureFlag pretenure_;
336};
337
338bool operator==(CreateClosureParameters const&, CreateClosureParameters const&);
339bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&);
340
341size_t hash_value(CreateClosureParameters const&);
342
343std::ostream& operator<<(std::ostream&, CreateClosureParameters const&);
344
345const CreateClosureParameters& CreateClosureParametersOf(const Operator* op);
346
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000347// Defines shared information for the literal that should be created. This is
348// used as parameter by JSCreateLiteralArray, JSCreateLiteralObject and
349// JSCreateLiteralRegExp operators.
350class CreateLiteralParameters final {
351 public:
Ben Murdochda12d292016-06-02 14:46:10 +0100352 CreateLiteralParameters(Handle<HeapObject> constant, int length, int flags,
353 int index)
354 : constant_(constant), length_(length), flags_(flags), index_(index) {}
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000355
356 Handle<HeapObject> constant() const { return constant_; }
Ben Murdochda12d292016-06-02 14:46:10 +0100357 int length() const { return length_; }
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000358 int flags() const { return flags_; }
359 int index() const { return index_; }
360
361 private:
362 Handle<HeapObject> const constant_;
Ben Murdochda12d292016-06-02 14:46:10 +0100363 int const length_;
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000364 int const flags_;
365 int const index_;
366};
367
368bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&);
369bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&);
370
371size_t hash_value(CreateLiteralParameters const&);
372
373std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&);
374
375const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400376
Ben Murdoch61f157c2016-09-16 13:49:30 +0100377const BinaryOperationHints& BinaryOperationHintsOf(const Operator* op);
378
379const CompareOperationHints& CompareOperationHintsOf(const Operator* op);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400380
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000381// Interface for building JavaScript-level operators, e.g. directly from the
382// AST. Most operators have no parameters, thus can be globally shared for all
383// graphs.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000384class JSOperatorBuilder final : public ZoneObject {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000385 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400386 explicit JSOperatorBuilder(Zone* zone);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000387
Ben Murdoch61f157c2016-09-16 13:49:30 +0100388 const Operator* Equal(CompareOperationHints hints);
389 const Operator* NotEqual(CompareOperationHints hints);
390 const Operator* StrictEqual(CompareOperationHints hints);
391 const Operator* StrictNotEqual(CompareOperationHints hints);
392 const Operator* LessThan(CompareOperationHints hints);
393 const Operator* GreaterThan(CompareOperationHints hints);
394 const Operator* LessThanOrEqual(CompareOperationHints hints);
395 const Operator* GreaterThanOrEqual(CompareOperationHints hints);
Ben Murdoch097c5b22016-05-18 11:27:45 +0100396 const Operator* BitwiseOr(BinaryOperationHints hints);
397 const Operator* BitwiseXor(BinaryOperationHints hints);
398 const Operator* BitwiseAnd(BinaryOperationHints hints);
399 const Operator* ShiftLeft(BinaryOperationHints hints);
400 const Operator* ShiftRight(BinaryOperationHints hints);
401 const Operator* ShiftRightLogical(BinaryOperationHints hints);
402 const Operator* Add(BinaryOperationHints hints);
403 const Operator* Subtract(BinaryOperationHints hints);
404 const Operator* Multiply(BinaryOperationHints hints);
405 const Operator* Divide(BinaryOperationHints hints);
406 const Operator* Modulus(BinaryOperationHints hints);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000407
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000408 const Operator* ToBoolean(ToBooleanHints hints);
Ben Murdochda12d292016-06-02 14:46:10 +0100409 const Operator* ToInteger();
410 const Operator* ToLength();
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400411 const Operator* ToName();
Ben Murdochda12d292016-06-02 14:46:10 +0100412 const Operator* ToNumber();
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400413 const Operator* ToObject();
Ben Murdochda12d292016-06-02 14:46:10 +0100414 const Operator* ToString();
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000415
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400416 const Operator* Create();
Ben Murdoch097c5b22016-05-18 11:27:45 +0100417 const Operator* CreateArguments(CreateArgumentsType type);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000418 const Operator* CreateArray(size_t arity, Handle<AllocationSite> site);
419 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info,
420 PretenureFlag pretenure);
421 const Operator* CreateIterResultObject();
422 const Operator* CreateLiteralArray(Handle<FixedArray> constant_elements,
Ben Murdochda12d292016-06-02 14:46:10 +0100423 int literal_flags, int literal_index,
424 int number_of_elements);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000425 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties,
Ben Murdochda12d292016-06-02 14:46:10 +0100426 int literal_flags, int literal_index,
427 int number_of_properties);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000428 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
429 int literal_flags, int literal_index);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000430
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000431 const Operator* CallFunction(
Ben Murdoch097c5b22016-05-18 11:27:45 +0100432 size_t arity, VectorSlotPair const& feedback = VectorSlotPair(),
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000433 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
434 TailCallMode tail_call_mode = TailCallMode::kDisallow);
Ben Murdoch097c5b22016-05-18 11:27:45 +0100435 const Operator* CallRuntime(Runtime::FunctionId id);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400436 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
Ben Murdoch097c5b22016-05-18 11:27:45 +0100437 const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000438 const Operator* CallConstruct(size_t arity, VectorSlotPair const& feedback);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000439
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000440 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000441
Ben Murdoch097c5b22016-05-18 11:27:45 +0100442 const Operator* LoadProperty(VectorSlotPair const& feedback);
443 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000444
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000445 const Operator* StoreProperty(LanguageMode language_mode,
446 VectorSlotPair const& feedback);
447 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
448 VectorSlotPair const& feedback);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000449
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000450 const Operator* DeleteProperty(LanguageMode language_mode);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000451
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400452 const Operator* HasProperty();
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000453
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000454 const Operator* LoadGlobal(const Handle<Name>& name,
455 const VectorSlotPair& feedback,
456 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
457 const Operator* StoreGlobal(LanguageMode language_mode,
458 const Handle<Name>& name,
459 const VectorSlotPair& feedback);
460
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400461 const Operator* LoadContext(size_t depth, size_t index, bool immutable);
462 const Operator* StoreContext(size_t depth, size_t index);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000463
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400464 const Operator* TypeOf();
465 const Operator* InstanceOf();
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000466
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000467 const Operator* ForInDone();
468 const Operator* ForInNext();
469 const Operator* ForInPrepare();
470 const Operator* ForInStep();
471
472 const Operator* LoadMessage();
473 const Operator* StoreMessage();
474
Ben Murdoch61f157c2016-09-16 13:49:30 +0100475 // Used to implement Ignition's SuspendGenerator bytecode.
476 const Operator* GeneratorStore(int register_count);
477
478 // Used to implement Ignition's ResumeGenerator bytecode.
479 const Operator* GeneratorRestoreContinuation();
480 const Operator* GeneratorRestoreRegister(int index);
481
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000482 const Operator* StackCheck();
483
484 const Operator* CreateFunctionContext(int slot_count);
485 const Operator* CreateCatchContext(const Handle<String>& name);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400486 const Operator* CreateWithContext();
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000487 const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400488 const Operator* CreateModuleContext();
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000489 const Operator* CreateScriptContext(const Handle<ScopeInfo>& scpope_info);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000490
491 private:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400492 Zone* zone() const { return zone_; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000493
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400494 const JSOperatorGlobalCache& cache_;
495 Zone* const zone_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000496
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400497 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000498};
499
500} // namespace compiler
501} // namespace internal
502} // namespace v8
503
504#endif // V8_COMPILER_JS_OPERATOR_H_