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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 return false; | 370 return false; |
371 } | 371 } |
372 virtual SmallMapList* GetReceiverTypes() { | 372 virtual SmallMapList* GetReceiverTypes() { |
373 UNREACHABLE(); | 373 UNREACHABLE(); |
374 return NULL; | 374 return NULL; |
375 } | 375 } |
376 virtual KeyedAccessStoreMode GetStoreMode() { | 376 virtual KeyedAccessStoreMode GetStoreMode() { |
377 UNREACHABLE(); | 377 UNREACHABLE(); |
378 return STANDARD_STORE; | 378 return STANDARD_STORE; |
379 } | 379 } |
| 380 virtual IcCheckType GetKeyType() { |
| 381 UNREACHABLE(); |
| 382 return ELEMENT; |
| 383 } |
380 | 384 |
381 // TODO(rossberg): this should move to its own AST node eventually. | 385 // TODO(rossberg): this should move to its own AST node eventually. |
382 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 386 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
383 byte to_boolean_types() const { return to_boolean_types_; } | 387 byte to_boolean_types() const { return to_boolean_types_; } |
384 | 388 |
385 BailoutId id() const { return BailoutId(base_id() + 0); } | 389 BailoutId id() const { return BailoutId(base_id() + 0); } |
386 TypeFeedbackId test_id() const { return TypeFeedbackId(base_id() + 1); } | 390 TypeFeedbackId test_id() const { return TypeFeedbackId(base_id() + 1); } |
387 | 391 |
388 protected: | 392 protected: |
389 Expression(Zone* zone, int pos, int num_ids_needed_by_subclass, IdGen* id_gen) | 393 Expression(Zone* zone, int pos, int num_ids_needed_by_subclass, IdGen* id_gen) |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 } | 2098 } |
2095 | 2099 |
2096 Expression* expression() const { return expression_; } | 2100 Expression* expression() const { return expression_; } |
2097 | 2101 |
2098 virtual bool IsMonomorphic() OVERRIDE { | 2102 virtual bool IsMonomorphic() OVERRIDE { |
2099 return receiver_types_.length() == 1; | 2103 return receiver_types_.length() == 1; |
2100 } | 2104 } |
2101 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 2105 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
2102 return &receiver_types_; | 2106 return &receiver_types_; |
2103 } | 2107 } |
| 2108 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; } |
2104 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 2109 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { |
2105 return store_mode_; | 2110 return store_mode_; |
2106 } | 2111 } |
2107 Type* type() const { return type_; } | 2112 Type* type() const { return type_; } |
| 2113 void set_key_type(IcCheckType type) { key_type_ = type; } |
2108 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2114 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
2109 void set_type(Type* type) { type_ = type; } | 2115 void set_type(Type* type) { type_ = type; } |
2110 | 2116 |
2111 BailoutId AssignmentId() const { return BailoutId(base_id() + 0); } | 2117 BailoutId AssignmentId() const { return BailoutId(base_id() + 0); } |
2112 TypeFeedbackId CountBinOpFeedbackId() const { | 2118 TypeFeedbackId CountBinOpFeedbackId() const { |
2113 return TypeFeedbackId(base_id() + 1); | 2119 return TypeFeedbackId(base_id() + 1); |
2114 } | 2120 } |
2115 TypeFeedbackId CountStoreFeedbackId() const { | 2121 TypeFeedbackId CountStoreFeedbackId() const { |
2116 return TypeFeedbackId(base_id() + 2); | 2122 return TypeFeedbackId(base_id() + 2); |
2117 } | 2123 } |
2118 | 2124 |
2119 protected: | 2125 protected: |
2120 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, | 2126 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, |
2121 int pos, IdGen* id_gen) | 2127 int pos, IdGen* id_gen) |
2122 : Expression(zone, pos, num_ids(), id_gen), | 2128 : Expression(zone, pos, num_ids(), id_gen), |
2123 op_(op), | 2129 op_(op), |
2124 is_prefix_(is_prefix), | 2130 is_prefix_(is_prefix), |
2125 store_mode_(STANDARD_STORE), | 2131 store_mode_(STANDARD_STORE), |
2126 expression_(expr) {} | 2132 expression_(expr) {} |
2127 | 2133 |
2128 static int num_ids() { return 3; } | 2134 static int num_ids() { return 3; } |
2129 int base_id() const { return Expression::base_id() + Expression::num_ids(); } | 2135 int base_id() const { return Expression::base_id() + Expression::num_ids(); } |
2130 | 2136 |
2131 private: | 2137 private: |
2132 Token::Value op_; | 2138 Token::Value op_; |
2133 bool is_prefix_ : 1; | 2139 bool is_prefix_ : 1; |
| 2140 IcCheckType key_type_ : 1; |
2134 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2141 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
2135 // must have extra bit. | 2142 // must have extra bit. |
2136 Type* type_; | 2143 Type* type_; |
2137 Expression* expression_; | 2144 Expression* expression_; |
2138 SmallMapList receiver_types_; | 2145 SmallMapList receiver_types_; |
2139 }; | 2146 }; |
2140 | 2147 |
2141 | 2148 |
2142 class CompareOperation FINAL : public Expression { | 2149 class CompareOperation FINAL : public Expression { |
2143 public: | 2150 public: |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 virtual bool IsMonomorphic() OVERRIDE { | 2243 virtual bool IsMonomorphic() OVERRIDE { |
2237 return receiver_types_.length() == 1; | 2244 return receiver_types_.length() == 1; |
2238 } | 2245 } |
2239 bool IsUninitialized() { return is_uninitialized_; } | 2246 bool IsUninitialized() { return is_uninitialized_; } |
2240 bool HasNoTypeInformation() { | 2247 bool HasNoTypeInformation() { |
2241 return is_uninitialized_; | 2248 return is_uninitialized_; |
2242 } | 2249 } |
2243 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 2250 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
2244 return &receiver_types_; | 2251 return &receiver_types_; |
2245 } | 2252 } |
| 2253 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; } |
2246 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 2254 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { |
2247 return store_mode_; | 2255 return store_mode_; |
2248 } | 2256 } |
2249 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 2257 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 2258 void set_key_type(IcCheckType key_type) { key_type_ = key_type; } |
2250 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2259 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
2251 | 2260 |
2252 protected: | 2261 protected: |
2253 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, | 2262 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, |
2254 int pos, IdGen* id_gen); | 2263 int pos, IdGen* id_gen); |
2255 | 2264 |
2256 static int num_ids() { return 2; } | 2265 static int num_ids() { return 2; } |
2257 int base_id() const { return Expression::base_id() + Expression::num_ids(); } | 2266 int base_id() const { return Expression::base_id() + Expression::num_ids(); } |
2258 | 2267 |
2259 template<class Visitor> | 2268 template<class Visitor> |
2260 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { | 2269 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { |
2261 DCHECK(Token::IsAssignmentOp(op_)); | 2270 DCHECK(Token::IsAssignmentOp(op_)); |
2262 if (is_compound()) { | 2271 if (is_compound()) { |
2263 binary_operation_ = factory->NewBinaryOperation( | 2272 binary_operation_ = factory->NewBinaryOperation( |
2264 binary_op(), target_, value_, position() + 1); | 2273 binary_op(), target_, value_, position() + 1); |
2265 } | 2274 } |
2266 } | 2275 } |
2267 | 2276 |
2268 private: | 2277 private: |
2269 Token::Value op_; | 2278 Token::Value op_; |
2270 Expression* target_; | 2279 Expression* target_; |
2271 Expression* value_; | 2280 Expression* value_; |
2272 BinaryOperation* binary_operation_; | 2281 BinaryOperation* binary_operation_; |
2273 bool is_uninitialized_ : 1; | 2282 bool is_uninitialized_ : 1; |
| 2283 IcCheckType key_type_ : 1; |
2274 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2284 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
2275 // must have extra bit. | 2285 // must have extra bit. |
2276 SmallMapList receiver_types_; | 2286 SmallMapList receiver_types_; |
2277 }; | 2287 }; |
2278 | 2288 |
2279 | 2289 |
2280 class Yield FINAL : public Expression { | 2290 class Yield FINAL : public Expression { |
2281 public: | 2291 public: |
2282 DECLARE_NODE_TYPE(Yield) | 2292 DECLARE_NODE_TYPE(Yield) |
2283 | 2293 |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3624 Zone* zone_; | 3634 Zone* zone_; |
3625 Visitor visitor_; | 3635 Visitor visitor_; |
3626 AstValueFactory* ast_value_factory_; | 3636 AstValueFactory* ast_value_factory_; |
3627 AstNode::IdGen* id_gen_; | 3637 AstNode::IdGen* id_gen_; |
3628 }; | 3638 }; |
3629 | 3639 |
3630 | 3640 |
3631 } } // namespace v8::internal | 3641 } } // namespace v8::internal |
3632 | 3642 |
3633 #endif // V8_AST_H_ | 3643 #endif // V8_AST_H_ |
OLD | NEW |