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 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it); | 1844 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it); |
1845 | 1845 |
1846 BailoutId ReturnId() const { return BailoutId(base_id() + 0); } | 1846 BailoutId ReturnId() const { return BailoutId(base_id() + 0); } |
1847 BailoutId EvalOrLookupId() const { return BailoutId(base_id() + 1); } | 1847 BailoutId EvalOrLookupId() const { return BailoutId(base_id() + 1); } |
1848 | 1848 |
1849 enum CallType { | 1849 enum CallType { |
1850 POSSIBLY_EVAL_CALL, | 1850 POSSIBLY_EVAL_CALL, |
1851 GLOBAL_CALL, | 1851 GLOBAL_CALL, |
1852 LOOKUP_SLOT_CALL, | 1852 LOOKUP_SLOT_CALL, |
1853 PROPERTY_CALL, | 1853 PROPERTY_CALL, |
| 1854 SUPER_CALL, |
1854 OTHER_CALL | 1855 OTHER_CALL |
1855 }; | 1856 }; |
1856 | 1857 |
1857 // Helpers to determine how to handle the call. | 1858 // Helpers to determine how to handle the call. |
1858 CallType GetCallType(Isolate* isolate) const; | 1859 CallType GetCallType(Isolate* isolate) const; |
1859 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; | 1860 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; |
1860 | 1861 |
1861 #ifdef DEBUG | 1862 #ifdef DEBUG |
1862 // Used to assert that the FullCodeGenerator records the return site. | 1863 // Used to assert that the FullCodeGenerator records the return site. |
1863 bool return_is_recorded_; | 1864 bool return_is_recorded_; |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3467 } | 3468 } |
3468 | 3469 |
3469 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3470 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
3470 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_); | 3471 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_gen_); |
3471 VISIT_AND_RETURN(Property, prop) | 3472 VISIT_AND_RETURN(Property, prop) |
3472 } | 3473 } |
3473 | 3474 |
3474 Call* NewCall(Expression* expression, | 3475 Call* NewCall(Expression* expression, |
3475 ZoneList<Expression*>* arguments, | 3476 ZoneList<Expression*>* arguments, |
3476 int pos) { | 3477 int pos) { |
3477 SuperReference* super_ref = expression->AsSuperReference(); | 3478 Call* call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_); |
3478 Call* call; | |
3479 if (super_ref != NULL) { | |
3480 Literal* constructor = | |
3481 NewStringLiteral(ast_value_factory_->constructor_string(), pos); | |
3482 Property* superConstructor = NewProperty(super_ref, constructor, pos); | |
3483 call = new (zone_) Call(zone_, superConstructor, arguments, pos, id_gen_); | |
3484 } else { | |
3485 call = new (zone_) Call(zone_, expression, arguments, pos, id_gen_); | |
3486 } | |
3487 VISIT_AND_RETURN(Call, call) | 3479 VISIT_AND_RETURN(Call, call) |
3488 } | 3480 } |
3489 | 3481 |
3490 CallNew* NewCallNew(Expression* expression, | 3482 CallNew* NewCallNew(Expression* expression, |
3491 ZoneList<Expression*>* arguments, | 3483 ZoneList<Expression*>* arguments, |
3492 int pos) { | 3484 int pos) { |
3493 CallNew* call = | 3485 CallNew* call = |
3494 new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_); | 3486 new (zone_) CallNew(zone_, expression, arguments, pos, id_gen_); |
3495 VISIT_AND_RETURN(CallNew, call) | 3487 VISIT_AND_RETURN(CallNew, call) |
3496 } | 3488 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3629 Zone* zone_; | 3621 Zone* zone_; |
3630 Visitor visitor_; | 3622 Visitor visitor_; |
3631 AstValueFactory* ast_value_factory_; | 3623 AstValueFactory* ast_value_factory_; |
3632 AstNode::IdGen* id_gen_; | 3624 AstNode::IdGen* id_gen_; |
3633 }; | 3625 }; |
3634 | 3626 |
3635 | 3627 |
3636 } } // namespace v8::internal | 3628 } } // namespace v8::internal |
3637 | 3629 |
3638 #endif // V8_AST_H_ | 3630 #endif // V8_AST_H_ |
OLD | NEW |