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

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

Issue 2373983004: [turbofan] inline %StringIteratorPrototype%.next in JSBuiltinReducer. (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/compiler/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/compiler/types.h" 10 #include "src/compiler/types.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 op->opcode() == IrOpcode::kSpeculativeNumberLessThan || 330 op->opcode() == IrOpcode::kSpeculativeNumberLessThan ||
331 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual); 331 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual);
332 return OpParameter<NumberOperationHint>(op); 332 return OpParameter<NumberOperationHint>(op);
333 } 333 }
334 334
335 PretenureFlag PretenureFlagOf(const Operator* op) { 335 PretenureFlag PretenureFlagOf(const Operator* op) {
336 DCHECK_EQ(IrOpcode::kAllocate, op->opcode()); 336 DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
337 return OpParameter<PretenureFlag>(op); 337 return OpParameter<PretenureFlag>(op);
338 } 338 }
339 339
340 StringOperationHint StringOperationHintOf(const Operator* op) {
341 DCHECK(op->opcode() == IrOpcode::kStringCharCodeAt);
342 return OpParameter<StringOperationHint>(op);
343 }
344
345 UnicodeEncoding UnicodeEncodingOf(const Operator* op) {
346 DCHECK(op->opcode() == IrOpcode::kStringFromCodePoint);
347 return OpParameter<UnicodeEncoding>(op);
348 }
349
340 #define PURE_OP_LIST(V) \ 350 #define PURE_OP_LIST(V) \
341 V(BooleanNot, Operator::kNoProperties, 1, 0) \ 351 V(BooleanNot, Operator::kNoProperties, 1, 0) \
342 V(NumberEqual, Operator::kCommutative, 2, 0) \ 352 V(NumberEqual, Operator::kCommutative, 2, 0) \
343 V(NumberLessThan, Operator::kNoProperties, 2, 0) \ 353 V(NumberLessThan, Operator::kNoProperties, 2, 0) \
344 V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \ 354 V(NumberLessThanOrEqual, Operator::kNoProperties, 2, 0) \
345 V(NumberAdd, Operator::kCommutative, 2, 0) \ 355 V(NumberAdd, Operator::kCommutative, 2, 0) \
346 V(NumberSubtract, Operator::kNoProperties, 2, 0) \ 356 V(NumberSubtract, Operator::kNoProperties, 2, 0) \
347 V(NumberMultiply, Operator::kCommutative, 2, 0) \ 357 V(NumberMultiply, Operator::kCommutative, 2, 0) \
348 V(NumberDivide, Operator::kNoProperties, 2, 0) \ 358 V(NumberDivide, Operator::kNoProperties, 2, 0) \
349 V(NumberModulus, Operator::kNoProperties, 2, 0) \ 359 V(NumberModulus, Operator::kNoProperties, 2, 0) \
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 V(NumberSin, Operator::kNoProperties, 1, 0) \ 393 V(NumberSin, Operator::kNoProperties, 1, 0) \
384 V(NumberSinh, Operator::kNoProperties, 1, 0) \ 394 V(NumberSinh, Operator::kNoProperties, 1, 0) \
385 V(NumberSqrt, Operator::kNoProperties, 1, 0) \ 395 V(NumberSqrt, Operator::kNoProperties, 1, 0) \
386 V(NumberTan, Operator::kNoProperties, 1, 0) \ 396 V(NumberTan, Operator::kNoProperties, 1, 0) \
387 V(NumberTanh, Operator::kNoProperties, 1, 0) \ 397 V(NumberTanh, Operator::kNoProperties, 1, 0) \
388 V(NumberTrunc, Operator::kNoProperties, 1, 0) \ 398 V(NumberTrunc, Operator::kNoProperties, 1, 0) \
389 V(NumberToBoolean, Operator::kNoProperties, 1, 0) \ 399 V(NumberToBoolean, Operator::kNoProperties, 1, 0) \
390 V(NumberToInt32, Operator::kNoProperties, 1, 0) \ 400 V(NumberToInt32, Operator::kNoProperties, 1, 0) \
391 V(NumberToUint32, Operator::kNoProperties, 1, 0) \ 401 V(NumberToUint32, Operator::kNoProperties, 1, 0) \
392 V(NumberSilenceNaN, Operator::kNoProperties, 1, 0) \ 402 V(NumberSilenceNaN, Operator::kNoProperties, 1, 0) \
393 V(StringCharCodeAt, Operator::kNoProperties, 2, 1) \
394 V(StringFromCharCode, Operator::kNoProperties, 1, 0) \ 403 V(StringFromCharCode, Operator::kNoProperties, 1, 0) \
395 V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \ 404 V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \
396 V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \ 405 V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \
397 V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \ 406 V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \
398 V(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1, 0) \ 407 V(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1, 0) \
399 V(ChangeTaggedToInt32, Operator::kNoProperties, 1, 0) \ 408 V(ChangeTaggedToInt32, Operator::kNoProperties, 1, 0) \
400 V(ChangeTaggedToUint32, Operator::kNoProperties, 1, 0) \ 409 V(ChangeTaggedToUint32, Operator::kNoProperties, 1, 0) \
401 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1, 0) \ 410 V(ChangeTaggedToFloat64, Operator::kNoProperties, 1, 0) \
402 V(ChangeInt31ToTaggedSigned, Operator::kNoProperties, 1, 0) \ 411 V(ChangeInt31ToTaggedSigned, Operator::kNoProperties, 1, 0) \
403 V(ChangeInt32ToTagged, Operator::kNoProperties, 1, 0) \ 412 V(ChangeInt32ToTagged, Operator::kNoProperties, 1, 0) \
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 struct Name##Operator final : public Operator { \ 470 struct Name##Operator final : public Operator { \
462 Name##Operator() \ 471 Name##Operator() \
463 : Operator(IrOpcode::k##Name, \ 472 : Operator(IrOpcode::k##Name, \
464 Operator::kFoldable | Operator::kNoThrow, #Name, \ 473 Operator::kFoldable | Operator::kNoThrow, #Name, \
465 value_input_count, 1, 1, value_output_count, 1, 0) {} \ 474 value_input_count, 1, 1, value_output_count, 1, 0) {} \
466 }; \ 475 }; \
467 Name##Operator k##Name; 476 Name##Operator k##Name;
468 CHECKED_OP_LIST(CHECKED) 477 CHECKED_OP_LIST(CHECKED)
469 #undef CHECKED 478 #undef CHECKED
470 479
480 template <StringOperationHint kHint>
481 struct StringCharCodeAtOperator final : public Operator {
482 StringCharCodeAtOperator()
483 : Operator(IrOpcode::kStringCharCodeAt, Operator::kPure,
484 "StringCharCodeAt", 2, 0, 1, 1, 0, 0) {}
485 };
486 StringCharCodeAtOperator<StringOperationHint::kAny>
487 kStringCharCodeAtOperatorAny;
488 StringCharCodeAtOperator<StringOperationHint::kSeqStringOrExternalString>
489 kStringCharCodeAtOperatorSeqStringOrExternalString;
490
491 template <UnicodeEncoding kEncoding>
492 struct StringFromCodePointOperator final : public Operator {
493 StringFromCodePointOperator()
494 : Operator(IrOpcode::kStringFromCodePoint, Operator::kPure,
495 "StringFromCodePoint", 1, 0, 0, 1, 0, 0) {}
496 };
497 StringFromCodePointOperator<UnicodeEncoding::UTF16>
498 kStringFromCodePointOperatorUTF16;
499 StringFromCodePointOperator<UnicodeEncoding::UTF32>
500 kStringFromCodePointOperatorUTF32;
501
471 struct ArrayBufferWasNeuteredOperator final : public Operator { 502 struct ArrayBufferWasNeuteredOperator final : public Operator {
472 ArrayBufferWasNeuteredOperator() 503 ArrayBufferWasNeuteredOperator()
473 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable, 504 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable,
474 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {} 505 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {}
475 }; 506 };
476 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered; 507 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered;
477 508
478 template <CheckForMinusZeroMode kMode> 509 template <CheckForMinusZeroMode kMode>
479 struct ChangeFloat64ToTaggedOperator final 510 struct ChangeFloat64ToTaggedOperator final
480 : public Operator1<CheckForMinusZeroMode> { 511 : public Operator1<CheckForMinusZeroMode> {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 #define STORE_BUFFER(Type, type, TYPE, ctype, size) \ 803 #define STORE_BUFFER(Type, type, TYPE, ctype, size) \
773 case kExternal##Type##Array: \ 804 case kExternal##Type##Array: \
774 return &cache_.kStoreBuffer##Type; 805 return &cache_.kStoreBuffer##Type;
775 TYPED_ARRAYS(STORE_BUFFER) 806 TYPED_ARRAYS(STORE_BUFFER)
776 #undef STORE_BUFFER 807 #undef STORE_BUFFER
777 } 808 }
778 UNREACHABLE(); 809 UNREACHABLE();
779 return nullptr; 810 return nullptr;
780 } 811 }
781 812
813 const Operator* SimplifiedOperatorBuilder::StringCharCodeAt(
814 StringOperationHint hint) {
815 switch (hint) {
816 case StringOperationHint::kAny:
817 return &cache_.kStringCharCodeAtOperatorAny;
818 case StringOperationHint::kSeqStringOrExternalString:
819 return &cache_.kStringCharCodeAtOperatorSeqStringOrExternalString;
820 }
821 UNREACHABLE();
822 return nullptr;
823 }
824
825 const Operator* SimplifiedOperatorBuilder::StringFromCodePoint(
826 UnicodeEncoding encoding) {
827 switch (encoding) {
828 case UnicodeEncoding::UTF16:
829 return &cache_.kStringFromCodePointOperatorUTF16;
830 case UnicodeEncoding::UTF32:
831 return &cache_.kStringFromCodePointOperatorUTF32;
832 }
833 UNREACHABLE();
834 return nullptr;
835 }
836
782 #define SPECULATIVE_NUMBER_BINOP(Name) \ 837 #define SPECULATIVE_NUMBER_BINOP(Name) \
783 const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \ 838 const Operator* SimplifiedOperatorBuilder::Name(NumberOperationHint hint) { \
784 switch (hint) { \ 839 switch (hint) { \
785 case NumberOperationHint::kSignedSmall: \ 840 case NumberOperationHint::kSignedSmall: \
786 return &cache_.k##Name##SignedSmallOperator; \ 841 return &cache_.k##Name##SignedSmallOperator; \
787 case NumberOperationHint::kSigned32: \ 842 case NumberOperationHint::kSigned32: \
788 return &cache_.k##Name##Signed32Operator; \ 843 return &cache_.k##Name##Signed32Operator; \
789 case NumberOperationHint::kNumber: \ 844 case NumberOperationHint::kNumber: \
790 return &cache_.k##Name##NumberOperator; \ 845 return &cache_.k##Name##NumberOperator; \
791 case NumberOperationHint::kNumberOrOddball: \ 846 case NumberOperationHint::kNumberOrOddball: \
(...skipping 21 matching lines...) Expand all
813 Operator::kNoDeopt | Operator::kNoThrow | properties, \ 868 Operator::kNoDeopt | Operator::kNoThrow | properties, \
814 #Name, value_input_count, 1, control_input_count, \ 869 #Name, value_input_count, 1, control_input_count, \
815 output_count, 1, 0, access); \ 870 output_count, 1, 0, access); \
816 } 871 }
817 ACCESS_OP_LIST(ACCESS) 872 ACCESS_OP_LIST(ACCESS)
818 #undef ACCESS 873 #undef ACCESS
819 874
820 } // namespace compiler 875 } // namespace compiler
821 } // namespace internal 876 } // namespace internal
822 } // namespace v8 877 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698