Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: src/full-codegen.h

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/frames-inl.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 info_(info), 89 info_(info),
90 scope_(info->scope()), 90 scope_(info->scope()),
91 nesting_stack_(NULL), 91 nesting_stack_(NULL),
92 loop_depth_(0), 92 loop_depth_(0),
93 globals_(NULL), 93 globals_(NULL),
94 context_(NULL), 94 context_(NULL),
95 bailout_entries_(info->HasDeoptimizationSupport() 95 bailout_entries_(info->HasDeoptimizationSupport()
96 ? info->function()->ast_node_count() : 0, 96 ? info->function()->ast_node_count() : 0,
97 info->zone()), 97 info->zone()),
98 back_edges_(2, info->zone()), 98 back_edges_(2, info->zone()),
99 type_feedback_cells_(info->HasDeoptimizationSupport()
100 ? info->function()->ast_node_count() : 0,
101 info->zone()),
99 ic_total_count_(0) { 102 ic_total_count_(0) {
100 Initialize(); 103 Initialize();
101 } 104 }
102 105
103 void Initialize(); 106 void Initialize();
104 107
105 static bool MakeCode(CompilationInfo* info); 108 static bool MakeCode(CompilationInfo* info);
106 109
107 // Encode state and pc-offset as a BitField<type, start, size>. 110 // Encode state and pc-offset as a BitField<type, start, size>.
108 // Only use 30 bits because we encode the result as a smi. 111 // Only use 30 bits because we encode the result as a smi.
(...skipping 11 matching lines...) Expand all
120 123
121 static const int kMaxBackEdgeWeight = 127; 124 static const int kMaxBackEdgeWeight = 127;
122 125
123 // Platform-specific code size multiplier. 126 // Platform-specific code size multiplier.
124 #if V8_TARGET_ARCH_IA32 127 #if V8_TARGET_ARCH_IA32
125 static const int kCodeSizeMultiplier = 100; 128 static const int kCodeSizeMultiplier = 100;
126 #elif V8_TARGET_ARCH_X64 129 #elif V8_TARGET_ARCH_X64
127 static const int kCodeSizeMultiplier = 162; 130 static const int kCodeSizeMultiplier = 162;
128 #elif V8_TARGET_ARCH_ARM 131 #elif V8_TARGET_ARCH_ARM
129 static const int kCodeSizeMultiplier = 142; 132 static const int kCodeSizeMultiplier = 142;
130 #elif V8_TARGET_ARCH_A64
131 // TODO(all): Copied ARM value. Check this is sensible for A64.
132 static const int kCodeSizeMultiplier = 142;
133 #elif V8_TARGET_ARCH_MIPS 133 #elif V8_TARGET_ARCH_MIPS
134 static const int kCodeSizeMultiplier = 142; 134 static const int kCodeSizeMultiplier = 142;
135 #else 135 #else
136 #error Unsupported target architecture. 136 #error Unsupported target architecture.
137 #endif 137 #endif
138 138
139 private: 139 private:
140 class Breakable; 140 class Breakable;
141 class Iteration; 141 class Iteration;
142 142
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 427
428 // Platform-specific code for equality comparison with a nil-like value. 428 // Platform-specific code for equality comparison with a nil-like value.
429 void EmitLiteralCompareNil(CompareOperation* expr, 429 void EmitLiteralCompareNil(CompareOperation* expr,
430 Expression* sub_expr, 430 Expression* sub_expr,
431 NilValue nil); 431 NilValue nil);
432 432
433 // Bailout support. 433 // Bailout support.
434 void PrepareForBailout(Expression* node, State state); 434 void PrepareForBailout(Expression* node, State state);
435 void PrepareForBailoutForId(BailoutId id, State state); 435 void PrepareForBailoutForId(BailoutId id, State state);
436 436
437 // Feedback slot support. The feedback vector will be cleared during gc and 437 // Cache cell support. This associates AST ids with global property cells
438 // collected by the type-feedback oracle. 438 // that will be cleared during GC and collected by the type-feedback oracle.
439 Handle<FixedArray> FeedbackVector() { 439 void RecordTypeFeedbackCell(TypeFeedbackId id, Handle<Cell> cell);
440 return feedback_vector_;
441 }
442 void StoreFeedbackVectorSlot(int slot, Handle<Object> object) {
443 feedback_vector_->set(slot, *object);
444 }
445 void InitializeFeedbackVector();
446 440
447 // Record a call's return site offset, used to rebuild the frame if the 441 // Record a call's return site offset, used to rebuild the frame if the
448 // called function was inlined at the site. 442 // called function was inlined at the site.
449 void RecordJSReturnSite(Call* call); 443 void RecordJSReturnSite(Call* call);
450 444
451 // Prepare for bailout before a test (or compare) and branch. If 445 // Prepare for bailout before a test (or compare) and branch. If
452 // should_normalize, then the following comparison will not handle the 446 // should_normalize, then the following comparison will not handle the
453 // canonical JS true value so we will insert a (dead) test against true at 447 // canonical JS true value so we will insert a (dead) test against true at
454 // the actual bailout target from the optimized code. If not 448 // the actual bailout target from the optimized code. If not
455 // should_normalize, the true and false labels are ignored. 449 // should_normalize, the true and false labels are ignored.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 545
552 // Assign to the given expression as if via '='. The right-hand-side value 546 // Assign to the given expression as if via '='. The right-hand-side value
553 // is expected in the accumulator. 547 // is expected in the accumulator.
554 void EmitAssignment(Expression* expr); 548 void EmitAssignment(Expression* expr);
555 549
556 // Complete a variable assignment. The right-hand-side value is expected 550 // Complete a variable assignment. The right-hand-side value is expected
557 // in the accumulator. 551 // in the accumulator.
558 void EmitVariableAssignment(Variable* var, 552 void EmitVariableAssignment(Variable* var,
559 Token::Value op); 553 Token::Value op);
560 554
561 // Helper functions to EmitVariableAssignment
562 void EmitStoreToStackLocalOrContextSlot(Variable* var,
563 MemOperand location);
564 void EmitCallStoreContextSlot(Handle<String> name, LanguageMode mode);
565
566 // Complete a named property assignment. The receiver is expected on top 555 // Complete a named property assignment. The receiver is expected on top
567 // of the stack and the right-hand-side value in the accumulator. 556 // of the stack and the right-hand-side value in the accumulator.
568 void EmitNamedPropertyAssignment(Assignment* expr); 557 void EmitNamedPropertyAssignment(Assignment* expr);
569 558
570 // Complete a keyed property assignment. The receiver and key are 559 // Complete a keyed property assignment. The receiver and key are
571 // expected on top of the stack and the right-hand-side value in the 560 // expected on top of the stack and the right-hand-side value in the
572 // accumulator. 561 // accumulator.
573 void EmitKeyedPropertyAssignment(Assignment* expr); 562 void EmitKeyedPropertyAssignment(Assignment* expr);
574 563
575 void CallIC(Handle<Code> code, 564 void CallIC(Handle<Code> code,
565 ContextualMode mode = NOT_CONTEXTUAL,
576 TypeFeedbackId id = TypeFeedbackId::None()); 566 TypeFeedbackId id = TypeFeedbackId::None());
577 567
578 void CallLoadIC(ContextualMode mode, 568 void CallLoadIC(ContextualMode mode,
579 TypeFeedbackId id = TypeFeedbackId::None()); 569 TypeFeedbackId id = TypeFeedbackId::None());
580 void CallStoreIC(TypeFeedbackId id = TypeFeedbackId::None()); 570 void CallStoreIC(ContextualMode mode,
571 TypeFeedbackId id = TypeFeedbackId::None());
581 572
582 void SetFunctionPosition(FunctionLiteral* fun); 573 void SetFunctionPosition(FunctionLiteral* fun);
583 void SetReturnPosition(FunctionLiteral* fun); 574 void SetReturnPosition(FunctionLiteral* fun);
584 void SetStatementPosition(Statement* stmt); 575 void SetStatementPosition(Statement* stmt);
585 void SetExpressionPosition(Expression* expr); 576 void SetExpressionPosition(Expression* expr);
586 void SetStatementPosition(int pos); 577 void SetStatementPosition(int pos);
587 void SetSourcePosition(int pos); 578 void SetSourcePosition(int pos);
588 579
589 // Non-local control flow support. 580 // Non-local control flow support.
590 void EnterFinallyBlock(); 581 void EnterFinallyBlock();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 628
638 void VisitComma(BinaryOperation* expr); 629 void VisitComma(BinaryOperation* expr);
639 void VisitLogicalExpression(BinaryOperation* expr); 630 void VisitLogicalExpression(BinaryOperation* expr);
640 void VisitArithmeticExpression(BinaryOperation* expr); 631 void VisitArithmeticExpression(BinaryOperation* expr);
641 632
642 void VisitForTypeofValue(Expression* expr); 633 void VisitForTypeofValue(Expression* expr);
643 634
644 void Generate(); 635 void Generate();
645 void PopulateDeoptimizationData(Handle<Code> code); 636 void PopulateDeoptimizationData(Handle<Code> code);
646 void PopulateTypeFeedbackInfo(Handle<Code> code); 637 void PopulateTypeFeedbackInfo(Handle<Code> code);
638 void PopulateTypeFeedbackCells(Handle<Code> code);
647 639
648 Handle<FixedArray> handler_table() { return handler_table_; } 640 Handle<FixedArray> handler_table() { return handler_table_; }
649 641
650 struct BailoutEntry { 642 struct BailoutEntry {
651 BailoutId id; 643 BailoutId id;
652 unsigned pc_and_state; 644 unsigned pc_and_state;
653 }; 645 };
654 646
655 struct BackEdgeEntry { 647 struct BackEdgeEntry {
656 BailoutId id; 648 BailoutId id;
657 unsigned pc; 649 unsigned pc;
658 uint32_t loop_depth; 650 uint32_t loop_depth;
659 }; 651 };
660 652
653 struct TypeFeedbackCellEntry {
654 TypeFeedbackId ast_id;
655 Handle<Cell> cell;
656 };
657
658
661 class ExpressionContext BASE_EMBEDDED { 659 class ExpressionContext BASE_EMBEDDED {
662 public: 660 public:
663 explicit ExpressionContext(FullCodeGenerator* codegen) 661 explicit ExpressionContext(FullCodeGenerator* codegen)
664 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { 662 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
665 codegen->set_new_context(this); 663 codegen->set_new_context(this);
666 } 664 }
667 665
668 virtual ~ExpressionContext() { 666 virtual ~ExpressionContext() {
669 codegen_->set_new_context(old_); 667 codegen_->set_new_context(old_);
670 } 668 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 Label return_label_; 838 Label return_label_;
841 NestedStatement* nesting_stack_; 839 NestedStatement* nesting_stack_;
842 int loop_depth_; 840 int loop_depth_;
843 ZoneList<Handle<Object> >* globals_; 841 ZoneList<Handle<Object> >* globals_;
844 Handle<FixedArray> modules_; 842 Handle<FixedArray> modules_;
845 int module_index_; 843 int module_index_;
846 const ExpressionContext* context_; 844 const ExpressionContext* context_;
847 ZoneList<BailoutEntry> bailout_entries_; 845 ZoneList<BailoutEntry> bailout_entries_;
848 GrowableBitVector prepared_bailout_ids_; 846 GrowableBitVector prepared_bailout_ids_;
849 ZoneList<BackEdgeEntry> back_edges_; 847 ZoneList<BackEdgeEntry> back_edges_;
848 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_;
850 int ic_total_count_; 849 int ic_total_count_;
851 Handle<FixedArray> handler_table_; 850 Handle<FixedArray> handler_table_;
852 Handle<FixedArray> feedback_vector_;
853 Handle<Cell> profiling_counter_; 851 Handle<Cell> profiling_counter_;
854 bool generate_debug_code_; 852 bool generate_debug_code_;
855 853
856 friend class NestedStatement; 854 friend class NestedStatement;
857 855
858 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 856 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
859 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 857 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
860 }; 858 };
861 859
862 860
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 963
966 Address start_; 964 Address start_;
967 Address instruction_start_; 965 Address instruction_start_;
968 uint32_t length_; 966 uint32_t length_;
969 }; 967 };
970 968
971 969
972 } } // namespace v8::internal 970 } } // namespace v8::internal
973 971
974 #endif // V8_FULL_CODEGEN_H_ 972 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/frames-inl.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698