OLD | NEW |
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 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 BailoutId ReturnId() const { return BailoutId(local_id(0)); } | 1896 BailoutId ReturnId() const { return BailoutId(local_id(0)); } |
1897 BailoutId EvalOrLookupId() const { return BailoutId(local_id(1)); } | 1897 BailoutId EvalOrLookupId() const { return BailoutId(local_id(1)); } |
1898 | 1898 |
1899 bool is_uninitialized() const { | 1899 bool is_uninitialized() const { |
1900 return IsUninitializedField::decode(bit_field_); | 1900 return IsUninitializedField::decode(bit_field_); |
1901 } | 1901 } |
1902 void set_is_uninitialized(bool b) { | 1902 void set_is_uninitialized(bool b) { |
1903 bit_field_ = IsUninitializedField::update(bit_field_, b); | 1903 bit_field_ = IsUninitializedField::update(bit_field_, b); |
1904 } | 1904 } |
1905 | 1905 |
| 1906 void MarkShouldHandleMinusZeroResult() { |
| 1907 bit_field_ = ShouldHandleMinusZeroResultField::update(bit_field_, true); |
| 1908 } |
| 1909 bool ShouldHandleMinusZeroResult() { |
| 1910 return ShouldHandleMinusZeroResultField::decode(bit_field_); |
| 1911 } |
| 1912 |
1906 enum CallType { | 1913 enum CallType { |
1907 POSSIBLY_EVAL_CALL, | 1914 POSSIBLY_EVAL_CALL, |
1908 GLOBAL_CALL, | 1915 GLOBAL_CALL, |
1909 LOOKUP_SLOT_CALL, | 1916 LOOKUP_SLOT_CALL, |
1910 PROPERTY_CALL, | 1917 PROPERTY_CALL, |
1911 SUPER_CALL, | 1918 SUPER_CALL, |
1912 OTHER_CALL | 1919 OTHER_CALL |
1913 }; | 1920 }; |
1914 | 1921 |
1915 // Helpers to determine how to handle the call. | 1922 // Helpers to determine how to handle the call. |
1916 CallType GetCallType(Isolate* isolate) const; | 1923 CallType GetCallType(Isolate* isolate) const; |
1917 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; | 1924 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; |
1918 bool IsUsingCallFeedbackICSlot(Isolate* isolate) const; | 1925 bool IsUsingCallFeedbackICSlot(Isolate* isolate) const; |
1919 | 1926 |
1920 #ifdef DEBUG | 1927 #ifdef DEBUG |
1921 // Used to assert that the FullCodeGenerator records the return site. | 1928 // Used to assert that the FullCodeGenerator records the return site. |
1922 bool return_is_recorded_; | 1929 bool return_is_recorded_; |
1923 #endif | 1930 #endif |
1924 | 1931 |
1925 protected: | 1932 protected: |
1926 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1933 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
1927 int pos) | 1934 int pos) |
1928 : Expression(zone, pos), | 1935 : Expression(zone, pos), |
1929 ic_slot_or_slot_(FeedbackVectorICSlot::Invalid().ToInt()), | 1936 ic_slot_or_slot_(FeedbackVectorICSlot::Invalid().ToInt()), |
1930 expression_(expression), | 1937 expression_(expression), |
1931 arguments_(arguments), | 1938 arguments_(arguments), |
1932 bit_field_(IsUninitializedField::encode(false)) { | 1939 bit_field_(IsUninitializedField::encode(false) | |
| 1940 ShouldHandleMinusZeroResultField::encode(false)) { |
1933 if (expression->IsProperty()) { | 1941 if (expression->IsProperty()) { |
1934 expression->AsProperty()->mark_for_call(); | 1942 expression->AsProperty()->mark_for_call(); |
1935 } | 1943 } |
1936 } | 1944 } |
1937 static int parent_num_ids() { return Expression::num_ids(); } | 1945 static int parent_num_ids() { return Expression::num_ids(); } |
1938 | 1946 |
1939 private: | 1947 private: |
1940 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1948 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1941 | 1949 |
1942 // We store this as an integer because we don't know if we have a slot or | 1950 // We store this as an integer because we don't know if we have a slot or |
1943 // an ic slot until scoping time. | 1951 // an ic slot until scoping time. |
1944 int ic_slot_or_slot_; | 1952 int ic_slot_or_slot_; |
1945 Expression* expression_; | 1953 Expression* expression_; |
1946 ZoneList<Expression*>* arguments_; | 1954 ZoneList<Expression*>* arguments_; |
1947 Handle<JSFunction> target_; | 1955 Handle<JSFunction> target_; |
1948 Handle<AllocationSite> allocation_site_; | 1956 Handle<AllocationSite> allocation_site_; |
1949 class IsUninitializedField : public BitField8<bool, 0, 1> {}; | 1957 class IsUninitializedField : public BitField8<bool, 0, 1> {}; |
| 1958 class ShouldHandleMinusZeroResultField : public BitField8<bool, 1, 1> {}; |
1950 uint8_t bit_field_; | 1959 uint8_t bit_field_; |
1951 }; | 1960 }; |
1952 | 1961 |
1953 | 1962 |
1954 class CallNew final : public Expression { | 1963 class CallNew final : public Expression { |
1955 public: | 1964 public: |
1956 DECLARE_NODE_TYPE(CallNew) | 1965 DECLARE_NODE_TYPE(CallNew) |
1957 | 1966 |
1958 Expression* expression() const { return expression_; } | 1967 Expression* expression() const { return expression_; } |
1959 ZoneList<Expression*>* arguments() const { return arguments_; } | 1968 ZoneList<Expression*>* arguments() const { return arguments_; } |
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3594 | 3603 |
3595 private: | 3604 private: |
3596 Zone* zone_; | 3605 Zone* zone_; |
3597 AstValueFactory* ast_value_factory_; | 3606 AstValueFactory* ast_value_factory_; |
3598 }; | 3607 }; |
3599 | 3608 |
3600 | 3609 |
3601 } } // namespace v8::internal | 3610 } } // namespace v8::internal |
3602 | 3611 |
3603 #endif // V8_AST_H_ | 3612 #endif // V8_AST_H_ |
OLD | NEW |