| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 protected: | 422 protected: |
| 423 BreakableStatement( | 423 BreakableStatement( |
| 424 Zone* zone, ZoneList<const AstRawString*>* labels, | 424 Zone* zone, ZoneList<const AstRawString*>* labels, |
| 425 BreakableType breakable_type, int position) | 425 BreakableType breakable_type, int position) |
| 426 : Statement(zone, position), | 426 : Statement(zone, position), |
| 427 labels_(labels), | 427 labels_(labels), |
| 428 breakable_type_(breakable_type), | 428 breakable_type_(breakable_type), |
| 429 entry_id_(GetNextId(zone)), | 429 entry_id_(GetNextId(zone)), |
| 430 exit_id_(GetNextId(zone)) { | 430 exit_id_(GetNextId(zone)) { |
| 431 ASSERT(labels == NULL || labels->length() > 0); | 431 DCHECK(labels == NULL || labels->length() > 0); |
| 432 } | 432 } |
| 433 | 433 |
| 434 | 434 |
| 435 private: | 435 private: |
| 436 ZoneList<const AstRawString*>* labels_; | 436 ZoneList<const AstRawString*>* labels_; |
| 437 BreakableType breakable_type_; | 437 BreakableType breakable_type_; |
| 438 Label break_target_; | 438 Label break_target_; |
| 439 const BailoutId entry_id_; | 439 const BailoutId entry_id_; |
| 440 const BailoutId exit_id_; | 440 const BailoutId exit_id_; |
| 441 }; | 441 }; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 protected: | 494 protected: |
| 495 Declaration(Zone* zone, | 495 Declaration(Zone* zone, |
| 496 VariableProxy* proxy, | 496 VariableProxy* proxy, |
| 497 VariableMode mode, | 497 VariableMode mode, |
| 498 Scope* scope, | 498 Scope* scope, |
| 499 int pos) | 499 int pos) |
| 500 : AstNode(pos), | 500 : AstNode(pos), |
| 501 proxy_(proxy), | 501 proxy_(proxy), |
| 502 mode_(mode), | 502 mode_(mode), |
| 503 scope_(scope) { | 503 scope_(scope) { |
| 504 ASSERT(IsDeclaredVariableMode(mode)); | 504 DCHECK(IsDeclaredVariableMode(mode)); |
| 505 } | 505 } |
| 506 | 506 |
| 507 private: | 507 private: |
| 508 VariableProxy* proxy_; | 508 VariableProxy* proxy_; |
| 509 VariableMode mode_; | 509 VariableMode mode_; |
| 510 | 510 |
| 511 // Nested scope from which the declaration originated. | 511 // Nested scope from which the declaration originated. |
| 512 Scope* scope_; | 512 Scope* scope_; |
| 513 }; | 513 }; |
| 514 | 514 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 545 protected: | 545 protected: |
| 546 FunctionDeclaration(Zone* zone, | 546 FunctionDeclaration(Zone* zone, |
| 547 VariableProxy* proxy, | 547 VariableProxy* proxy, |
| 548 VariableMode mode, | 548 VariableMode mode, |
| 549 FunctionLiteral* fun, | 549 FunctionLiteral* fun, |
| 550 Scope* scope, | 550 Scope* scope, |
| 551 int pos) | 551 int pos) |
| 552 : Declaration(zone, proxy, mode, scope, pos), | 552 : Declaration(zone, proxy, mode, scope, pos), |
| 553 fun_(fun) { | 553 fun_(fun) { |
| 554 // At the moment there are no "const functions" in JavaScript... | 554 // At the moment there are no "const functions" in JavaScript... |
| 555 ASSERT(mode == VAR || mode == LET); | 555 DCHECK(mode == VAR || mode == LET); |
| 556 ASSERT(fun != NULL); | 556 DCHECK(fun != NULL); |
| 557 } | 557 } |
| 558 | 558 |
| 559 private: | 559 private: |
| 560 FunctionLiteral* fun_; | 560 FunctionLiteral* fun_; |
| 561 }; | 561 }; |
| 562 | 562 |
| 563 | 563 |
| 564 class ModuleDeclaration V8_FINAL : public Declaration { | 564 class ModuleDeclaration V8_FINAL : public Declaration { |
| 565 public: | 565 public: |
| 566 DECLARE_NODE_TYPE(ModuleDeclaration) | 566 DECLARE_NODE_TYPE(ModuleDeclaration) |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 | 918 |
| 919 Expression* enumerable() const { | 919 Expression* enumerable() const { |
| 920 return subject(); | 920 return subject(); |
| 921 } | 921 } |
| 922 | 922 |
| 923 // Type feedback information. | 923 // Type feedback information. |
| 924 virtual int ComputeFeedbackSlotCount() { return 1; } | 924 virtual int ComputeFeedbackSlotCount() { return 1; } |
| 925 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } | 925 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } |
| 926 | 926 |
| 927 int ForInFeedbackSlot() { | 927 int ForInFeedbackSlot() { |
| 928 ASSERT(for_in_feedback_slot_ != kInvalidFeedbackSlot); | 928 DCHECK(for_in_feedback_slot_ != kInvalidFeedbackSlot); |
| 929 return for_in_feedback_slot_; | 929 return for_in_feedback_slot_; |
| 930 } | 930 } |
| 931 | 931 |
| 932 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 932 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 933 ForInType for_in_type() const { return for_in_type_; } | 933 ForInType for_in_type() const { return for_in_type_; } |
| 934 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 934 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 935 | 935 |
| 936 BailoutId BodyId() const { return body_id_; } | 936 BailoutId BodyId() const { return body_id_; } |
| 937 BailoutId PrepareId() const { return prepare_id_; } | 937 BailoutId PrepareId() const { return prepare_id_; } |
| 938 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 938 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 | 1339 |
| 1340 class Literal V8_FINAL : public Expression { | 1340 class Literal V8_FINAL : public Expression { |
| 1341 public: | 1341 public: |
| 1342 DECLARE_NODE_TYPE(Literal) | 1342 DECLARE_NODE_TYPE(Literal) |
| 1343 | 1343 |
| 1344 virtual bool IsPropertyName() const V8_OVERRIDE { | 1344 virtual bool IsPropertyName() const V8_OVERRIDE { |
| 1345 return value_->IsPropertyName(); | 1345 return value_->IsPropertyName(); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 Handle<String> AsPropertyName() { | 1348 Handle<String> AsPropertyName() { |
| 1349 ASSERT(IsPropertyName()); | 1349 DCHECK(IsPropertyName()); |
| 1350 return Handle<String>::cast(value()); | 1350 return Handle<String>::cast(value()); |
| 1351 } | 1351 } |
| 1352 | 1352 |
| 1353 const AstRawString* AsRawPropertyName() { | 1353 const AstRawString* AsRawPropertyName() { |
| 1354 ASSERT(IsPropertyName()); | 1354 DCHECK(IsPropertyName()); |
| 1355 return value_->AsString(); | 1355 return value_->AsString(); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { | 1358 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { |
| 1359 return value()->BooleanValue(); | 1359 return value()->BooleanValue(); |
| 1360 } | 1360 } |
| 1361 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { | 1361 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { |
| 1362 return !value()->BooleanValue(); | 1362 return !value()->BooleanValue(); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1394 | 1394 |
| 1395 // Base class for literals that needs space in the corresponding JSFunction. | 1395 // Base class for literals that needs space in the corresponding JSFunction. |
| 1396 class MaterializedLiteral : public Expression { | 1396 class MaterializedLiteral : public Expression { |
| 1397 public: | 1397 public: |
| 1398 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1398 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
| 1399 | 1399 |
| 1400 int literal_index() { return literal_index_; } | 1400 int literal_index() { return literal_index_; } |
| 1401 | 1401 |
| 1402 int depth() const { | 1402 int depth() const { |
| 1403 // only callable after initialization. | 1403 // only callable after initialization. |
| 1404 ASSERT(depth_ >= 1); | 1404 DCHECK(depth_ >= 1); |
| 1405 return depth_; | 1405 return depth_; |
| 1406 } | 1406 } |
| 1407 | 1407 |
| 1408 protected: | 1408 protected: |
| 1409 MaterializedLiteral(Zone* zone, | 1409 MaterializedLiteral(Zone* zone, |
| 1410 int literal_index, | 1410 int literal_index, |
| 1411 int pos) | 1411 int pos) |
| 1412 : Expression(zone, pos), | 1412 : Expression(zone, pos), |
| 1413 literal_index_(literal_index), | 1413 literal_index_(literal_index), |
| 1414 is_simple_(false), | 1414 is_simple_(false), |
| 1415 depth_(0) {} | 1415 depth_(0) {} |
| 1416 | 1416 |
| 1417 // A materialized literal is simple if the values consist of only | 1417 // A materialized literal is simple if the values consist of only |
| 1418 // constants and simple object and array literals. | 1418 // constants and simple object and array literals. |
| 1419 bool is_simple() const { return is_simple_; } | 1419 bool is_simple() const { return is_simple_; } |
| 1420 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } | 1420 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } |
| 1421 friend class CompileTimeValue; | 1421 friend class CompileTimeValue; |
| 1422 | 1422 |
| 1423 void set_depth(int depth) { | 1423 void set_depth(int depth) { |
| 1424 ASSERT(depth >= 1); | 1424 DCHECK(depth >= 1); |
| 1425 depth_ = depth; | 1425 depth_ = depth; |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 // Populate the constant properties/elements fixed array. | 1428 // Populate the constant properties/elements fixed array. |
| 1429 void BuildConstants(Isolate* isolate); | 1429 void BuildConstants(Isolate* isolate); |
| 1430 friend class ArrayLiteral; | 1430 friend class ArrayLiteral; |
| 1431 friend class ObjectLiteral; | 1431 friend class ObjectLiteral; |
| 1432 | 1432 |
| 1433 // If the expression is a literal, return the literal value; | 1433 // If the expression is a literal, return the literal value; |
| 1434 // if the expression is a materialized literal and is simple return a | 1434 // if the expression is a materialized literal and is simple return a |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 | 1852 |
| 1853 // Type feedback information. | 1853 // Type feedback information. |
| 1854 virtual int ComputeFeedbackSlotCount() { | 1854 virtual int ComputeFeedbackSlotCount() { |
| 1855 return FLAG_pretenuring_call_new ? 2 : 1; | 1855 return FLAG_pretenuring_call_new ? 2 : 1; |
| 1856 } | 1856 } |
| 1857 virtual void SetFirstFeedbackSlot(int slot) { | 1857 virtual void SetFirstFeedbackSlot(int slot) { |
| 1858 callnew_feedback_slot_ = slot; | 1858 callnew_feedback_slot_ = slot; |
| 1859 } | 1859 } |
| 1860 | 1860 |
| 1861 int CallNewFeedbackSlot() { | 1861 int CallNewFeedbackSlot() { |
| 1862 ASSERT(callnew_feedback_slot_ != kInvalidFeedbackSlot); | 1862 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); |
| 1863 return callnew_feedback_slot_; | 1863 return callnew_feedback_slot_; |
| 1864 } | 1864 } |
| 1865 int AllocationSiteFeedbackSlot() { | 1865 int AllocationSiteFeedbackSlot() { |
| 1866 ASSERT(callnew_feedback_slot_ != kInvalidFeedbackSlot); | 1866 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); |
| 1867 ASSERT(FLAG_pretenuring_call_new); | 1867 DCHECK(FLAG_pretenuring_call_new); |
| 1868 return callnew_feedback_slot_ + 1; | 1868 return callnew_feedback_slot_ + 1; |
| 1869 } | 1869 } |
| 1870 | 1870 |
| 1871 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1871 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1872 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1872 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1873 Handle<JSFunction> target() const { return target_; } | 1873 Handle<JSFunction> target() const { return target_; } |
| 1874 ElementsKind elements_kind() const { return elements_kind_; } | 1874 ElementsKind elements_kind() const { return elements_kind_; } |
| 1875 Handle<AllocationSite> allocation_site() const { | 1875 Handle<AllocationSite> allocation_site() const { |
| 1876 return allocation_site_; | 1876 return allocation_site_; |
| 1877 } | 1877 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 | 1923 |
| 1924 // Type feedback information. | 1924 // Type feedback information. |
| 1925 virtual int ComputeFeedbackSlotCount() { | 1925 virtual int ComputeFeedbackSlotCount() { |
| 1926 return (FLAG_vector_ics && is_jsruntime()) ? 1 : 0; | 1926 return (FLAG_vector_ics && is_jsruntime()) ? 1 : 0; |
| 1927 } | 1927 } |
| 1928 virtual void SetFirstFeedbackSlot(int slot) { | 1928 virtual void SetFirstFeedbackSlot(int slot) { |
| 1929 callruntime_feedback_slot_ = slot; | 1929 callruntime_feedback_slot_ = slot; |
| 1930 } | 1930 } |
| 1931 | 1931 |
| 1932 int CallRuntimeFeedbackSlot() { | 1932 int CallRuntimeFeedbackSlot() { |
| 1933 ASSERT(!is_jsruntime() || | 1933 DCHECK(!is_jsruntime() || |
| 1934 callruntime_feedback_slot_ != kInvalidFeedbackSlot); | 1934 callruntime_feedback_slot_ != kInvalidFeedbackSlot); |
| 1935 return callruntime_feedback_slot_; | 1935 return callruntime_feedback_slot_; |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1938 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
| 1939 | 1939 |
| 1940 protected: | 1940 protected: |
| 1941 CallRuntime(Zone* zone, | 1941 CallRuntime(Zone* zone, |
| 1942 const AstRawString* name, | 1942 const AstRawString* name, |
| 1943 const Runtime::Function* function, | 1943 const Runtime::Function* function, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1972 protected: | 1972 protected: |
| 1973 UnaryOperation(Zone* zone, | 1973 UnaryOperation(Zone* zone, |
| 1974 Token::Value op, | 1974 Token::Value op, |
| 1975 Expression* expression, | 1975 Expression* expression, |
| 1976 int pos) | 1976 int pos) |
| 1977 : Expression(zone, pos), | 1977 : Expression(zone, pos), |
| 1978 op_(op), | 1978 op_(op), |
| 1979 expression_(expression), | 1979 expression_(expression), |
| 1980 materialize_true_id_(GetNextId(zone)), | 1980 materialize_true_id_(GetNextId(zone)), |
| 1981 materialize_false_id_(GetNextId(zone)) { | 1981 materialize_false_id_(GetNextId(zone)) { |
| 1982 ASSERT(Token::IsUnaryOp(op)); | 1982 DCHECK(Token::IsUnaryOp(op)); |
| 1983 } | 1983 } |
| 1984 | 1984 |
| 1985 private: | 1985 private: |
| 1986 Token::Value op_; | 1986 Token::Value op_; |
| 1987 Expression* expression_; | 1987 Expression* expression_; |
| 1988 | 1988 |
| 1989 // For unary not (Token::NOT), the AST ids where true and false will | 1989 // For unary not (Token::NOT), the AST ids where true and false will |
| 1990 // actually be materialized, respectively. | 1990 // actually be materialized, respectively. |
| 1991 const BailoutId materialize_true_id_; | 1991 const BailoutId materialize_true_id_; |
| 1992 const BailoutId materialize_false_id_; | 1992 const BailoutId materialize_false_id_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2020 BinaryOperation(Zone* zone, | 2020 BinaryOperation(Zone* zone, |
| 2021 Token::Value op, | 2021 Token::Value op, |
| 2022 Expression* left, | 2022 Expression* left, |
| 2023 Expression* right, | 2023 Expression* right, |
| 2024 int pos) | 2024 int pos) |
| 2025 : Expression(zone, pos), | 2025 : Expression(zone, pos), |
| 2026 op_(op), | 2026 op_(op), |
| 2027 left_(left), | 2027 left_(left), |
| 2028 right_(right), | 2028 right_(right), |
| 2029 right_id_(GetNextId(zone)) { | 2029 right_id_(GetNextId(zone)) { |
| 2030 ASSERT(Token::IsBinaryOp(op)); | 2030 DCHECK(Token::IsBinaryOp(op)); |
| 2031 } | 2031 } |
| 2032 | 2032 |
| 2033 private: | 2033 private: |
| 2034 Token::Value op_; | 2034 Token::Value op_; |
| 2035 Expression* left_; | 2035 Expression* left_; |
| 2036 Expression* right_; | 2036 Expression* right_; |
| 2037 Handle<AllocationSite> allocation_site_; | 2037 Handle<AllocationSite> allocation_site_; |
| 2038 | 2038 |
| 2039 // TODO(rossberg): the fixed arg should probably be represented as a Constant | 2039 // TODO(rossberg): the fixed arg should probably be represented as a Constant |
| 2040 // type for the RHS. | 2040 // type for the RHS. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 CompareOperation(Zone* zone, | 2128 CompareOperation(Zone* zone, |
| 2129 Token::Value op, | 2129 Token::Value op, |
| 2130 Expression* left, | 2130 Expression* left, |
| 2131 Expression* right, | 2131 Expression* right, |
| 2132 int pos) | 2132 int pos) |
| 2133 : Expression(zone, pos), | 2133 : Expression(zone, pos), |
| 2134 op_(op), | 2134 op_(op), |
| 2135 left_(left), | 2135 left_(left), |
| 2136 right_(right), | 2136 right_(right), |
| 2137 combined_type_(Type::None(zone)) { | 2137 combined_type_(Type::None(zone)) { |
| 2138 ASSERT(Token::IsCompareOp(op)); | 2138 DCHECK(Token::IsCompareOp(op)); |
| 2139 } | 2139 } |
| 2140 | 2140 |
| 2141 private: | 2141 private: |
| 2142 Token::Value op_; | 2142 Token::Value op_; |
| 2143 Expression* left_; | 2143 Expression* left_; |
| 2144 Expression* right_; | 2144 Expression* right_; |
| 2145 | 2145 |
| 2146 Type* combined_type_; | 2146 Type* combined_type_; |
| 2147 }; | 2147 }; |
| 2148 | 2148 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 | 2218 |
| 2219 protected: | 2219 protected: |
| 2220 Assignment(Zone* zone, | 2220 Assignment(Zone* zone, |
| 2221 Token::Value op, | 2221 Token::Value op, |
| 2222 Expression* target, | 2222 Expression* target, |
| 2223 Expression* value, | 2223 Expression* value, |
| 2224 int pos); | 2224 int pos); |
| 2225 | 2225 |
| 2226 template<class Visitor> | 2226 template<class Visitor> |
| 2227 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { | 2227 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { |
| 2228 ASSERT(Token::IsAssignmentOp(op_)); | 2228 DCHECK(Token::IsAssignmentOp(op_)); |
| 2229 if (is_compound()) { | 2229 if (is_compound()) { |
| 2230 binary_operation_ = factory->NewBinaryOperation( | 2230 binary_operation_ = factory->NewBinaryOperation( |
| 2231 binary_op(), target_, value_, position() + 1); | 2231 binary_op(), target_, value_, position() + 1); |
| 2232 } | 2232 } |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 private: | 2235 private: |
| 2236 Token::Value op_; | 2236 Token::Value op_; |
| 2237 Expression* target_; | 2237 Expression* target_; |
| 2238 Expression* value_; | 2238 Expression* value_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2258 }; | 2258 }; |
| 2259 | 2259 |
| 2260 Expression* generator_object() const { return generator_object_; } | 2260 Expression* generator_object() const { return generator_object_; } |
| 2261 Expression* expression() const { return expression_; } | 2261 Expression* expression() const { return expression_; } |
| 2262 Kind yield_kind() const { return yield_kind_; } | 2262 Kind yield_kind() const { return yield_kind_; } |
| 2263 | 2263 |
| 2264 // Delegating yield surrounds the "yield" in a "try/catch". This index | 2264 // Delegating yield surrounds the "yield" in a "try/catch". This index |
| 2265 // locates the catch handler in the handler table, and is equivalent to | 2265 // locates the catch handler in the handler table, and is equivalent to |
| 2266 // TryCatchStatement::index(). | 2266 // TryCatchStatement::index(). |
| 2267 int index() const { | 2267 int index() const { |
| 2268 ASSERT(yield_kind() == DELEGATING); | 2268 DCHECK(yield_kind() == DELEGATING); |
| 2269 return index_; | 2269 return index_; |
| 2270 } | 2270 } |
| 2271 void set_index(int index) { | 2271 void set_index(int index) { |
| 2272 ASSERT(yield_kind() == DELEGATING); | 2272 DCHECK(yield_kind() == DELEGATING); |
| 2273 index_ = index; | 2273 index_ = index; |
| 2274 } | 2274 } |
| 2275 | 2275 |
| 2276 // Type feedback information. | 2276 // Type feedback information. |
| 2277 virtual int ComputeFeedbackSlotCount() { | 2277 virtual int ComputeFeedbackSlotCount() { |
| 2278 return (FLAG_vector_ics && yield_kind() == DELEGATING) ? 3 : 0; | 2278 return (FLAG_vector_ics && yield_kind() == DELEGATING) ? 3 : 0; |
| 2279 } | 2279 } |
| 2280 virtual void SetFirstFeedbackSlot(int slot) { | 2280 virtual void SetFirstFeedbackSlot(int slot) { |
| 2281 yield_first_feedback_slot_ = slot; | 2281 yield_first_feedback_slot_ = slot; |
| 2282 } | 2282 } |
| 2283 | 2283 |
| 2284 int KeyedLoadFeedbackSlot() { | 2284 int KeyedLoadFeedbackSlot() { |
| 2285 ASSERT(yield_first_feedback_slot_ != kInvalidFeedbackSlot); | 2285 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); |
| 2286 return yield_first_feedback_slot_; | 2286 return yield_first_feedback_slot_; |
| 2287 } | 2287 } |
| 2288 | 2288 |
| 2289 int DoneFeedbackSlot() { | 2289 int DoneFeedbackSlot() { |
| 2290 ASSERT(yield_first_feedback_slot_ != kInvalidFeedbackSlot); | 2290 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); |
| 2291 return yield_first_feedback_slot_ + 1; | 2291 return yield_first_feedback_slot_ + 1; |
| 2292 } | 2292 } |
| 2293 | 2293 |
| 2294 int ValueFeedbackSlot() { | 2294 int ValueFeedbackSlot() { |
| 2295 ASSERT(yield_first_feedback_slot_ != kInvalidFeedbackSlot); | 2295 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); |
| 2296 return yield_first_feedback_slot_ + 2; | 2296 return yield_first_feedback_slot_ + 2; |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 protected: | 2299 protected: |
| 2300 Yield(Zone* zone, | 2300 Yield(Zone* zone, |
| 2301 Expression* generator_object, | 2301 Expression* generator_object, |
| 2302 Expression* expression, | 2302 Expression* expression, |
| 2303 Kind yield_kind, | 2303 Kind yield_kind, |
| 2304 int pos) | 2304 int pos) |
| 2305 : Expression(zone, pos), | 2305 : Expression(zone, pos), |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2395 | 2395 |
| 2396 Handle<String> debug_name() const { | 2396 Handle<String> debug_name() const { |
| 2397 if (raw_name_ != NULL && !raw_name_->IsEmpty()) { | 2397 if (raw_name_ != NULL && !raw_name_->IsEmpty()) { |
| 2398 return raw_name_->string(); | 2398 return raw_name_->string(); |
| 2399 } | 2399 } |
| 2400 return inferred_name(); | 2400 return inferred_name(); |
| 2401 } | 2401 } |
| 2402 | 2402 |
| 2403 Handle<String> inferred_name() const { | 2403 Handle<String> inferred_name() const { |
| 2404 if (!inferred_name_.is_null()) { | 2404 if (!inferred_name_.is_null()) { |
| 2405 ASSERT(raw_inferred_name_ == NULL); | 2405 DCHECK(raw_inferred_name_ == NULL); |
| 2406 return inferred_name_; | 2406 return inferred_name_; |
| 2407 } | 2407 } |
| 2408 if (raw_inferred_name_ != NULL) { | 2408 if (raw_inferred_name_ != NULL) { |
| 2409 return raw_inferred_name_->string(); | 2409 return raw_inferred_name_->string(); |
| 2410 } | 2410 } |
| 2411 UNREACHABLE(); | 2411 UNREACHABLE(); |
| 2412 return Handle<String>(); | 2412 return Handle<String>(); |
| 2413 } | 2413 } |
| 2414 | 2414 |
| 2415 // Only one of {set_inferred_name, set_raw_inferred_name} should be called. | 2415 // Only one of {set_inferred_name, set_raw_inferred_name} should be called. |
| 2416 void set_inferred_name(Handle<String> inferred_name) { | 2416 void set_inferred_name(Handle<String> inferred_name) { |
| 2417 ASSERT(!inferred_name.is_null()); | 2417 DCHECK(!inferred_name.is_null()); |
| 2418 inferred_name_ = inferred_name; | 2418 inferred_name_ = inferred_name; |
| 2419 ASSERT(raw_inferred_name_== NULL || raw_inferred_name_->IsEmpty()); | 2419 DCHECK(raw_inferred_name_== NULL || raw_inferred_name_->IsEmpty()); |
| 2420 raw_inferred_name_ = NULL; | 2420 raw_inferred_name_ = NULL; |
| 2421 } | 2421 } |
| 2422 | 2422 |
| 2423 void set_raw_inferred_name(const AstString* raw_inferred_name) { | 2423 void set_raw_inferred_name(const AstString* raw_inferred_name) { |
| 2424 ASSERT(raw_inferred_name != NULL); | 2424 DCHECK(raw_inferred_name != NULL); |
| 2425 raw_inferred_name_ = raw_inferred_name; | 2425 raw_inferred_name_ = raw_inferred_name; |
| 2426 ASSERT(inferred_name_.is_null()); | 2426 DCHECK(inferred_name_.is_null()); |
| 2427 inferred_name_ = Handle<String>(); | 2427 inferred_name_ = Handle<String>(); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 // shared_info may be null if it's not cached in full code. | 2430 // shared_info may be null if it's not cached in full code. |
| 2431 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } | 2431 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } |
| 2432 | 2432 |
| 2433 bool pretenure() { return Pretenure::decode(bitfield_); } | 2433 bool pretenure() { return Pretenure::decode(bitfield_); } |
| 2434 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 2434 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
| 2435 | 2435 |
| 2436 bool has_duplicate_parameters() { | 2436 bool has_duplicate_parameters() { |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3477 private: | 3477 private: |
| 3478 Zone* zone_; | 3478 Zone* zone_; |
| 3479 Visitor visitor_; | 3479 Visitor visitor_; |
| 3480 AstValueFactory* ast_value_factory_; | 3480 AstValueFactory* ast_value_factory_; |
| 3481 }; | 3481 }; |
| 3482 | 3482 |
| 3483 | 3483 |
| 3484 } } // namespace v8::internal | 3484 } } // namespace v8::internal |
| 3485 | 3485 |
| 3486 #endif // V8_AST_H_ | 3486 #endif // V8_AST_H_ |
| OLD | NEW |