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

Unified Diff: src/compiler/js-operator.h

Issue 2890023004: [turbofan] Avoid allocating rest parameters for spread calls. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-operator.h
diff --git a/src/compiler/js-operator.h b/src/compiler/js-operator.h
index a9cfd6306e0fea11f415fdb2e44d3c09357bfd6b..5ac3b6769e3f7f0491967e7cde69e678273585a6 100644
--- a/src/compiler/js-operator.h
+++ b/src/compiler/js-operator.h
@@ -90,6 +90,40 @@ ConvertReceiverMode ConvertReceiverModeOf(Operator const* op);
// The ToBooleanHints are used as parameter by JSToBoolean operators.
ToBooleanHints ToBooleanHintsOf(Operator const* op);
+// Defines the flags for a JavaScript call forwarding parameters. This
+// is used as parameter by JSConstructForwardVarargs operators.
+class ConstructForwardVarargsParameters final {
+ public:
+ ConstructForwardVarargsParameters(size_t arity, uint32_t start_index)
+ : bit_field_(ArityField::encode(arity) |
+ StartIndexField::encode(start_index)) {}
+
+ size_t arity() const { return ArityField::decode(bit_field_); }
+ uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
+
+ bool operator==(ConstructForwardVarargsParameters const& that) const {
+ return this->bit_field_ == that.bit_field_;
+ }
+ bool operator!=(ConstructForwardVarargsParameters const& that) const {
+ return !(*this == that);
+ }
+
+ private:
+ friend size_t hash_value(ConstructForwardVarargsParameters const& p) {
+ return p.bit_field_;
+ }
+
+ typedef BitField<size_t, 0, 16> ArityField;
+ typedef BitField<uint32_t, 16, 16> StartIndexField;
+
+ uint32_t const bit_field_;
+};
+
+std::ostream& operator<<(std::ostream&,
+ ConstructForwardVarargsParameters const&);
+
+ConstructForwardVarargsParameters const& ConstructForwardVarargsParametersOf(
+ Operator const*) WARN_UNUSED_RESULT;
// Defines the arity and the feedback for a JavaScript constructor call. This is
// used as a parameter by JSConstruct operators.
@@ -146,11 +180,13 @@ SpreadWithArityParameter const& SpreadWithArityParameterOf(Operator const*);
// is used as parameter by JSCallForwardVarargs operators.
class CallForwardVarargsParameters final {
public:
- CallForwardVarargsParameters(uint32_t start_index,
+ CallForwardVarargsParameters(size_t arity, uint32_t start_index,
TailCallMode tail_call_mode)
- : bit_field_(StartIndexField::encode(start_index) |
+ : bit_field_(ArityField::encode(arity) |
+ StartIndexField::encode(start_index) |
TailCallModeField::encode(tail_call_mode)) {}
+ size_t arity() const { return ArityField::decode(bit_field_); }
uint32_t start_index() const { return StartIndexField::decode(bit_field_); }
TailCallMode tail_call_mode() const {
return TailCallModeField::decode(bit_field_);
@@ -168,8 +204,9 @@ class CallForwardVarargsParameters final {
return p.bit_field_;
}
- typedef BitField<uint32_t, 0, 30> StartIndexField;
- typedef BitField<TailCallMode, 31, 1> TailCallModeField;
+ typedef BitField<size_t, 0, 15> ArityField;
+ typedef BitField<uint32_t, 15, 15> StartIndexField;
+ typedef BitField<TailCallMode, 30, 1> TailCallModeField;
uint32_t const bit_field_;
};
@@ -665,7 +702,7 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
int literal_flags, int literal_index);
- const Operator* CallForwardVarargs(uint32_t start_index,
+ const Operator* CallForwardVarargs(size_t arity, uint32_t start_index,
TailCallMode tail_call_mode);
const Operator* Call(
size_t arity, CallFrequency frequency = CallFrequency(),
@@ -676,6 +713,8 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CallRuntime(Runtime::FunctionId id);
const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
+
+ const Operator* ConstructForwardVarargs(size_t arity, uint32_t start_index);
const Operator* Construct(uint32_t arity,
CallFrequency frequency = CallFrequency(),
VectorSlotPair const& feedback = VectorSlotPair());
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698