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