Index: src/compiler/js-operator.h |
diff --git a/src/compiler/js-operator.h b/src/compiler/js-operator.h |
index 60a20ad0145b25fc95e90e959bd6abe1921305e2..cc50cc23a56df9ab224b8bc96254ec965c8e90a8 100644 |
--- a/src/compiler/js-operator.h |
+++ b/src/compiler/js-operator.h |
@@ -41,8 +41,26 @@ bool operator!=(VectorSlotPair const&, VectorSlotPair const&); |
size_t hash_value(VectorSlotPair const&); |
+ |
+// Defines hints about receiver values based on structural knowledge. This is |
+// used as a parameter by JSConvertReceiver operators. |
+enum class ConvertReceiverMode { |
+ kNullOrUndefined, // Guaranteed to be null or undefined. |
+ kNotNullOrUndefined, // Guaranteed to never be null or undefined. |
+ kAny // No specific knowledge about receiver. |
+}; |
+ |
+size_t hash_value(ConvertReceiverMode const&); |
+ |
+std::ostream& operator<<(std::ostream&, ConvertReceiverMode const&); |
+ |
+const ConvertReceiverMode& ConvertReceiverModeOf(const Operator* op); |
+ |
+ |
+// Defines whether tail call optimization is allowed. |
enum TailCallMode { NO_TAIL_CALLS, ALLOW_TAIL_CALLS }; |
+ |
// Defines the arity and the call flags for a JavaScript function call. This is |
// used as a parameter by JSCallFunction operators. |
class CallFunctionParameters final { |
@@ -50,22 +68,27 @@ class CallFunctionParameters final { |
CallFunctionParameters(size_t arity, CallFunctionFlags flags, |
LanguageMode language_mode, |
VectorSlotPair const& feedback, |
- TailCallMode tail_call_mode) |
+ TailCallMode tail_call_mode, |
+ ConvertReceiverMode convert_mode) |
: bit_field_(ArityField::encode(arity) | FlagsField::encode(flags) | |
LanguageModeField::encode(language_mode)), |
feedback_(feedback), |
- tail_call_mode_(tail_call_mode) {} |
+ tail_call_mode_(tail_call_mode), |
+ convert_mode_(convert_mode) {} |
size_t arity() const { return ArityField::decode(bit_field_); } |
CallFunctionFlags flags() const { return FlagsField::decode(bit_field_); } |
LanguageMode language_mode() const { |
return LanguageModeField::decode(bit_field_); |
} |
+ ConvertReceiverMode convert_mode() const { return convert_mode_; } |
VectorSlotPair const& feedback() const { return feedback_; } |
bool operator==(CallFunctionParameters const& that) const { |
return this->bit_field_ == that.bit_field_ && |
- this->feedback_ == that.feedback_; |
+ this->feedback_ == that.feedback_ && |
+ this->tail_call_mode_ == that.tail_call_mode_ && |
+ this->convert_mode_ == that.convert_mode_; |
} |
bool operator!=(CallFunctionParameters const& that) const { |
return !(*this == that); |
@@ -75,7 +98,7 @@ class CallFunctionParameters final { |
private: |
friend size_t hash_value(CallFunctionParameters const& p) { |
- return base::hash_combine(p.bit_field_, p.feedback_); |
+ return base::hash_combine(p.bit_field_, p.feedback_, p.convert_mode_); |
} |
typedef BitField<size_t, 0, 28> ArityField; |
@@ -84,7 +107,8 @@ class CallFunctionParameters final { |
const uint32_t bit_field_; |
const VectorSlotPair feedback_; |
- bool tail_call_mode_; |
+ TailCallMode tail_call_mode_; |
+ ConvertReceiverMode convert_mode_; |
}; |
size_t hash_value(CallFunctionParameters const&); |
@@ -440,11 +464,13 @@ class JSOperatorBuilder final : public ZoneObject { |
const Operator* CallFunction( |
size_t arity, CallFunctionFlags flags, LanguageMode language_mode, |
VectorSlotPair const& feedback = VectorSlotPair(), |
+ ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, |
TailCallMode tail_call_mode = NO_TAIL_CALLS); |
const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
- |
const Operator* CallConstruct(int arguments); |
+ const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); |
+ |
const Operator* LoadProperty(LanguageMode language_mode, |
VectorSlotPair const& feedback); |
const Operator* LoadNamed(LanguageMode language_mode, Handle<Name> name, |