| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 int NextMaterializedLiteralIndex() { | 494 int NextMaterializedLiteralIndex() { |
| 495 return next_materialized_literal_index_++; | 495 return next_materialized_literal_index_++; |
| 496 } | 496 } |
| 497 int materialized_literal_count() { | 497 int materialized_literal_count() { |
| 498 return next_materialized_literal_index_ - JSFunction::kLiteralsPrefixSize; | 498 return next_materialized_literal_index_ - JSFunction::kLiteralsPrefixSize; |
| 499 } | 499 } |
| 500 | 500 |
| 501 int NextHandlerIndex() { return next_handler_index_++; } | 501 int NextHandlerIndex() { return next_handler_index_++; } |
| 502 int handler_count() { return next_handler_index_; } | 502 int handler_count() { return next_handler_index_; } |
| 503 | 503 |
| 504 void SetThisPropertyAssignmentInfo( | |
| 505 bool only_simple_this_property_assignments, | |
| 506 Handle<FixedArray> this_property_assignments) { | |
| 507 only_simple_this_property_assignments_ = | |
| 508 only_simple_this_property_assignments; | |
| 509 this_property_assignments_ = this_property_assignments; | |
| 510 } | |
| 511 bool only_simple_this_property_assignments() { | |
| 512 return only_simple_this_property_assignments_; | |
| 513 } | |
| 514 Handle<FixedArray> this_property_assignments() { | |
| 515 return this_property_assignments_; | |
| 516 } | |
| 517 | |
| 518 void AddProperty() { expected_property_count_++; } | 504 void AddProperty() { expected_property_count_++; } |
| 519 int expected_property_count() { return expected_property_count_; } | 505 int expected_property_count() { return expected_property_count_; } |
| 520 | 506 |
| 521 void set_generator_object_variable(Variable *variable) { | 507 void set_generator_object_variable(Variable *variable) { |
| 522 ASSERT(variable != NULL); | 508 ASSERT(variable != NULL); |
| 523 ASSERT(!is_generator()); | 509 ASSERT(!is_generator()); |
| 524 generator_object_variable_ = variable; | 510 generator_object_variable_ = variable; |
| 525 } | 511 } |
| 526 Variable* generator_object_variable() const { | 512 Variable* generator_object_variable() const { |
| 527 return generator_object_variable_; | 513 return generator_object_variable_; |
| 528 } | 514 } |
| 529 bool is_generator() const { | 515 bool is_generator() const { |
| 530 return generator_object_variable_ != NULL; | 516 return generator_object_variable_ != NULL; |
| 531 } | 517 } |
| 532 | 518 |
| 533 AstNodeFactory<AstConstructionVisitor>* factory() { return &factory_; } | 519 AstNodeFactory<AstConstructionVisitor>* factory() { return &factory_; } |
| 534 | 520 |
| 535 private: | 521 private: |
| 536 // Used to assign an index to each literal that needs materialization in | 522 // Used to assign an index to each literal that needs materialization in |
| 537 // the function. Includes regexp literals, and boilerplate for object and | 523 // the function. Includes regexp literals, and boilerplate for object and |
| 538 // array literals. | 524 // array literals. |
| 539 int next_materialized_literal_index_; | 525 int next_materialized_literal_index_; |
| 540 | 526 |
| 541 // Used to assign a per-function index to try and catch handlers. | 527 // Used to assign a per-function index to try and catch handlers. |
| 542 int next_handler_index_; | 528 int next_handler_index_; |
| 543 | 529 |
| 544 // Properties count estimation. | 530 // Properties count estimation. |
| 545 int expected_property_count_; | 531 int expected_property_count_; |
| 546 | 532 |
| 547 // Keeps track of assignments to properties of this. Used for | |
| 548 // optimizing constructors. | |
| 549 bool only_simple_this_property_assignments_; | |
| 550 Handle<FixedArray> this_property_assignments_; | |
| 551 | |
| 552 // For generators, the variable that holds the generator object. This | 533 // For generators, the variable that holds the generator object. This |
| 553 // variable is used by yield expressions and return statements. NULL | 534 // variable is used by yield expressions and return statements. NULL |
| 554 // indicates that this function is not a generator. | 535 // indicates that this function is not a generator. |
| 555 Variable* generator_object_variable_; | 536 Variable* generator_object_variable_; |
| 556 | 537 |
| 557 Parser* parser_; | 538 Parser* parser_; |
| 558 FunctionState* outer_function_state_; | 539 FunctionState* outer_function_state_; |
| 559 Scope* outer_scope_; | 540 Scope* outer_scope_; |
| 560 int saved_ast_node_id_; | 541 int saved_ast_node_id_; |
| 561 AstNodeFactory<AstConstructionVisitor> factory_; | 542 AstNodeFactory<AstConstructionVisitor> factory_; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 private: | 889 private: |
| 909 static const int kTypeSlot = 0; | 890 static const int kTypeSlot = 0; |
| 910 static const int kElementsSlot = 1; | 891 static const int kElementsSlot = 1; |
| 911 | 892 |
| 912 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 893 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 913 }; | 894 }; |
| 914 | 895 |
| 915 } } // namespace v8::internal | 896 } } // namespace v8::internal |
| 916 | 897 |
| 917 #endif // V8_PARSER_H_ | 898 #endif // V8_PARSER_H_ |
| OLD | NEW |