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_FULL_CODEGEN_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 409 matching lines...) Loading... |
420 void PrepareForBailout(Expression* node, State state); | 420 void PrepareForBailout(Expression* node, State state); |
421 void PrepareForBailoutForId(BailoutId id, State state); | 421 void PrepareForBailoutForId(BailoutId id, State state); |
422 | 422 |
423 // Returns a smi for the index into the FixedArray that backs the feedback | 423 // Returns a smi for the index into the FixedArray that backs the feedback |
424 // vector | 424 // vector |
425 Smi* SmiFromSlot(FeedbackVectorSlot slot) const { | 425 Smi* SmiFromSlot(FeedbackVectorSlot slot) const { |
426 return Smi::FromInt(TypeFeedbackVector::GetIndexFromSpec( | 426 return Smi::FromInt(TypeFeedbackVector::GetIndexFromSpec( |
427 literal()->feedback_vector_spec(), slot)); | 427 literal()->feedback_vector_spec(), slot)); |
428 } | 428 } |
429 | 429 |
430 Smi* SmiFromSlot(FeedbackVectorICSlot slot) const { | |
431 return Smi::FromInt(TypeFeedbackVector::GetIndexFromSpec( | |
432 literal()->feedback_vector_spec(), slot)); | |
433 } | |
434 | |
435 // Record a call's return site offset, used to rebuild the frame if the | 430 // Record a call's return site offset, used to rebuild the frame if the |
436 // called function was inlined at the site. | 431 // called function was inlined at the site. |
437 void RecordJSReturnSite(Call* call); | 432 void RecordJSReturnSite(Call* call); |
438 | 433 |
439 // Prepare for bailout before a test (or compare) and branch. If | 434 // Prepare for bailout before a test (or compare) and branch. If |
440 // should_normalize, then the following comparison will not handle the | 435 // should_normalize, then the following comparison will not handle the |
441 // canonical JS true value so we will insert a (dead) test against true at | 436 // canonical JS true value so we will insert a (dead) test against true at |
442 // the actual bailout target from the optimized code. If not | 437 // the actual bailout target from the optimized code. If not |
443 // should_normalize, the true and false labels are ignored. | 438 // should_normalize, the true and false labels are ignored. |
444 void PrepareForBailoutBeforeSplit(Expression* expr, | 439 void PrepareForBailoutBeforeSplit(Expression* expr, |
(...skipping 146 matching lines...) Loading... |
591 // Helper functions for generating inlined smi code for certain | 586 // Helper functions for generating inlined smi code for certain |
592 // binary operations. | 587 // binary operations. |
593 void EmitInlineSmiBinaryOp(BinaryOperation* expr, | 588 void EmitInlineSmiBinaryOp(BinaryOperation* expr, |
594 Token::Value op, | 589 Token::Value op, |
595 Expression* left, | 590 Expression* left, |
596 Expression* right); | 591 Expression* right); |
597 | 592 |
598 // Assign to the given expression as if via '='. The right-hand-side value | 593 // Assign to the given expression as if via '='. The right-hand-side value |
599 // is expected in the accumulator. slot is only used if FLAG_vector_stores | 594 // is expected in the accumulator. slot is only used if FLAG_vector_stores |
600 // is true. | 595 // is true. |
601 void EmitAssignment(Expression* expr, FeedbackVectorICSlot slot); | 596 void EmitAssignment(Expression* expr, FeedbackVectorSlot slot); |
602 | 597 |
603 // Complete a variable assignment. The right-hand-side value is expected | 598 // Complete a variable assignment. The right-hand-side value is expected |
604 // in the accumulator. | 599 // in the accumulator. |
605 void EmitVariableAssignment(Variable* var, Token::Value op, | 600 void EmitVariableAssignment(Variable* var, Token::Value op, |
606 FeedbackVectorICSlot slot); | 601 FeedbackVectorSlot slot); |
607 | 602 |
608 // Helper functions to EmitVariableAssignment | 603 // Helper functions to EmitVariableAssignment |
609 void EmitStoreToStackLocalOrContextSlot(Variable* var, | 604 void EmitStoreToStackLocalOrContextSlot(Variable* var, |
610 MemOperand location); | 605 MemOperand location); |
611 | 606 |
612 // Complete a named property assignment. The receiver is expected on top | 607 // Complete a named property assignment. The receiver is expected on top |
613 // of the stack and the right-hand-side value in the accumulator. | 608 // of the stack and the right-hand-side value in the accumulator. |
614 void EmitNamedPropertyAssignment(Assignment* expr); | 609 void EmitNamedPropertyAssignment(Assignment* expr); |
615 | 610 |
616 // Complete a super named property assignment. The right-hand-side value | 611 // Complete a super named property assignment. The right-hand-side value |
(...skipping 10 matching lines...) Loading... |
627 void EmitKeyedPropertyAssignment(Assignment* expr); | 622 void EmitKeyedPropertyAssignment(Assignment* expr); |
628 | 623 |
629 static bool NeedsHomeObject(Expression* expr) { | 624 static bool NeedsHomeObject(Expression* expr) { |
630 return FunctionLiteral::NeedsHomeObject(expr); | 625 return FunctionLiteral::NeedsHomeObject(expr); |
631 } | 626 } |
632 | 627 |
633 // Adds the [[HomeObject]] to |initializer| if it is a FunctionLiteral. | 628 // Adds the [[HomeObject]] to |initializer| if it is a FunctionLiteral. |
634 // The value of the initializer is expected to be at the top of the stack. | 629 // The value of the initializer is expected to be at the top of the stack. |
635 // |offset| is the offset in the stack where the home object can be found. | 630 // |offset| is the offset in the stack where the home object can be found. |
636 void EmitSetHomeObject(Expression* initializer, int offset, | 631 void EmitSetHomeObject(Expression* initializer, int offset, |
637 FeedbackVectorICSlot slot); | 632 FeedbackVectorSlot slot); |
638 | 633 |
639 void EmitSetHomeObjectAccumulator(Expression* initializer, int offset, | 634 void EmitSetHomeObjectAccumulator(Expression* initializer, int offset, |
640 FeedbackVectorICSlot slot); | 635 FeedbackVectorSlot slot); |
641 | 636 |
642 void EmitLoadSuperConstructor(SuperCallReference* super_call_ref); | 637 void EmitLoadSuperConstructor(SuperCallReference* super_call_ref); |
643 | 638 |
644 void CallIC(Handle<Code> code, | 639 void CallIC(Handle<Code> code, |
645 TypeFeedbackId id = TypeFeedbackId::None()); | 640 TypeFeedbackId id = TypeFeedbackId::None()); |
646 | 641 |
647 // Inside typeof reference errors are never thrown. | 642 // Inside typeof reference errors are never thrown. |
648 void CallLoadIC(TypeofMode typeof_mode, LanguageMode language_mode = SLOPPY, | 643 void CallLoadIC(TypeofMode typeof_mode, LanguageMode language_mode = SLOPPY, |
649 TypeFeedbackId id = TypeFeedbackId::None()); | 644 TypeFeedbackId id = TypeFeedbackId::None()); |
650 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None()); | 645 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None()); |
(...skipping 78 matching lines...) Loading... |
729 void VisitForTypeofValue(Expression* expr); | 724 void VisitForTypeofValue(Expression* expr); |
730 | 725 |
731 void Generate(); | 726 void Generate(); |
732 void PopulateDeoptimizationData(Handle<Code> code); | 727 void PopulateDeoptimizationData(Handle<Code> code); |
733 void PopulateTypeFeedbackInfo(Handle<Code> code); | 728 void PopulateTypeFeedbackInfo(Handle<Code> code); |
734 void PopulateHandlerTable(Handle<Code> code); | 729 void PopulateHandlerTable(Handle<Code> code); |
735 | 730 |
736 bool MustCreateObjectLiteralWithRuntime(ObjectLiteral* expr) const; | 731 bool MustCreateObjectLiteralWithRuntime(ObjectLiteral* expr) const; |
737 bool MustCreateArrayLiteralWithRuntime(ArrayLiteral* expr) const; | 732 bool MustCreateArrayLiteralWithRuntime(ArrayLiteral* expr) const; |
738 | 733 |
739 void EmitLoadStoreICSlot(FeedbackVectorICSlot slot); | 734 void EmitLoadStoreICSlot(FeedbackVectorSlot slot); |
740 | 735 |
741 int NewHandlerTableEntry(); | 736 int NewHandlerTableEntry(); |
742 | 737 |
743 struct BailoutEntry { | 738 struct BailoutEntry { |
744 BailoutId id; | 739 BailoutId id; |
745 unsigned pc_and_state; | 740 unsigned pc_and_state; |
746 }; | 741 }; |
747 | 742 |
748 struct BackEdgeEntry { | 743 struct BackEdgeEntry { |
749 BailoutId id; | 744 BailoutId id; |
(...skipping 328 matching lines...) Loading... |
1078 Address start_; | 1073 Address start_; |
1079 Address instruction_start_; | 1074 Address instruction_start_; |
1080 uint32_t length_; | 1075 uint32_t length_; |
1081 }; | 1076 }; |
1082 | 1077 |
1083 | 1078 |
1084 } // namespace internal | 1079 } // namespace internal |
1085 } // namespace v8 | 1080 } // namespace v8 |
1086 | 1081 |
1087 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1082 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
OLD | NEW |