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

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

Issue 1494973002: [turbofan] Introduce ToBooleanHints on ToBoolean operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/type-hint-analyzer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-operator.h" 5 #include "src/compiler/js-operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/lazy-instance.h" 9 #include "src/base/lazy-instance.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 28 matching lines...) Expand all
39 return base::hash_combine(p.slot(), p.vector().location()); 39 return base::hash_combine(p.slot(), p.vector().location());
40 } 40 }
41 41
42 42
43 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) { 43 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) {
44 DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); 44 DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode());
45 return OpParameter<ConvertReceiverMode>(op); 45 return OpParameter<ConvertReceiverMode>(op);
46 } 46 }
47 47
48 48
49 ToBooleanHints ToBooleanHintsOf(Operator const* op) {
50 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode());
51 return OpParameter<ToBooleanHints>(op);
52 }
53
54
49 size_t hash_value(TailCallMode mode) { 55 size_t hash_value(TailCallMode mode) {
50 return base::hash_value(static_cast<unsigned>(mode)); 56 return base::hash_value(static_cast<unsigned>(mode));
51 } 57 }
52 58
53 59
54 std::ostream& operator<<(std::ostream& os, TailCallMode mode) { 60 std::ostream& operator<<(std::ostream& os, TailCallMode mode) {
55 switch (mode) { 61 switch (mode) {
56 case TailCallMode::kAllow: 62 case TailCallMode::kAllow:
57 return os << "ALLOW_TAIL_CALLS"; 63 return os << "ALLOW_TAIL_CALLS";
58 case TailCallMode::kDisallow: 64 case TailCallMode::kDisallow:
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); 485 op->opcode() == IrOpcode::kJSCreateLiteralRegExp);
480 return OpParameter<CreateLiteralParameters>(op); 486 return OpParameter<CreateLiteralParameters>(op);
481 } 487 }
482 488
483 489
484 #define CACHED_OP_LIST(V) \ 490 #define CACHED_OP_LIST(V) \
485 V(Equal, Operator::kNoProperties, 2, 1) \ 491 V(Equal, Operator::kNoProperties, 2, 1) \
486 V(NotEqual, Operator::kNoProperties, 2, 1) \ 492 V(NotEqual, Operator::kNoProperties, 2, 1) \
487 V(StrictEqual, Operator::kNoThrow, 2, 1) \ 493 V(StrictEqual, Operator::kNoThrow, 2, 1) \
488 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ 494 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \
489 V(ToBoolean, Operator::kEliminatable, 1, 1) \
490 V(ToNumber, Operator::kNoProperties, 1, 1) \ 495 V(ToNumber, Operator::kNoProperties, 1, 1) \
491 V(ToString, Operator::kNoProperties, 1, 1) \ 496 V(ToString, Operator::kNoProperties, 1, 1) \
492 V(ToName, Operator::kNoProperties, 1, 1) \ 497 V(ToName, Operator::kNoProperties, 1, 1) \
493 V(ToObject, Operator::kNoProperties, 1, 1) \ 498 V(ToObject, Operator::kNoProperties, 1, 1) \
494 V(Yield, Operator::kNoProperties, 1, 1) \ 499 V(Yield, Operator::kNoProperties, 1, 1) \
495 V(Create, Operator::kEliminatable, 2, 1) \ 500 V(Create, Operator::kEliminatable, 2, 1) \
496 V(HasProperty, Operator::kNoProperties, 2, 1) \ 501 V(HasProperty, Operator::kNoProperties, 2, 1) \
497 V(TypeOf, Operator::kEliminatable, 1, 1) \ 502 V(TypeOf, Operator::kEliminatable, 1, 1) \
498 V(InstanceOf, Operator::kNoProperties, 2, 1) \ 503 V(InstanceOf, Operator::kNoProperties, 2, 1) \
499 V(ForInDone, Operator::kPure, 2, 1) \ 504 V(ForInDone, Operator::kPure, 2, 1) \
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 // TODO(turbofan): Cache most important versions of this operator. 715 // TODO(turbofan): Cache most important versions of this operator.
711 BinaryOperationParameters parameters(language_mode, hints); 716 BinaryOperationParameters parameters(language_mode, hints);
712 return new (zone()) Operator1<BinaryOperationParameters>( //-- 717 return new (zone()) Operator1<BinaryOperationParameters>( //--
713 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode 718 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode
714 "JSModulus", // name 719 "JSModulus", // name
715 2, 1, 1, 1, 1, 2, // inputs/outputs 720 2, 1, 1, 1, 1, 2, // inputs/outputs
716 parameters); // parameter 721 parameters); // parameter
717 } 722 }
718 723
719 724
725 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) {
726 // TODO(turbofan): Cache most important versions of this operator.
727 return new (zone()) Operator1<ToBooleanHints>( //--
728 IrOpcode::kJSToBoolean, Operator::kEliminatable, // opcode
729 "JSToBoolean", // name
730 1, 1, 0, 1, 1, 0, // inputs/outputs
731 hints); // parameter
732 }
733
734
720 const Operator* JSOperatorBuilder::CallFunction( 735 const Operator* JSOperatorBuilder::CallFunction(
721 size_t arity, LanguageMode language_mode, VectorSlotPair const& feedback, 736 size_t arity, LanguageMode language_mode, VectorSlotPair const& feedback,
722 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { 737 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) {
723 CallFunctionParameters parameters(arity, language_mode, feedback, 738 CallFunctionParameters parameters(arity, language_mode, feedback,
724 tail_call_mode, convert_mode); 739 tail_call_mode, convert_mode);
725 return new (zone()) Operator1<CallFunctionParameters>( // -- 740 return new (zone()) Operator1<CallFunctionParameters>( // --
726 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode 741 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode
727 "JSCallFunction", // name 742 "JSCallFunction", // name
728 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs 743 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs
729 parameters); // parameter 744 parameters); // parameter
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- 1000 return new (zone()) Operator1<Handle<ScopeInfo>>( // --
986 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode 1001 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode
987 "JSCreateScriptContext", // name 1002 "JSCreateScriptContext", // name
988 1, 1, 1, 1, 1, 2, // counts 1003 1, 1, 1, 1, 1, 2, // counts
989 scpope_info); // parameter 1004 scpope_info); // parameter
990 } 1005 }
991 1006
992 } // namespace compiler 1007 } // namespace compiler
993 } // namespace internal 1008 } // namespace internal
994 } // namespace v8 1009 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/type-hint-analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698