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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } | 1691 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } |
1692 void set_is_resolved() { | 1692 void set_is_resolved() { |
1693 bit_field_ = IsResolvedField::update(bit_field_, true); | 1693 bit_field_ = IsResolvedField::update(bit_field_, true); |
1694 } | 1694 } |
1695 | 1695 |
1696 Interface* interface() const { return interface_; } | 1696 Interface* interface() const { return interface_; } |
1697 | 1697 |
1698 // Bind this proxy to the variable var. Interfaces must match. | 1698 // Bind this proxy to the variable var. Interfaces must match. |
1699 void BindTo(Variable* var); | 1699 void BindTo(Variable* var); |
1700 | 1700 |
| 1701 bool UsesVariableFeedbackSlot() const { |
| 1702 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot()); |
| 1703 } |
| 1704 |
1701 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1705 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1702 Isolate* isolate) OVERRIDE { | 1706 Isolate* isolate) OVERRIDE { |
1703 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1707 return FeedbackVectorRequirements(0, UsesVariableFeedbackSlot() ? 1 : 0); |
1704 } | 1708 } |
| 1709 |
1705 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { | 1710 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1706 variable_feedback_slot_ = slot; | 1711 variable_feedback_slot_ = slot; |
1707 } | 1712 } |
1708 | 1713 |
1709 FeedbackVectorICSlot VariableFeedbackSlot() { | 1714 FeedbackVectorICSlot VariableFeedbackSlot() { |
1710 DCHECK(!FLAG_vector_ics || !variable_feedback_slot_.IsInvalid()); | 1715 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); |
1711 return variable_feedback_slot_; | 1716 return variable_feedback_slot_; |
1712 } | 1717 } |
1713 | 1718 |
1714 protected: | 1719 protected: |
1715 VariableProxy(Zone* zone, Variable* var, int position); | 1720 VariableProxy(Zone* zone, Variable* var, int position); |
1716 | 1721 |
1717 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 1722 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, |
1718 Interface* interface, int position); | 1723 Interface* interface, int position); |
1719 | 1724 |
1720 class IsThisField : public BitField8<bool, 0, 1> {}; | 1725 class IsThisField : public BitField8<bool, 0, 1> {}; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 public: | 2007 public: |
2003 DECLARE_NODE_TYPE(CallRuntime) | 2008 DECLARE_NODE_TYPE(CallRuntime) |
2004 | 2009 |
2005 Handle<String> name() const { return raw_name_->string(); } | 2010 Handle<String> name() const { return raw_name_->string(); } |
2006 const AstRawString* raw_name() const { return raw_name_; } | 2011 const AstRawString* raw_name() const { return raw_name_; } |
2007 const Runtime::Function* function() const { return function_; } | 2012 const Runtime::Function* function() const { return function_; } |
2008 ZoneList<Expression*>* arguments() const { return arguments_; } | 2013 ZoneList<Expression*>* arguments() const { return arguments_; } |
2009 bool is_jsruntime() const { return function_ == NULL; } | 2014 bool is_jsruntime() const { return function_ == NULL; } |
2010 | 2015 |
2011 // Type feedback information. | 2016 // Type feedback information. |
| 2017 bool HasCallRuntimeFeedbackSlot() const { |
| 2018 return FLAG_vector_ics && is_jsruntime(); |
| 2019 } |
2012 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 2020 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
2013 Isolate* isolate) OVERRIDE { | 2021 Isolate* isolate) OVERRIDE { |
2014 return FeedbackVectorRequirements( | 2022 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); |
2015 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0); | |
2016 } | 2023 } |
2017 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { | 2024 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
2018 callruntime_feedback_slot_ = slot; | 2025 callruntime_feedback_slot_ = slot; |
2019 } | 2026 } |
2020 | 2027 |
2021 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { | 2028 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { |
2022 DCHECK(!(FLAG_vector_ics && is_jsruntime()) || | 2029 DCHECK(!HasCallRuntimeFeedbackSlot() || |
2023 !callruntime_feedback_slot_.IsInvalid()); | 2030 !callruntime_feedback_slot_.IsInvalid()); |
2024 return callruntime_feedback_slot_; | 2031 return callruntime_feedback_slot_; |
2025 } | 2032 } |
2026 | 2033 |
2027 static int num_ids() { return parent_num_ids() + 1; } | 2034 static int num_ids() { return parent_num_ids() + 1; } |
2028 TypeFeedbackId CallRuntimeFeedbackId() const { | 2035 TypeFeedbackId CallRuntimeFeedbackId() const { |
2029 return TypeFeedbackId(local_id(0)); | 2036 return TypeFeedbackId(local_id(0)); |
2030 } | 2037 } |
2031 | 2038 |
2032 protected: | 2039 protected: |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 int index() const { | 2389 int index() const { |
2383 DCHECK_EQ(kDelegating, yield_kind()); | 2390 DCHECK_EQ(kDelegating, yield_kind()); |
2384 return index_; | 2391 return index_; |
2385 } | 2392 } |
2386 void set_index(int index) { | 2393 void set_index(int index) { |
2387 DCHECK_EQ(kDelegating, yield_kind()); | 2394 DCHECK_EQ(kDelegating, yield_kind()); |
2388 index_ = index; | 2395 index_ = index; |
2389 } | 2396 } |
2390 | 2397 |
2391 // Type feedback information. | 2398 // Type feedback information. |
| 2399 bool HasFeedbackSlots() const { |
| 2400 return FLAG_vector_ics && (yield_kind() == kDelegating); |
| 2401 } |
2392 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 2402 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
2393 Isolate* isolate) OVERRIDE { | 2403 Isolate* isolate) OVERRIDE { |
2394 return FeedbackVectorRequirements( | 2404 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); |
2395 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0); | |
2396 } | 2405 } |
2397 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { | 2406 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
2398 yield_first_feedback_slot_ = slot; | 2407 yield_first_feedback_slot_ = slot; |
2399 } | 2408 } |
2400 | 2409 |
2401 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { | 2410 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { |
2402 DCHECK(!FLAG_vector_ics || !yield_first_feedback_slot_.IsInvalid()); | 2411 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); |
2403 return yield_first_feedback_slot_; | 2412 return yield_first_feedback_slot_; |
2404 } | 2413 } |
2405 | 2414 |
2406 FeedbackVectorICSlot DoneFeedbackSlot() { | 2415 FeedbackVectorICSlot DoneFeedbackSlot() { |
2407 return KeyedLoadFeedbackSlot().next(); | 2416 return KeyedLoadFeedbackSlot().next(); |
2408 } | 2417 } |
2409 | 2418 |
2410 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); } | 2419 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); } |
2411 | 2420 |
2412 protected: | 2421 protected: |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3550 | 3559 |
3551 private: | 3560 private: |
3552 Zone* zone_; | 3561 Zone* zone_; |
3553 AstValueFactory* ast_value_factory_; | 3562 AstValueFactory* ast_value_factory_; |
3554 }; | 3563 }; |
3555 | 3564 |
3556 | 3565 |
3557 } } // namespace v8::internal | 3566 } } // namespace v8::internal |
3558 | 3567 |
3559 #endif // V8_AST_H_ | 3568 #endif // V8_AST_H_ |
OLD | NEW |