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

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

Issue 1216933011: [turbofan] Enable tail calls for %_CallFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix platform ports Created 5 years, 5 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-intrinsic-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 27 matching lines...) Expand all
38 private: 38 private:
39 const MaybeHandle<TypeFeedbackVector> vector_; 39 const MaybeHandle<TypeFeedbackVector> vector_;
40 const FeedbackVectorICSlot slot_; 40 const FeedbackVectorICSlot slot_;
41 }; 41 };
42 42
43 bool operator==(VectorSlotPair const&, VectorSlotPair const&); 43 bool operator==(VectorSlotPair const&, VectorSlotPair const&);
44 bool operator!=(VectorSlotPair const&, VectorSlotPair const&); 44 bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
45 45
46 size_t hash_value(VectorSlotPair const&); 46 size_t hash_value(VectorSlotPair const&);
47 47
48 enum TailCallMode { NO_TAIL_CALLS, ALLOW_TAIL_CALLS };
48 49
49 // Defines the arity and the call flags for a JavaScript function call. This is 50 // Defines the arity and the call flags for a JavaScript function call. This is
50 // used as a parameter by JSCallFunction operators. 51 // used as a parameter by JSCallFunction operators.
51 class CallFunctionParameters final { 52 class CallFunctionParameters final {
52 public: 53 public:
53 CallFunctionParameters(size_t arity, CallFunctionFlags flags, 54 CallFunctionParameters(size_t arity, CallFunctionFlags flags,
54 LanguageMode language_mode, 55 LanguageMode language_mode,
55 VectorSlotPair const& feedback) 56 VectorSlotPair const& feedback,
57 TailCallMode tail_call_mode)
56 : bit_field_(ArityField::encode(arity) | FlagsField::encode(flags) | 58 : bit_field_(ArityField::encode(arity) | FlagsField::encode(flags) |
57 LanguageModeField::encode(language_mode)), 59 LanguageModeField::encode(language_mode)),
58 feedback_(feedback) {} 60 feedback_(feedback),
61 tail_call_mode_(tail_call_mode) {}
59 62
60 size_t arity() const { return ArityField::decode(bit_field_); } 63 size_t arity() const { return ArityField::decode(bit_field_); }
61 CallFunctionFlags flags() const { return FlagsField::decode(bit_field_); } 64 CallFunctionFlags flags() const { return FlagsField::decode(bit_field_); }
62 LanguageMode language_mode() const { 65 LanguageMode language_mode() const {
63 return LanguageModeField::decode(bit_field_); 66 return LanguageModeField::decode(bit_field_);
64 } 67 }
65 VectorSlotPair const& feedback() const { return feedback_; } 68 VectorSlotPair const& feedback() const { return feedback_; }
66 69
67 bool operator==(CallFunctionParameters const& that) const { 70 bool operator==(CallFunctionParameters const& that) const {
68 return this->bit_field_ == that.bit_field_ && 71 return this->bit_field_ == that.bit_field_ &&
69 this->feedback_ == that.feedback_; 72 this->feedback_ == that.feedback_;
70 } 73 }
71 bool operator!=(CallFunctionParameters const& that) const { 74 bool operator!=(CallFunctionParameters const& that) const {
72 return !(*this == that); 75 return !(*this == that);
73 } 76 }
74 77
78 bool AllowTailCalls() const { return tail_call_mode_ == ALLOW_TAIL_CALLS; }
79
75 private: 80 private:
76 friend size_t hash_value(CallFunctionParameters const& p) { 81 friend size_t hash_value(CallFunctionParameters const& p) {
77 return base::hash_combine(p.bit_field_, p.feedback_); 82 return base::hash_combine(p.bit_field_, p.feedback_);
78 } 83 }
79 84
80 typedef BitField<size_t, 0, 28> ArityField; 85 typedef BitField<size_t, 0, 28> ArityField;
81 typedef BitField<CallFunctionFlags, 28, 2> FlagsField; 86 typedef BitField<CallFunctionFlags, 28, 2> FlagsField;
82 typedef BitField<LanguageMode, 30, 2> LanguageModeField; 87 typedef BitField<LanguageMode, 30, 2> LanguageModeField;
83 88
84 const uint32_t bit_field_; 89 const uint32_t bit_field_;
85 const VectorSlotPair feedback_; 90 const VectorSlotPair feedback_;
91 bool tail_call_mode_;
86 }; 92 };
87 93
88 size_t hash_value(CallFunctionParameters const&); 94 size_t hash_value(CallFunctionParameters const&);
89 95
90 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); 96 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&);
91 97
92 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); 98 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op);
93 99
94 100
95 // Defines the arity and the ID for a runtime function call. This is used as a 101 // Defines the arity and the ID for a runtime function call. This is used as a
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 const Operator* Yield(); 414 const Operator* Yield();
409 415
410 const Operator* Create(); 416 const Operator* Create();
411 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info, 417 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info,
412 PretenureFlag pretenure); 418 PretenureFlag pretenure);
413 const Operator* CreateLiteralArray(int literal_flags); 419 const Operator* CreateLiteralArray(int literal_flags);
414 const Operator* CreateLiteralObject(int literal_flags); 420 const Operator* CreateLiteralObject(int literal_flags);
415 421
416 const Operator* CallFunction( 422 const Operator* CallFunction(
417 size_t arity, CallFunctionFlags flags, LanguageMode language_mode, 423 size_t arity, CallFunctionFlags flags, LanguageMode language_mode,
418 VectorSlotPair const& feedback = VectorSlotPair()); 424 VectorSlotPair const& feedback = VectorSlotPair(),
425 TailCallMode tail_call_mode = NO_TAIL_CALLS);
419 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); 426 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
420 427
421 const Operator* CallConstruct(int arguments); 428 const Operator* CallConstruct(int arguments);
422 429
423 const Operator* LoadProperty(const VectorSlotPair& feedback, 430 const Operator* LoadProperty(const VectorSlotPair& feedback,
424 LanguageMode language_mode); 431 LanguageMode language_mode);
425 const Operator* LoadNamed(const Unique<Name>& name, 432 const Operator* LoadNamed(const Unique<Name>& name,
426 const VectorSlotPair& feedback, 433 const VectorSlotPair& feedback,
427 LanguageMode language_mode); 434 LanguageMode language_mode);
428 435
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 Zone* const zone_; 486 Zone* const zone_;
480 487
481 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); 488 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
482 }; 489 };
483 490
484 } // namespace compiler 491 } // namespace compiler
485 } // namespace internal 492 } // namespace internal
486 } // namespace v8 493 } // namespace v8
487 494
488 #endif // V8_COMPILER_JS_OPERATOR_H_ 495 #endif // V8_COMPILER_JS_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698