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