| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 }; | 427 }; |
| 428 | 428 |
| 429 | 429 |
| 430 class HEnvironment: public ZoneObject { | 430 class HEnvironment: public ZoneObject { |
| 431 public: | 431 public: |
| 432 HEnvironment(HEnvironment* outer, | 432 HEnvironment(HEnvironment* outer, |
| 433 Scope* scope, | 433 Scope* scope, |
| 434 Handle<JSFunction> closure, | 434 Handle<JSFunction> closure, |
| 435 Zone* zone); | 435 Zone* zone); |
| 436 | 436 |
| 437 HEnvironment* DiscardInlined(bool drop_extra) { |
| 438 HEnvironment* outer = outer_; |
| 439 while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_; |
| 440 if (drop_extra) outer->Drop(1); |
| 441 return outer; |
| 442 } |
| 443 |
| 437 HEnvironment* arguments_environment() { | 444 HEnvironment* arguments_environment() { |
| 438 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; | 445 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; |
| 439 } | 446 } |
| 440 | 447 |
| 441 // Simple accessors. | 448 // Simple accessors. |
| 442 Handle<JSFunction> closure() const { return closure_; } | 449 Handle<JSFunction> closure() const { return closure_; } |
| 443 const ZoneList<HValue*>* values() const { return &values_; } | 450 const ZoneList<HValue*>* values() const { return &values_; } |
| 444 const ZoneList<int>* assigned_variables() const { | 451 const ZoneList<int>* assigned_variables() const { |
| 445 return &assigned_variables_; | 452 return &assigned_variables_; |
| 446 } | 453 } |
| 447 FrameType frame_type() const { return frame_type_; } | 454 FrameType frame_type() const { return frame_type_; } |
| 448 int parameter_count() const { return parameter_count_; } | 455 int parameter_count() const { return parameter_count_; } |
| 449 int specials_count() const { return specials_count_; } | 456 int specials_count() const { return specials_count_; } |
| 450 int local_count() const { return local_count_; } | 457 int local_count() const { return local_count_; } |
| 451 HEnvironment* outer() const { return outer_; } | 458 HEnvironment* outer() const { return outer_; } |
| 452 int pop_count() const { return pop_count_; } | 459 int pop_count() const { return pop_count_; } |
| 453 int push_count() const { return push_count_; } | 460 int push_count() const { return push_count_; } |
| 454 | 461 |
| 455 BailoutId ast_id() const { return ast_id_; } | 462 BailoutId ast_id() const { return ast_id_; } |
| 456 void set_ast_id(BailoutId id) { ast_id_ = id; } | 463 void set_ast_id(BailoutId id) { ast_id_ = id; } |
| 457 | 464 |
| 458 HEnterInlined* entry() const { return entry_; } | |
| 459 void set_entry(HEnterInlined* entry) { entry_ = entry; } | |
| 460 | |
| 461 int length() const { return values_.length(); } | 465 int length() const { return values_.length(); } |
| 462 bool is_special_index(int i) const { | 466 bool is_special_index(int i) const { |
| 463 return i >= parameter_count() && i < parameter_count() + specials_count(); | 467 return i >= parameter_count() && i < parameter_count() + specials_count(); |
| 464 } | 468 } |
| 465 | 469 |
| 466 int first_expression_index() const { | 470 int first_expression_index() const { |
| 467 return parameter_count() + specials_count() + local_count(); | 471 return parameter_count() + specials_count() + local_count(); |
| 468 } | 472 } |
| 469 | 473 |
| 470 void Bind(Variable* variable, HValue* value) { | 474 void Bind(Variable* variable, HValue* value) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 // Create an "inlined version" of this environment, where the original | 533 // Create an "inlined version" of this environment, where the original |
| 530 // environment is the outer environment but the top expression stack | 534 // environment is the outer environment but the top expression stack |
| 531 // elements are moved to an inner environment as parameters. | 535 // elements are moved to an inner environment as parameters. |
| 532 HEnvironment* CopyForInlining(Handle<JSFunction> target, | 536 HEnvironment* CopyForInlining(Handle<JSFunction> target, |
| 533 int arguments, | 537 int arguments, |
| 534 FunctionLiteral* function, | 538 FunctionLiteral* function, |
| 535 HConstant* undefined, | 539 HConstant* undefined, |
| 536 CallKind call_kind, | 540 CallKind call_kind, |
| 537 InliningKind inlining_kind) const; | 541 InliningKind inlining_kind) const; |
| 538 | 542 |
| 539 HEnvironment* DiscardInlined(bool drop_extra) { | |
| 540 HEnvironment* outer = outer_; | |
| 541 while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_; | |
| 542 if (drop_extra) outer->Drop(1); | |
| 543 return outer; | |
| 544 } | |
| 545 | |
| 546 void AddIncomingEdge(HBasicBlock* block, HEnvironment* other); | 543 void AddIncomingEdge(HBasicBlock* block, HEnvironment* other); |
| 547 | 544 |
| 548 void ClearHistory() { | 545 void ClearHistory() { |
| 549 pop_count_ = 0; | 546 pop_count_ = 0; |
| 550 push_count_ = 0; | 547 push_count_ = 0; |
| 551 assigned_variables_.Rewind(0); | 548 assigned_variables_.Rewind(0); |
| 552 } | 549 } |
| 553 | 550 |
| 554 void SetValueAt(int index, HValue* value) { | 551 void SetValueAt(int index, HValue* value) { |
| 555 ASSERT(index < length()); | 552 ASSERT(index < length()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 593 |
| 597 Handle<JSFunction> closure_; | 594 Handle<JSFunction> closure_; |
| 598 // Value array [parameters] [specials] [locals] [temporaries]. | 595 // Value array [parameters] [specials] [locals] [temporaries]. |
| 599 ZoneList<HValue*> values_; | 596 ZoneList<HValue*> values_; |
| 600 ZoneList<int> assigned_variables_; | 597 ZoneList<int> assigned_variables_; |
| 601 FrameType frame_type_; | 598 FrameType frame_type_; |
| 602 int parameter_count_; | 599 int parameter_count_; |
| 603 int specials_count_; | 600 int specials_count_; |
| 604 int local_count_; | 601 int local_count_; |
| 605 HEnvironment* outer_; | 602 HEnvironment* outer_; |
| 606 HEnterInlined* entry_; | |
| 607 int pop_count_; | 603 int pop_count_; |
| 608 int push_count_; | 604 int push_count_; |
| 609 BailoutId ast_id_; | 605 BailoutId ast_id_; |
| 610 Zone* zone_; | 606 Zone* zone_; |
| 611 }; | 607 }; |
| 612 | 608 |
| 613 | 609 |
| 614 class HGraphBuilder; | 610 class HGraphBuilder; |
| 615 | 611 |
| 616 enum ArgumentsAllowedFlag { | 612 enum ArgumentsAllowedFlag { |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 const char* filename_; | 1482 const char* filename_; |
| 1487 HeapStringAllocator string_allocator_; | 1483 HeapStringAllocator string_allocator_; |
| 1488 StringStream trace_; | 1484 StringStream trace_; |
| 1489 int indent_; | 1485 int indent_; |
| 1490 }; | 1486 }; |
| 1491 | 1487 |
| 1492 | 1488 |
| 1493 } } // namespace v8::internal | 1489 } } // namespace v8::internal |
| 1494 | 1490 |
| 1495 #endif // V8_HYDROGEN_H_ | 1491 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |