Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #include "src/compiler/js-operator.h"
6 :
7 : #include <limits>
8 :
9 : #include "src/base/lazy-instance.h"
10 : #include "src/compiler/opcodes.h"
11 : #include "src/compiler/operator.h"
12 : #include "src/feedback-vector.h"
13 : #include "src/handles-inl.h"
14 : #include "src/objects-inl.h"
15 :
16 : namespace v8 {
17 : namespace internal {
18 : namespace compiler {
19 :
20 0 : std::ostream& operator<<(std::ostream& os, CallFrequency f) {
21 0 : if (f.IsUnknown()) return os << "unknown";
22 0 : return os << f.value();
23 : }
24 :
25 1033 : CallFrequency CallFrequencyOf(Operator const* op) {
26 : DCHECK(op->opcode() == IrOpcode::kJSCallWithArrayLike ||
27 : op->opcode() == IrOpcode::kJSConstructWithArrayLike);
28 1033 : return OpParameter<CallFrequency>(op);
29 : }
30 :
31 53038 : VectorSlotPair::VectorSlotPair() {}
32 :
33 :
34 2457027 : int VectorSlotPair::index() const {
35 2457027 : return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
36 : }
37 :
38 :
39 0 : bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
40 0 : return lhs.slot() == rhs.slot() &&
41 0 : lhs.vector().location() == rhs.vector().location();
42 : }
43 :
44 :
45 0 : bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
46 0 : return !(lhs == rhs);
47 : }
48 :
49 :
50 0 : size_t hash_value(VectorSlotPair const& p) {
51 0 : return base::hash_combine(p.slot(), p.vector().location());
52 : }
53 :
54 :
55 128052 : ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) {
56 : DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode());
57 128052 : return OpParameter<ConvertReceiverMode>(op);
58 : }
59 :
60 :
61 0 : std::ostream& operator<<(std::ostream& os,
62 : ConstructForwardVarargsParameters const& p) {
63 0 : return os << p.arity() << ", " << p.start_index();
64 : }
65 :
66 474 : ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
67 : Operator const* op) {
68 : DCHECK_EQ(IrOpcode::kJSConstructForwardVarargs, op->opcode());
69 474 : return OpParameter<ConstructForwardVarargsParameters>(op);
70 : }
71 :
72 0 : bool operator==(ConstructParameters const& lhs,
73 0 : ConstructParameters const& rhs) {
74 0 : return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() &&
75 0 : lhs.feedback() == rhs.feedback();
76 : }
77 :
78 0 : bool operator!=(ConstructParameters const& lhs,
79 : ConstructParameters const& rhs) {
80 0 : return !(lhs == rhs);
81 : }
82 :
83 0 : size_t hash_value(ConstructParameters const& p) {
84 0 : return base::hash_combine(p.arity(), p.frequency(), p.feedback());
85 : }
86 :
87 0 : std::ostream& operator<<(std::ostream& os, ConstructParameters const& p) {
88 0 : return os << p.arity() << ", " << p.frequency();
89 : }
90 :
91 103090 : ConstructParameters const& ConstructParametersOf(Operator const* op) {
92 : DCHECK(op->opcode() == IrOpcode::kJSConstruct ||
93 : op->opcode() == IrOpcode::kJSConstructWithSpread);
94 103090 : return OpParameter<ConstructParameters>(op);
95 : }
96 :
97 0 : std::ostream& operator<<(std::ostream& os, CallParameters const& p) {
98 0 : return os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode();
99 : }
100 :
101 1733607 : const CallParameters& CallParametersOf(const Operator* op) {
102 : DCHECK(op->opcode() == IrOpcode::kJSCall ||
103 : op->opcode() == IrOpcode::kJSCallWithSpread);
104 1733607 : return OpParameter<CallParameters>(op);
105 : }
106 :
107 0 : std::ostream& operator<<(std::ostream& os,
108 : CallForwardVarargsParameters const& p) {
109 0 : return os << p.arity() << ", " << p.start_index();
110 : }
111 :
112 458 : CallForwardVarargsParameters const& CallForwardVarargsParametersOf(
113 : Operator const* op) {
114 : DCHECK_EQ(IrOpcode::kJSCallForwardVarargs, op->opcode());
115 458 : return OpParameter<CallForwardVarargsParameters>(op);
116 : }
117 :
118 :
119 0 : bool operator==(CallRuntimeParameters const& lhs,
120 0 : CallRuntimeParameters const& rhs) {
121 0 : return lhs.id() == rhs.id() && lhs.arity() == rhs.arity();
122 : }
123 :
124 :
125 0 : bool operator!=(CallRuntimeParameters const& lhs,
126 : CallRuntimeParameters const& rhs) {
127 0 : return !(lhs == rhs);
128 : }
129 :
130 :
131 0 : size_t hash_value(CallRuntimeParameters const& p) {
132 0 : return base::hash_combine(p.id(), p.arity());
133 : }
134 :
135 :
136 0 : std::ostream& operator<<(std::ostream& os, CallRuntimeParameters const& p) {
137 0 : return os << p.id() << ", " << p.arity();
138 : }
139 :
140 :
141 8936259 : const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op) {
142 : DCHECK_EQ(IrOpcode::kJSCallRuntime, op->opcode());
143 8936259 : return OpParameter<CallRuntimeParameters>(op);
144 : }
145 :
146 :
147 0 : ContextAccess::ContextAccess(size_t depth, size_t index, bool immutable)
148 : : immutable_(immutable),
149 : depth_(static_cast<uint16_t>(depth)),
150 1235675 : index_(static_cast<uint32_t>(index)) {
151 : DCHECK(depth <= std::numeric_limits<uint16_t>::max());
152 : DCHECK(index <= std::numeric_limits<uint32_t>::max());
153 0 : }
154 :
155 :
156 0 : bool operator==(ContextAccess const& lhs, ContextAccess const& rhs) {
157 0 : return lhs.depth() == rhs.depth() && lhs.index() == rhs.index() &&
158 0 : lhs.immutable() == rhs.immutable();
159 : }
160 :
161 :
162 0 : bool operator!=(ContextAccess const& lhs, ContextAccess const& rhs) {
163 0 : return !(lhs == rhs);
164 : }
165 :
166 :
167 0 : size_t hash_value(ContextAccess const& access) {
168 0 : return base::hash_combine(access.depth(), access.index(), access.immutable());
169 : }
170 :
171 :
172 0 : std::ostream& operator<<(std::ostream& os, ContextAccess const& access) {
173 0 : return os << access.depth() << ", " << access.index() << ", "
174 0 : << access.immutable();
175 : }
176 :
177 :
178 4539654 : ContextAccess const& ContextAccessOf(Operator const* op) {
179 : DCHECK(op->opcode() == IrOpcode::kJSLoadContext ||
180 : op->opcode() == IrOpcode::kJSStoreContext);
181 4539654 : return OpParameter<ContextAccess>(op);
182 : }
183 :
184 0 : CreateCatchContextParameters::CreateCatchContextParameters(
185 : Handle<String> catch_name, Handle<ScopeInfo> scope_info)
186 0 : : catch_name_(catch_name), scope_info_(scope_info) {}
187 :
188 0 : bool operator==(CreateCatchContextParameters const& lhs,
189 : CreateCatchContextParameters const& rhs) {
190 0 : return lhs.catch_name().location() == rhs.catch_name().location() &&
191 0 : lhs.scope_info().location() == rhs.scope_info().location();
192 : }
193 :
194 0 : bool operator!=(CreateCatchContextParameters const& lhs,
195 : CreateCatchContextParameters const& rhs) {
196 0 : return !(lhs == rhs);
197 : }
198 :
199 0 : size_t hash_value(CreateCatchContextParameters const& parameters) {
200 : return base::hash_combine(parameters.catch_name().location(),
201 0 : parameters.scope_info().location());
202 : }
203 :
204 0 : std::ostream& operator<<(std::ostream& os,
205 : CreateCatchContextParameters const& parameters) {
206 0 : return os << Brief(*parameters.catch_name()) << ", "
207 0 : << Brief(*parameters.scope_info());
208 : }
209 :
210 17904 : CreateCatchContextParameters const& CreateCatchContextParametersOf(
211 : Operator const* op) {
212 : DCHECK_EQ(IrOpcode::kJSCreateCatchContext, op->opcode());
213 17904 : return OpParameter<CreateCatchContextParameters>(op);
214 : }
215 :
216 0 : CreateFunctionContextParameters::CreateFunctionContextParameters(
217 : int slot_count, ScopeType scope_type)
218 0 : : slot_count_(slot_count), scope_type_(scope_type) {}
219 :
220 0 : bool operator==(CreateFunctionContextParameters const& lhs,
221 0 : CreateFunctionContextParameters const& rhs) {
222 0 : return lhs.slot_count() == rhs.slot_count() &&
223 0 : lhs.scope_type() == rhs.scope_type();
224 : }
225 :
226 0 : bool operator!=(CreateFunctionContextParameters const& lhs,
227 : CreateFunctionContextParameters const& rhs) {
228 0 : return !(lhs == rhs);
229 : }
230 :
231 0 : size_t hash_value(CreateFunctionContextParameters const& parameters) {
232 : return base::hash_combine(parameters.slot_count(),
233 0 : static_cast<int>(parameters.scope_type()));
234 : }
235 :
236 0 : std::ostream& operator<<(std::ostream& os,
237 0 : CreateFunctionContextParameters const& parameters) {
238 0 : return os << parameters.slot_count() << ", " << parameters.scope_type();
239 : }
240 :
241 32814 : CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
242 : Operator const* op) {
243 : DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, op->opcode());
244 32814 : return OpParameter<CreateFunctionContextParameters>(op);
245 : }
246 :
247 0 : bool operator==(StoreNamedOwnParameters const& lhs,
248 : StoreNamedOwnParameters const& rhs) {
249 0 : return lhs.name().location() == rhs.name().location() &&
250 0 : lhs.feedback() == rhs.feedback();
251 : }
252 :
253 0 : bool operator!=(StoreNamedOwnParameters const& lhs,
254 : StoreNamedOwnParameters const& rhs) {
255 0 : return !(lhs == rhs);
256 : }
257 :
258 0 : size_t hash_value(StoreNamedOwnParameters const& p) {
259 0 : return base::hash_combine(p.name().location(), p.feedback());
260 : }
261 :
262 0 : std::ostream& operator<<(std::ostream& os, StoreNamedOwnParameters const& p) {
263 0 : return os << Brief(*p.name());
264 : }
265 :
266 89713 : StoreNamedOwnParameters const& StoreNamedOwnParametersOf(const Operator* op) {
267 : DCHECK_EQ(IrOpcode::kJSStoreNamedOwn, op->opcode());
268 89713 : return OpParameter<StoreNamedOwnParameters>(op);
269 : }
270 :
271 0 : bool operator==(FeedbackParameter const& lhs, FeedbackParameter const& rhs) {
272 0 : return lhs.feedback() == rhs.feedback();
273 : }
274 :
275 0 : bool operator!=(FeedbackParameter const& lhs, FeedbackParameter const& rhs) {
276 0 : return !(lhs == rhs);
277 : }
278 :
279 0 : size_t hash_value(FeedbackParameter const& p) {
280 0 : return base::hash_combine(p.feedback());
281 : }
282 :
283 0 : std::ostream& operator<<(std::ostream& os, FeedbackParameter const& p) {
284 0 : return os;
285 : }
286 :
287 155915 : FeedbackParameter const& FeedbackParameterOf(const Operator* op) {
288 : DCHECK(op->opcode() == IrOpcode::kJSCreateEmptyLiteralArray ||
289 : op->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral);
290 155915 : return OpParameter<FeedbackParameter>(op);
291 : }
292 :
293 0 : bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
294 0 : return lhs.name().location() == rhs.name().location() &&
295 0 : lhs.language_mode() == rhs.language_mode() &&
296 0 : lhs.feedback() == rhs.feedback();
297 : }
298 :
299 :
300 0 : bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) {
301 0 : return !(lhs == rhs);
302 : }
303 :
304 :
305 0 : size_t hash_value(NamedAccess const& p) {
306 : return base::hash_combine(p.name().location(), p.language_mode(),
307 0 : p.feedback());
308 : }
309 :
310 :
311 0 : std::ostream& operator<<(std::ostream& os, NamedAccess const& p) {
312 0 : return os << Brief(*p.name()) << ", " << p.language_mode();
313 : }
314 :
315 :
316 2080422 : NamedAccess const& NamedAccessOf(const Operator* op) {
317 : DCHECK(op->opcode() == IrOpcode::kJSLoadNamed ||
318 : op->opcode() == IrOpcode::kJSStoreNamed);
319 2080422 : return OpParameter<NamedAccess>(op);
320 : }
321 :
322 :
323 0 : std::ostream& operator<<(std::ostream& os, PropertyAccess const& p) {
324 0 : return os << p.language_mode();
325 : }
326 :
327 :
328 0 : bool operator==(PropertyAccess const& lhs, PropertyAccess const& rhs) {
329 0 : return lhs.language_mode() == rhs.language_mode() &&
330 0 : lhs.feedback() == rhs.feedback();
331 : }
332 :
333 :
334 0 : bool operator!=(PropertyAccess const& lhs, PropertyAccess const& rhs) {
335 0 : return !(lhs == rhs);
336 : }
337 :
338 :
339 235555 : PropertyAccess const& PropertyAccessOf(const Operator* op) {
340 : DCHECK(op->opcode() == IrOpcode::kJSLoadProperty ||
341 : op->opcode() == IrOpcode::kJSStoreProperty);
342 235555 : return OpParameter<PropertyAccess>(op);
343 : }
344 :
345 :
346 0 : size_t hash_value(PropertyAccess const& p) {
347 0 : return base::hash_combine(p.language_mode(), p.feedback());
348 : }
349 :
350 :
351 0 : bool operator==(LoadGlobalParameters const& lhs,
352 0 : LoadGlobalParameters const& rhs) {
353 0 : return lhs.name().location() == rhs.name().location() &&
354 0 : lhs.feedback() == rhs.feedback() &&
355 0 : lhs.typeof_mode() == rhs.typeof_mode();
356 : }
357 :
358 :
359 0 : bool operator!=(LoadGlobalParameters const& lhs,
360 : LoadGlobalParameters const& rhs) {
361 0 : return !(lhs == rhs);
362 : }
363 :
364 :
365 0 : size_t hash_value(LoadGlobalParameters const& p) {
366 0 : return base::hash_combine(p.name().location(), p.typeof_mode());
367 : }
368 :
369 :
370 0 : std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) {
371 0 : return os << Brief(*p.name()) << ", " << p.typeof_mode();
372 : }
373 :
374 :
375 698146 : const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) {
376 : DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode());
377 698146 : return OpParameter<LoadGlobalParameters>(op);
378 : }
379 :
380 :
381 0 : bool operator==(StoreGlobalParameters const& lhs,
382 0 : StoreGlobalParameters const& rhs) {
383 0 : return lhs.language_mode() == rhs.language_mode() &&
384 0 : lhs.name().location() == rhs.name().location() &&
385 0 : lhs.feedback() == rhs.feedback();
386 : }
387 :
388 :
389 0 : bool operator!=(StoreGlobalParameters const& lhs,
390 : StoreGlobalParameters const& rhs) {
391 0 : return !(lhs == rhs);
392 : }
393 :
394 :
395 0 : size_t hash_value(StoreGlobalParameters const& p) {
396 : return base::hash_combine(p.language_mode(), p.name().location(),
397 0 : p.feedback());
398 : }
399 :
400 :
401 0 : std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) {
402 0 : return os << p.language_mode() << ", " << Brief(*p.name());
403 : }
404 :
405 :
406 335692 : const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) {
407 : DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
408 335692 : return OpParameter<StoreGlobalParameters>(op);
409 : }
410 :
411 :
412 37251 : CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op) {
413 : DCHECK_EQ(IrOpcode::kJSCreateArguments, op->opcode());
414 37251 : return OpParameter<CreateArgumentsType>(op);
415 : }
416 :
417 :
418 0 : bool operator==(CreateArrayParameters const& lhs,
419 0 : CreateArrayParameters const& rhs) {
420 0 : return lhs.arity() == rhs.arity() &&
421 0 : lhs.site().location() == rhs.site().location();
422 : }
423 :
424 :
425 0 : bool operator!=(CreateArrayParameters const& lhs,
426 : CreateArrayParameters const& rhs) {
427 0 : return !(lhs == rhs);
428 : }
429 :
430 :
431 0 : size_t hash_value(CreateArrayParameters const& p) {
432 0 : return base::hash_combine(p.arity(), p.site().location());
433 : }
434 :
435 :
436 0 : std::ostream& operator<<(std::ostream& os, CreateArrayParameters const& p) {
437 : os << p.arity();
438 0 : if (!p.site().is_null()) os << ", " << Brief(*p.site());
439 0 : return os;
440 : }
441 :
442 :
443 1270 : const CreateArrayParameters& CreateArrayParametersOf(const Operator* op) {
444 : DCHECK_EQ(IrOpcode::kJSCreateArray, op->opcode());
445 1270 : return OpParameter<CreateArrayParameters>(op);
446 : }
447 :
448 0 : bool operator==(CreateBoundFunctionParameters const& lhs,
449 0 : CreateBoundFunctionParameters const& rhs) {
450 0 : return lhs.arity() == rhs.arity() &&
451 0 : lhs.map().location() == rhs.map().location();
452 : }
453 :
454 0 : bool operator!=(CreateBoundFunctionParameters const& lhs,
455 : CreateBoundFunctionParameters const& rhs) {
456 0 : return !(lhs == rhs);
457 : }
458 :
459 0 : size_t hash_value(CreateBoundFunctionParameters const& p) {
460 0 : return base::hash_combine(p.arity(), p.map().location());
461 : }
462 :
463 0 : std::ostream& operator<<(std::ostream& os,
464 0 : CreateBoundFunctionParameters const& p) {
465 : os << p.arity();
466 0 : if (!p.map().is_null()) os << ", " << Brief(*p.map());
467 0 : return os;
468 : }
469 :
470 108 : const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf(
471 : const Operator* op) {
472 : DCHECK_EQ(IrOpcode::kJSCreateBoundFunction, op->opcode());
473 108 : return OpParameter<CreateBoundFunctionParameters>(op);
474 : }
475 :
476 0 : bool operator==(CreateClosureParameters const& lhs,
477 0 : CreateClosureParameters const& rhs) {
478 0 : return lhs.pretenure() == rhs.pretenure() &&
479 0 : lhs.feedback() == rhs.feedback() &&
480 0 : lhs.shared_info().location() == rhs.shared_info().location();
481 : }
482 :
483 :
484 0 : bool operator!=(CreateClosureParameters const& lhs,
485 : CreateClosureParameters const& rhs) {
486 0 : return !(lhs == rhs);
487 : }
488 :
489 :
490 0 : size_t hash_value(CreateClosureParameters const& p) {
491 : return base::hash_combine(p.pretenure(), p.shared_info().location(),
492 0 : p.feedback());
493 : }
494 :
495 :
496 0 : std::ostream& operator<<(std::ostream& os, CreateClosureParameters const& p) {
497 0 : return os << p.pretenure() << ", " << Brief(*p.shared_info());
498 : }
499 :
500 :
501 1203748 : const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) {
502 : DCHECK_EQ(IrOpcode::kJSCreateClosure, op->opcode());
503 1203748 : return OpParameter<CreateClosureParameters>(op);
504 : }
505 :
506 :
507 0 : bool operator==(CreateLiteralParameters const& lhs,
508 0 : CreateLiteralParameters const& rhs) {
509 0 : return lhs.constant().location() == rhs.constant().location() &&
510 0 : lhs.feedback() == rhs.feedback() && lhs.length() == rhs.length() &&
511 0 : lhs.flags() == rhs.flags();
512 : }
513 :
514 :
515 0 : bool operator!=(CreateLiteralParameters const& lhs,
516 : CreateLiteralParameters const& rhs) {
517 0 : return !(lhs == rhs);
518 : }
519 :
520 :
521 0 : size_t hash_value(CreateLiteralParameters const& p) {
522 0 : return base::hash_combine(p.constant().location(), p.feedback(), p.length(),
523 0 : p.flags());
524 : }
525 :
526 :
527 0 : std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) {
528 0 : return os << Brief(*p.constant()) << ", " << p.length() << ", " << p.flags();
529 : }
530 :
531 :
532 140288 : const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) {
533 : DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray ||
534 : op->opcode() == IrOpcode::kJSCreateLiteralObject ||
535 : op->opcode() == IrOpcode::kJSCreateLiteralRegExp);
536 140288 : return OpParameter<CreateLiteralParameters>(op);
537 : }
538 :
539 0 : size_t hash_value(ForInMode mode) { return static_cast<uint8_t>(mode); }
540 :
541 0 : std::ostream& operator<<(std::ostream& os, ForInMode mode) {
542 0 : switch (mode) {
543 : case ForInMode::kUseEnumCacheKeysAndIndices:
544 0 : return os << "UseEnumCacheKeysAndIndices";
545 : case ForInMode::kUseEnumCacheKeys:
546 0 : return os << "UseEnumCacheKeys";
547 : case ForInMode::kGeneric:
548 0 : return os << "Generic";
549 : }
550 0 : UNREACHABLE();
551 : }
552 :
553 4986 : ForInMode ForInModeOf(Operator const* op) {
554 : DCHECK(op->opcode() == IrOpcode::kJSForInNext ||
555 : op->opcode() == IrOpcode::kJSForInPrepare);
556 4986 : return OpParameter<ForInMode>(op);
557 : }
558 :
559 78528 : BinaryOperationHint BinaryOperationHintOf(const Operator* op) {
560 : DCHECK_EQ(IrOpcode::kJSAdd, op->opcode());
561 78528 : return OpParameter<BinaryOperationHint>(op);
562 : }
563 :
564 559784 : CompareOperationHint CompareOperationHintOf(const Operator* op) {
565 : DCHECK(op->opcode() == IrOpcode::kJSEqual ||
566 : op->opcode() == IrOpcode::kJSStrictEqual ||
567 : op->opcode() == IrOpcode::kJSLessThan ||
568 : op->opcode() == IrOpcode::kJSGreaterThan ||
569 : op->opcode() == IrOpcode::kJSLessThanOrEqual ||
570 : op->opcode() == IrOpcode::kJSGreaterThanOrEqual);
571 559784 : return OpParameter<CompareOperationHint>(op);
572 : }
573 :
574 : #define CACHED_OP_LIST(V) \
575 : V(BitwiseOr, Operator::kNoProperties, 2, 1) \
576 : V(BitwiseXor, Operator::kNoProperties, 2, 1) \
577 : V(BitwiseAnd, Operator::kNoProperties, 2, 1) \
578 : V(ShiftLeft, Operator::kNoProperties, 2, 1) \
579 : V(ShiftRight, Operator::kNoProperties, 2, 1) \
580 : V(ShiftRightLogical, Operator::kNoProperties, 2, 1) \
581 : V(Subtract, Operator::kNoProperties, 2, 1) \
582 : V(Multiply, Operator::kNoProperties, 2, 1) \
583 : V(Divide, Operator::kNoProperties, 2, 1) \
584 : V(Modulus, Operator::kNoProperties, 2, 1) \
585 : V(ToInteger, Operator::kNoProperties, 1, 1) \
586 : V(ToLength, Operator::kNoProperties, 1, 1) \
587 : V(ToName, Operator::kNoProperties, 1, 1) \
588 : V(ToNumber, Operator::kNoProperties, 1, 1) \
589 : V(ToObject, Operator::kFoldable, 1, 1) \
590 : V(ToString, Operator::kNoProperties, 1, 1) \
591 : V(Create, Operator::kNoProperties, 2, 1) \
592 : V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \
593 : V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \
594 : V(HasProperty, Operator::kNoProperties, 2, 1) \
595 : V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \
596 : V(InstanceOf, Operator::kNoProperties, 2, 1) \
597 : V(OrdinaryHasInstance, Operator::kNoProperties, 2, 1) \
598 : V(ForInEnumerate, Operator::kNoProperties, 1, 1) \
599 : V(LoadMessage, Operator::kNoThrow | Operator::kNoWrite, 0, 1) \
600 : V(StoreMessage, Operator::kNoRead | Operator::kNoThrow, 1, 0) \
601 : V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \
602 : V(StackCheck, Operator::kNoWrite, 0, 0) \
603 : V(Debugger, Operator::kNoProperties, 0, 0) \
604 : V(GetSuperConstructor, Operator::kNoWrite, 1, 1)
605 :
606 : #define BINARY_OP_LIST(V) V(Add)
607 :
608 : #define COMPARE_OP_LIST(V) \
609 : V(Equal, Operator::kNoProperties) \
610 : V(StrictEqual, Operator::kPure) \
611 : V(LessThan, Operator::kNoProperties) \
612 : V(GreaterThan, Operator::kNoProperties) \
613 : V(LessThanOrEqual, Operator::kNoProperties) \
614 : V(GreaterThanOrEqual, Operator::kNoProperties)
615 :
616 15616 : struct JSOperatorGlobalCache final {
617 : #define CACHED_OP(Name, properties, value_input_count, value_output_count) \
618 : struct Name##Operator final : public Operator { \
619 : Name##Operator() \
620 : : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \
621 : value_input_count, Operator::ZeroIfPure(properties), \
622 : Operator::ZeroIfEliminatable(properties), \
623 : value_output_count, Operator::ZeroIfPure(properties), \
624 : Operator::ZeroIfNoThrow(properties)) {} \
625 : }; \
626 : Name##Operator k##Name##Operator;
627 905728 : CACHED_OP_LIST(CACHED_OP)
628 : #undef CACHED_OP
629 :
630 : #define BINARY_OP(Name) \
631 : template <BinaryOperationHint kHint> \
632 : struct Name##Operator final : public Operator1<BinaryOperationHint> { \
633 : Name##Operator() \
634 : : Operator1<BinaryOperationHint>(IrOpcode::kJS##Name, \
635 : Operator::kNoProperties, "JS" #Name, \
636 : 2, 1, 1, 1, 1, 2, kHint) {} \
637 : }; \
638 : Name##Operator<BinaryOperationHint::kNone> k##Name##NoneOperator; \
639 : Name##Operator<BinaryOperationHint::kSignedSmall> \
640 : k##Name##SignedSmallOperator; \
641 : Name##Operator<BinaryOperationHint::kSignedSmallInputs> \
642 : k##Name##SignedSmallInputsOperator; \
643 : Name##Operator<BinaryOperationHint::kSigned32> k##Name##Signed32Operator; \
644 : Name##Operator<BinaryOperationHint::kNumber> k##Name##NumberOperator; \
645 : Name##Operator<BinaryOperationHint::kNumberOrOddball> \
646 : k##Name##NumberOrOddballOperator; \
647 : Name##Operator<BinaryOperationHint::kString> k##Name##StringOperator; \
648 : Name##Operator<BinaryOperationHint::kAny> k##Name##AnyOperator;
649 249856 : BINARY_OP_LIST(BINARY_OP)
650 : #undef BINARY_OP
651 :
652 : #define COMPARE_OP(Name, properties) \
653 : template <CompareOperationHint kHint> \
654 : struct Name##Operator final : public Operator1<CompareOperationHint> { \
655 : Name##Operator() \
656 : : Operator1<CompareOperationHint>( \
657 : IrOpcode::kJS##Name, properties, "JS" #Name, 2, 1, 1, 1, 1, \
658 : Operator::ZeroIfNoThrow(properties), kHint) {} \
659 : }; \
660 : Name##Operator<CompareOperationHint::kNone> k##Name##NoneOperator; \
661 : Name##Operator<CompareOperationHint::kSignedSmall> \
662 : k##Name##SignedSmallOperator; \
663 : Name##Operator<CompareOperationHint::kNumber> k##Name##NumberOperator; \
664 : Name##Operator<CompareOperationHint::kNumberOrOddball> \
665 : k##Name##NumberOrOddballOperator; \
666 : Name##Operator<CompareOperationHint::kInternalizedString> \
667 : k##Name##InternalizedStringOperator; \
668 : Name##Operator<CompareOperationHint::kString> k##Name##StringOperator; \
669 : Name##Operator<CompareOperationHint::kSymbol> k##Name##SymbolOperator; \
670 : Name##Operator<CompareOperationHint::kReceiver> k##Name##ReceiverOperator; \
671 : Name##Operator<CompareOperationHint::kAny> k##Name##AnyOperator;
672 1686528 : COMPARE_OP_LIST(COMPARE_OP)
673 : #undef COMPARE_OP
674 : };
675 :
676 : static base::LazyInstance<JSOperatorGlobalCache>::type kJSOperatorGlobalCache =
677 : LAZY_INSTANCE_INITIALIZER;
678 :
679 613590 : JSOperatorBuilder::JSOperatorBuilder(Zone* zone)
680 613590 : : cache_(kJSOperatorGlobalCache.Get()), zone_(zone) {}
681 :
682 : #define CACHED_OP(Name, properties, value_input_count, value_output_count) \
683 : const Operator* JSOperatorBuilder::Name() { \
684 : return &cache_.k##Name##Operator; \
685 : }
686 792141 : CACHED_OP_LIST(CACHED_OP)
687 : #undef CACHED_OP
688 :
689 : #define BINARY_OP(Name) \
690 : const Operator* JSOperatorBuilder::Name(BinaryOperationHint hint) { \
691 : switch (hint) { \
692 : case BinaryOperationHint::kNone: \
693 : return &cache_.k##Name##NoneOperator; \
694 : case BinaryOperationHint::kSignedSmall: \
695 : return &cache_.k##Name##SignedSmallOperator; \
696 : case BinaryOperationHint::kSignedSmallInputs: \
697 : return &cache_.k##Name##SignedSmallInputsOperator; \
698 : case BinaryOperationHint::kSigned32: \
699 : return &cache_.k##Name##Signed32Operator; \
700 : case BinaryOperationHint::kNumber: \
701 : return &cache_.k##Name##NumberOperator; \
702 : case BinaryOperationHint::kNumberOrOddball: \
703 : return &cache_.k##Name##NumberOrOddballOperator; \
704 : case BinaryOperationHint::kString: \
705 : return &cache_.k##Name##StringOperator; \
706 : case BinaryOperationHint::kAny: \
707 : return &cache_.k##Name##AnyOperator; \
708 : } \
709 : UNREACHABLE(); \
710 : return nullptr; \
711 : }
712 244025 : BINARY_OP_LIST(BINARY_OP)
713 : #undef BINARY_OP
714 :
715 : #define COMPARE_OP(Name, ...) \
716 : const Operator* JSOperatorBuilder::Name(CompareOperationHint hint) { \
717 : switch (hint) { \
718 : case CompareOperationHint::kNone: \
719 : return &cache_.k##Name##NoneOperator; \
720 : case CompareOperationHint::kSignedSmall: \
721 : return &cache_.k##Name##SignedSmallOperator; \
722 : case CompareOperationHint::kNumber: \
723 : return &cache_.k##Name##NumberOperator; \
724 : case CompareOperationHint::kNumberOrOddball: \
725 : return &cache_.k##Name##NumberOrOddballOperator; \
726 : case CompareOperationHint::kInternalizedString: \
727 : return &cache_.k##Name##InternalizedStringOperator; \
728 : case CompareOperationHint::kString: \
729 : return &cache_.k##Name##StringOperator; \
730 : case CompareOperationHint::kSymbol: \
731 : return &cache_.k##Name##SymbolOperator; \
732 : case CompareOperationHint::kReceiver: \
733 : return &cache_.k##Name##ReceiverOperator; \
734 : case CompareOperationHint::kAny: \
735 : return &cache_.k##Name##AnyOperator; \
736 : } \
737 : UNREACHABLE(); \
738 : return nullptr; \
739 : }
740 293061 : COMPARE_OP_LIST(COMPARE_OP)
741 : #undef COMPARE_OP
742 :
743 55213 : const Operator* JSOperatorBuilder::StoreDataPropertyInLiteral(
744 55213 : const VectorSlotPair& feedback) {
745 : FeedbackParameter parameters(feedback);
746 : return new (zone()) Operator1<FeedbackParameter>( // --
747 : IrOpcode::kJSStoreDataPropertyInLiteral,
748 : Operator::kNoThrow, // opcode
749 : "JSStoreDataPropertyInLiteral", // name
750 : 4, 1, 1, 0, 1, 0, // counts
751 55213 : parameters); // parameter
752 : }
753 :
754 384 : const Operator* JSOperatorBuilder::CallForwardVarargs(size_t arity,
755 384 : uint32_t start_index) {
756 : CallForwardVarargsParameters parameters(arity, start_index);
757 : return new (zone()) Operator1<CallForwardVarargsParameters>( // --
758 : IrOpcode::kJSCallForwardVarargs, Operator::kNoProperties, // opcode
759 : "JSCallForwardVarargs", // name
760 : parameters.arity(), 1, 1, 1, 1, 2, // counts
761 384 : parameters); // parameter
762 : }
763 :
764 607376 : const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency,
765 : VectorSlotPair const& feedback,
766 607376 : ConvertReceiverMode convert_mode) {
767 : CallParameters parameters(arity, frequency, feedback, convert_mode);
768 : return new (zone()) Operator1<CallParameters>( // --
769 : IrOpcode::kJSCall, Operator::kNoProperties, // opcode
770 : "JSCall", // name
771 : parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs
772 607378 : parameters); // parameter
773 : }
774 :
775 1410 : const Operator* JSOperatorBuilder::CallWithArrayLike(CallFrequency frequency) {
776 : return new (zone()) Operator1<CallFrequency>( // --
777 : IrOpcode::kJSCallWithArrayLike, Operator::kNoProperties, // opcode
778 : "JSCallWithArrayLike", // name
779 : 3, 1, 1, 1, 1, 2, // counts
780 1410 : frequency); // parameter
781 : }
782 :
783 1039 : const Operator* JSOperatorBuilder::CallWithSpread(
784 1039 : uint32_t arity, CallFrequency frequency, VectorSlotPair const& feedback) {
785 : CallParameters parameters(arity, frequency, feedback,
786 : ConvertReceiverMode::kAny);
787 : return new (zone()) Operator1<CallParameters>( // --
788 : IrOpcode::kJSCallWithSpread, Operator::kNoProperties, // opcode
789 : "JSCallWithSpread", // name
790 : parameters.arity(), 1, 1, 1, 1, 2, // counts
791 1039 : parameters); // parameter
792 : }
793 :
794 157570 : const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) {
795 157570 : const Runtime::Function* f = Runtime::FunctionForId(id);
796 157570 : return CallRuntime(f, f->nargs);
797 : }
798 :
799 :
800 168751 : const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id,
801 : size_t arity) {
802 168751 : const Runtime::Function* f = Runtime::FunctionForId(id);
803 168751 : return CallRuntime(f, arity);
804 : }
805 :
806 :
807 326321 : const Operator* JSOperatorBuilder::CallRuntime(const Runtime::Function* f,
808 326321 : size_t arity) {
809 326321 : CallRuntimeParameters parameters(f->function_id, arity);
810 : DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity()));
811 : return new (zone()) Operator1<CallRuntimeParameters>( // --
812 : IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode
813 : "JSCallRuntime", // name
814 : parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs
815 652642 : parameters); // parameter
816 : }
817 :
818 453 : const Operator* JSOperatorBuilder::ConstructForwardVarargs(
819 453 : size_t arity, uint32_t start_index) {
820 : ConstructForwardVarargsParameters parameters(arity, start_index);
821 : return new (zone()) Operator1<ConstructForwardVarargsParameters>( // --
822 : IrOpcode::kJSConstructForwardVarargs, Operator::kNoProperties, // opcode
823 : "JSConstructForwardVarargs", // name
824 : parameters.arity(), 1, 1, 1, 1, 2, // counts
825 453 : parameters); // parameter
826 : }
827 :
828 38152 : const Operator* JSOperatorBuilder::Construct(uint32_t arity,
829 : CallFrequency frequency,
830 38152 : VectorSlotPair const& feedback) {
831 : ConstructParameters parameters(arity, frequency, feedback);
832 : return new (zone()) Operator1<ConstructParameters>( // --
833 : IrOpcode::kJSConstruct, Operator::kNoProperties, // opcode
834 : "JSConstruct", // name
835 : parameters.arity(), 1, 1, 1, 1, 2, // counts
836 76304 : parameters); // parameter
837 : }
838 :
839 211 : const Operator* JSOperatorBuilder::ConstructWithArrayLike(
840 211 : CallFrequency frequency) {
841 : return new (zone()) Operator1<CallFrequency>( // --
842 : IrOpcode::kJSConstructWithArrayLike, // opcode
843 : Operator::kNoProperties, // properties
844 : "JSConstructWithArrayLike", // name
845 : 3, 1, 1, 1, 1, 2, // counts
846 422 : frequency); // parameter
847 : }
848 :
849 580 : const Operator* JSOperatorBuilder::ConstructWithSpread(
850 580 : uint32_t arity, CallFrequency frequency, VectorSlotPair const& feedback) {
851 : ConstructParameters parameters(arity, frequency, feedback);
852 : return new (zone()) Operator1<ConstructParameters>( // --
853 : IrOpcode::kJSConstructWithSpread, Operator::kNoProperties, // opcode
854 : "JSConstructWithSpread", // name
855 : parameters.arity(), 1, 1, 1, 1, 2, // counts
856 1160 : parameters); // parameter
857 : }
858 :
859 128478 : const Operator* JSOperatorBuilder::ConvertReceiver(
860 128478 : ConvertReceiverMode convert_mode) {
861 : return new (zone()) Operator1<ConvertReceiverMode>( // --
862 : IrOpcode::kJSConvertReceiver, Operator::kEliminatable, // opcode
863 : "JSConvertReceiver", // name
864 : 1, 1, 1, 1, 1, 0, // counts
865 128478 : convert_mode); // parameter
866 : }
867 :
868 598906 : const Operator* JSOperatorBuilder::LoadNamed(Handle<Name> name,
869 598906 : const VectorSlotPair& feedback) {
870 : NamedAccess access(LanguageMode::kSloppy, name, feedback);
871 : return new (zone()) Operator1<NamedAccess>( // --
872 : IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
873 : "JSLoadNamed", // name
874 : 1, 1, 1, 1, 1, 2, // counts
875 598906 : access); // parameter
876 : }
877 :
878 55016 : const Operator* JSOperatorBuilder::LoadProperty(
879 55016 : VectorSlotPair const& feedback) {
880 : PropertyAccess access(LanguageMode::kSloppy, feedback);
881 : return new (zone()) Operator1<PropertyAccess>( // --
882 : IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
883 : "JSLoadProperty", // name
884 : 2, 1, 1, 1, 1, 2, // counts
885 55016 : access); // parameter
886 : }
887 :
888 1703 : const Operator* JSOperatorBuilder::ForInNext(ForInMode mode) {
889 : return new (zone()) Operator1<ForInMode>( // --
890 : IrOpcode::kJSForInNext, Operator::kNoProperties, // opcode
891 : "JSForInNext", // name
892 : 4, 1, 1, 1, 1, 2, // counts
893 1703 : mode); // parameter
894 : }
895 :
896 1519 : const Operator* JSOperatorBuilder::ForInPrepare(ForInMode mode) {
897 : return new (zone()) Operator1<ForInMode>( // --
898 : IrOpcode::kJSForInPrepare, // opcode
899 : Operator::kNoWrite | Operator::kNoThrow, // flags
900 : "JSForInPrepare", // name
901 : 1, 1, 1, 3, 1, 1, // counts
902 1519 : mode); // parameter
903 : }
904 :
905 5072 : const Operator* JSOperatorBuilder::GeneratorStore(int register_count) {
906 : return new (zone()) Operator1<int>( // --
907 : IrOpcode::kJSGeneratorStore, Operator::kNoThrow, // opcode
908 : "JSGeneratorStore", // name
909 5072 : 3 + register_count, 1, 1, 0, 1, 0, // counts
910 10144 : register_count); // parameter
911 : }
912 :
913 36297 : const Operator* JSOperatorBuilder::GeneratorRestoreRegister(int index) {
914 : return new (zone()) Operator1<int>( // --
915 : IrOpcode::kJSGeneratorRestoreRegister, Operator::kNoThrow, // opcode
916 : "JSGeneratorRestoreRegister", // name
917 : 1, 1, 1, 1, 1, 0, // counts
918 36297 : index); // parameter
919 : }
920 :
921 266376 : const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
922 : Handle<Name> name,
923 266376 : VectorSlotPair const& feedback) {
924 : NamedAccess access(language_mode, name, feedback);
925 : return new (zone()) Operator1<NamedAccess>( // --
926 : IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode
927 : "JSStoreNamed", // name
928 : 2, 1, 1, 0, 1, 2, // counts
929 266376 : access); // parameter
930 : }
931 :
932 :
933 63175 : const Operator* JSOperatorBuilder::StoreProperty(
934 63175 : LanguageMode language_mode, VectorSlotPair const& feedback) {
935 : PropertyAccess access(language_mode, feedback);
936 : return new (zone()) Operator1<PropertyAccess>( // --
937 : IrOpcode::kJSStoreProperty, Operator::kNoProperties, // opcode
938 : "JSStoreProperty", // name
939 : 3, 1, 1, 0, 1, 2, // counts
940 63175 : access); // parameter
941 : }
942 :
943 44348 : const Operator* JSOperatorBuilder::StoreNamedOwn(
944 44348 : Handle<Name> name, VectorSlotPair const& feedback) {
945 : StoreNamedOwnParameters parameters(name, feedback);
946 : return new (zone()) Operator1<StoreNamedOwnParameters>( // --
947 : IrOpcode::kJSStoreNamedOwn, Operator::kNoProperties, // opcode
948 : "JSStoreNamedOwn", // name
949 : 2, 1, 1, 0, 1, 2, // counts
950 44348 : parameters); // parameter
951 : }
952 :
953 3092 : const Operator* JSOperatorBuilder::DeleteProperty() {
954 : return new (zone()) Operator( // --
955 : IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode
956 : "JSDeleteProperty", // name
957 1546 : 3, 1, 1, 1, 1, 2); // counts
958 : }
959 :
960 3174 : const Operator* JSOperatorBuilder::CreateGeneratorObject() {
961 : return new (zone()) Operator( // --
962 : IrOpcode::kJSCreateGeneratorObject, Operator::kEliminatable, // opcode
963 : "JSCreateGeneratorObject", // name
964 1587 : 2, 1, 1, 1, 1, 0); // counts
965 : }
966 :
967 602021 : const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name,
968 : const VectorSlotPair& feedback,
969 602021 : TypeofMode typeof_mode) {
970 : LoadGlobalParameters parameters(name, feedback, typeof_mode);
971 : return new (zone()) Operator1<LoadGlobalParameters>( // --
972 : IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
973 : "JSLoadGlobal", // name
974 : 0, 1, 1, 1, 1, 2, // counts
975 602021 : parameters); // parameter
976 : }
977 :
978 :
979 184971 : const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
980 : const Handle<Name>& name,
981 184971 : const VectorSlotPair& feedback) {
982 : StoreGlobalParameters parameters(language_mode, feedback, name);
983 : return new (zone()) Operator1<StoreGlobalParameters>( // --
984 : IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode
985 : "JSStoreGlobal", // name
986 : 1, 1, 1, 0, 1, 2, // counts
987 184971 : parameters); // parameter
988 : }
989 :
990 :
991 887275 : const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index,
992 887275 : bool immutable) {
993 : ContextAccess access(depth, index, immutable);
994 : return new (zone()) Operator1<ContextAccess>( // --
995 : IrOpcode::kJSLoadContext, // opcode
996 : Operator::kNoWrite | Operator::kNoThrow, // flags
997 : "JSLoadContext", // name
998 : 0, 1, 0, 1, 1, 0, // counts
999 887275 : access); // parameter
1000 : }
1001 :
1002 :
1003 696800 : const Operator* JSOperatorBuilder::StoreContext(size_t depth, size_t index) {
1004 : ContextAccess access(depth, index, false);
1005 : return new (zone()) Operator1<ContextAccess>( // --
1006 : IrOpcode::kJSStoreContext, // opcode
1007 : Operator::kNoRead | Operator::kNoThrow, // flags
1008 : "JSStoreContext", // name
1009 : 1, 1, 1, 0, 1, 0, // counts
1010 348400 : access); // parameter
1011 : }
1012 :
1013 280 : const Operator* JSOperatorBuilder::LoadModule(int32_t cell_index) {
1014 : return new (zone()) Operator1<int32_t>( // --
1015 : IrOpcode::kJSLoadModule, // opcode
1016 : Operator::kNoWrite | Operator::kNoThrow, // flags
1017 : "JSLoadModule", // name
1018 : 1, 1, 1, 1, 1, 0, // counts
1019 280 : cell_index); // parameter
1020 : }
1021 :
1022 6883 : const Operator* JSOperatorBuilder::StoreModule(int32_t cell_index) {
1023 : return new (zone()) Operator1<int32_t>( // --
1024 : IrOpcode::kJSStoreModule, // opcode
1025 : Operator::kNoRead | Operator::kNoThrow, // flags
1026 : "JSStoreModule", // name
1027 : 2, 1, 1, 0, 1, 0, // counts
1028 6883 : cell_index); // parameter
1029 : }
1030 :
1031 17954 : const Operator* JSOperatorBuilder::CreateArguments(CreateArgumentsType type) {
1032 : return new (zone()) Operator1<CreateArgumentsType>( // --
1033 : IrOpcode::kJSCreateArguments, Operator::kEliminatable, // opcode
1034 : "JSCreateArguments", // name
1035 : 1, 1, 0, 1, 1, 0, // counts
1036 17954 : type); // parameter
1037 : }
1038 :
1039 1153 : const Operator* JSOperatorBuilder::CreateArray(size_t arity,
1040 1153 : Handle<AllocationSite> site) {
1041 : // constructor, new_target, arg1, ..., argN
1042 1153 : int const value_input_count = static_cast<int>(arity) + 2;
1043 : CreateArrayParameters parameters(arity, site);
1044 : return new (zone()) Operator1<CreateArrayParameters>( // --
1045 : IrOpcode::kJSCreateArray, Operator::kNoProperties, // opcode
1046 : "JSCreateArray", // name
1047 : value_input_count, 1, 1, 1, 1, 2, // counts
1048 2306 : parameters); // parameter
1049 : }
1050 :
1051 94 : const Operator* JSOperatorBuilder::CreateBoundFunction(size_t arity,
1052 94 : Handle<Map> map) {
1053 : // bound_target_function, bound_this, arg1, ..., argN
1054 94 : int const value_input_count = static_cast<int>(arity) + 2;
1055 : CreateBoundFunctionParameters parameters(arity, map);
1056 : return new (zone()) Operator1<CreateBoundFunctionParameters>( // --
1057 : IrOpcode::kJSCreateBoundFunction, Operator::kEliminatable, // opcode
1058 : "JSCreateBoundFunction", // name
1059 : value_input_count, 1, 1, 1, 1, 0, // counts
1060 188 : parameters); // parameter
1061 : }
1062 :
1063 585505 : const Operator* JSOperatorBuilder::CreateClosure(
1064 : Handle<SharedFunctionInfo> shared_info, VectorSlotPair const& feedback,
1065 585505 : PretenureFlag pretenure) {
1066 : CreateClosureParameters parameters(shared_info, feedback, pretenure);
1067 : return new (zone()) Operator1<CreateClosureParameters>( // --
1068 : IrOpcode::kJSCreateClosure, Operator::kEliminatable, // opcode
1069 : "JSCreateClosure", // name
1070 : 0, 1, 1, 1, 1, 0, // counts
1071 585506 : parameters); // parameter
1072 : }
1073 :
1074 20526 : const Operator* JSOperatorBuilder::CreateLiteralArray(
1075 : Handle<ConstantElementsPair> constant_elements,
1076 20526 : VectorSlotPair const& feedback, int literal_flags, int number_of_elements) {
1077 : CreateLiteralParameters parameters(constant_elements, feedback,
1078 : number_of_elements, literal_flags);
1079 : return new (zone()) Operator1<CreateLiteralParameters>( // --
1080 : IrOpcode::kJSCreateLiteralArray, // opcode
1081 : Operator::kNoProperties, // properties
1082 : "JSCreateLiteralArray", // name
1083 : 0, 1, 1, 1, 1, 2, // counts
1084 20526 : parameters); // parameter
1085 : }
1086 :
1087 23220 : const Operator* JSOperatorBuilder::CreateEmptyLiteralArray(
1088 23220 : VectorSlotPair const& feedback) {
1089 : FeedbackParameter parameters(feedback);
1090 : return new (zone()) Operator1<FeedbackParameter>( // --
1091 : IrOpcode::kJSCreateEmptyLiteralArray, // opcode
1092 : Operator::kEliminatable, // properties
1093 : "JSCreateEmptyLiteralArray", // name
1094 : 0, 1, 1, 1, 1, 0, // counts
1095 23220 : parameters); // parameter
1096 : }
1097 :
1098 41177 : const Operator* JSOperatorBuilder::CreateLiteralObject(
1099 : Handle<BoilerplateDescription> constant_properties,
1100 : VectorSlotPair const& feedback, int literal_flags,
1101 41177 : int number_of_properties) {
1102 : CreateLiteralParameters parameters(constant_properties, feedback,
1103 : number_of_properties, literal_flags);
1104 : return new (zone()) Operator1<CreateLiteralParameters>( // --
1105 : IrOpcode::kJSCreateLiteralObject, // opcode
1106 : Operator::kNoProperties, // properties
1107 : "JSCreateLiteralObject", // name
1108 : 0, 1, 1, 1, 1, 2, // counts
1109 41177 : parameters); // parameter
1110 : }
1111 :
1112 13776 : const Operator* JSOperatorBuilder::CreateEmptyLiteralObject() {
1113 : return new (zone()) Operator( // --
1114 : IrOpcode::kJSCreateEmptyLiteralObject, // opcode
1115 : Operator::kNoProperties, // properties
1116 : "JSCreateEmptyLiteralObject", // name
1117 6888 : 1, 1, 1, 1, 1, 2); // counts
1118 : }
1119 :
1120 10170 : const Operator* JSOperatorBuilder::CreateLiteralRegExp(
1121 : Handle<String> constant_pattern, VectorSlotPair const& feedback,
1122 10170 : int literal_flags) {
1123 : CreateLiteralParameters parameters(constant_pattern, feedback, -1,
1124 : literal_flags);
1125 : return new (zone()) Operator1<CreateLiteralParameters>( // --
1126 : IrOpcode::kJSCreateLiteralRegExp, // opcode
1127 : Operator::kNoProperties, // properties
1128 : "JSCreateLiteralRegExp", // name
1129 : 0, 1, 1, 1, 1, 2, // counts
1130 10170 : parameters); // parameter
1131 : }
1132 :
1133 27367 : const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count,
1134 27367 : ScopeType scope_type) {
1135 : CreateFunctionContextParameters parameters(slot_count, scope_type);
1136 : return new (zone()) Operator1<CreateFunctionContextParameters>( // --
1137 : IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode
1138 : "JSCreateFunctionContext", // name
1139 : 1, 1, 1, 1, 1, 2, // counts
1140 27367 : parameters); // parameter
1141 : }
1142 :
1143 18668 : const Operator* JSOperatorBuilder::CreateCatchContext(
1144 18668 : const Handle<String>& name, const Handle<ScopeInfo>& scope_info) {
1145 : CreateCatchContextParameters parameters(name, scope_info);
1146 : return new (zone()) Operator1<CreateCatchContextParameters>(
1147 : IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
1148 : "JSCreateCatchContext", // name
1149 : 2, 1, 1, 1, 1, 2, // counts
1150 18668 : parameters); // parameter
1151 : }
1152 :
1153 494 : const Operator* JSOperatorBuilder::CreateWithContext(
1154 494 : const Handle<ScopeInfo>& scope_info) {
1155 : return new (zone()) Operator1<Handle<ScopeInfo>>(
1156 : IrOpcode::kJSCreateWithContext, Operator::kNoProperties, // opcode
1157 : "JSCreateWithContext", // name
1158 : 2, 1, 1, 1, 1, 2, // counts
1159 988 : scope_info); // parameter
1160 : }
1161 :
1162 8881 : const Operator* JSOperatorBuilder::CreateBlockContext(
1163 8881 : const Handle<ScopeInfo>& scope_info) {
1164 : return new (zone()) Operator1<Handle<ScopeInfo>>( // --
1165 : IrOpcode::kJSCreateBlockContext, Operator::kNoProperties, // opcode
1166 : "JSCreateBlockContext", // name
1167 : 1, 1, 1, 1, 1, 2, // counts
1168 17762 : scope_info); // parameter
1169 : }
1170 :
1171 0 : const Operator* JSOperatorBuilder::CreateScriptContext(
1172 0 : const Handle<ScopeInfo>& scope_info) {
1173 : return new (zone()) Operator1<Handle<ScopeInfo>>( // --
1174 : IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode
1175 : "JSCreateScriptContext", // name
1176 : 1, 1, 1, 1, 1, 2, // counts
1177 0 : scope_info); // parameter
1178 : }
1179 :
1180 : } // namespace compiler
1181 : } // namespace internal
1182 : } // namespace v8
|