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

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

Issue 8932004: Implement target cache for constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 8 years, 11 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 }; 78 };
79 79
80 explicit FullCodeGenerator(MacroAssembler* masm) 80 explicit FullCodeGenerator(MacroAssembler* masm)
81 : masm_(masm), 81 : masm_(masm),
82 info_(NULL), 82 info_(NULL),
83 scope_(NULL), 83 scope_(NULL),
84 nesting_stack_(NULL), 84 nesting_stack_(NULL),
85 loop_depth_(0), 85 loop_depth_(0),
86 context_(NULL), 86 context_(NULL),
87 bailout_entries_(0), 87 bailout_entries_(0),
88 stack_checks_(2) { // There's always at least one. 88 stack_checks_(2), // There's always at least one.
89 type_feedback_cells_(0) {
89 } 90 }
90 91
91 static bool MakeCode(CompilationInfo* info); 92 static bool MakeCode(CompilationInfo* info);
92 93
93 void Generate(CompilationInfo* info); 94 void Generate(CompilationInfo* info);
94 void PopulateDeoptimizationData(Handle<Code> code); 95 void PopulateDeoptimizationData(Handle<Code> code);
96 void PopulateTypeFeedbackCells(Handle<Code> code);
95 97
96 Handle<FixedArray> handler_table() { return handler_table_; } 98 Handle<FixedArray> handler_table() { return handler_table_; }
97 99
98 class StateField : public BitField<State, 0, 8> { }; 100 class StateField : public BitField<State, 0, 8> { };
99 class PcField : public BitField<unsigned, 8, 32-8> { }; 101 class PcField : public BitField<unsigned, 8, 32-8> { };
100 102
101 static const char* State2String(State state) { 103 static const char* State2String(State state) {
102 switch (state) { 104 switch (state) {
103 case NO_REGISTERS: return "NO_REGISTERS"; 105 case NO_REGISTERS: return "NO_REGISTERS";
104 case TOS_REG: return "TOS_REG"; 106 case TOS_REG: return "TOS_REG";
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 387
386 // Platform-specific code for equality comparison with a nil-like value. 388 // Platform-specific code for equality comparison with a nil-like value.
387 void EmitLiteralCompareNil(CompareOperation* expr, 389 void EmitLiteralCompareNil(CompareOperation* expr,
388 Expression* sub_expr, 390 Expression* sub_expr,
389 NilValue nil); 391 NilValue nil);
390 392
391 // Bailout support. 393 // Bailout support.
392 void PrepareForBailout(Expression* node, State state); 394 void PrepareForBailout(Expression* node, State state);
393 void PrepareForBailoutForId(unsigned id, State state); 395 void PrepareForBailoutForId(unsigned id, State state);
394 396
397 // Cache cell support. This associates AST ids with global property cells
398 // that will be cleared during GC and collected by the type-feedback oracle.
399 void RecordTypeFeedbackCell(unsigned id, Handle<JSGlobalPropertyCell> cell);
400
395 // Record a call's return site offset, used to rebuild the frame if the 401 // Record a call's return site offset, used to rebuild the frame if the
396 // called function was inlined at the site. 402 // called function was inlined at the site.
397 void RecordJSReturnSite(Call* call); 403 void RecordJSReturnSite(Call* call);
398 404
399 // Prepare for bailout before a test (or compare) and branch. If 405 // Prepare for bailout before a test (or compare) and branch. If
400 // should_normalize, then the following comparison will not handle the 406 // should_normalize, then the following comparison will not handle the
401 // canonical JS true value so we will insert a (dead) test against true at 407 // canonical JS true value so we will insert a (dead) test against true at
402 // the actual bailout target from the optimized code. If not 408 // the actual bailout target from the optimized code. If not
403 // should_normalize, the true and false labels are ignored. 409 // should_normalize, the true and false labels are ignored.
404 void PrepareForBailoutBeforeSplit(Expression* expr, 410 void PrepareForBailoutBeforeSplit(Expression* expr,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 void VisitLogicalExpression(BinaryOperation* expr); 570 void VisitLogicalExpression(BinaryOperation* expr);
565 void VisitArithmeticExpression(BinaryOperation* expr); 571 void VisitArithmeticExpression(BinaryOperation* expr);
566 572
567 void VisitForTypeofValue(Expression* expr); 573 void VisitForTypeofValue(Expression* expr);
568 574
569 struct BailoutEntry { 575 struct BailoutEntry {
570 unsigned id; 576 unsigned id;
571 unsigned pc_and_state; 577 unsigned pc_and_state;
572 }; 578 };
573 579
580 struct TypeFeedbackCellEntry {
581 unsigned ast_id;
582 Handle<JSGlobalPropertyCell> cell;
583 };
584
574 585
575 class ExpressionContext BASE_EMBEDDED { 586 class ExpressionContext BASE_EMBEDDED {
576 public: 587 public:
577 explicit ExpressionContext(FullCodeGenerator* codegen) 588 explicit ExpressionContext(FullCodeGenerator* codegen)
578 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { 589 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
579 codegen->set_new_context(this); 590 codegen->set_new_context(this);
580 } 591 }
581 592
582 virtual ~ExpressionContext() { 593 virtual ~ExpressionContext() {
583 codegen_->set_new_context(old_); 594 codegen_->set_new_context(old_);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 761
751 MacroAssembler* masm_; 762 MacroAssembler* masm_;
752 CompilationInfo* info_; 763 CompilationInfo* info_;
753 Scope* scope_; 764 Scope* scope_;
754 Label return_label_; 765 Label return_label_;
755 NestedStatement* nesting_stack_; 766 NestedStatement* nesting_stack_;
756 int loop_depth_; 767 int loop_depth_;
757 const ExpressionContext* context_; 768 const ExpressionContext* context_;
758 ZoneList<BailoutEntry> bailout_entries_; 769 ZoneList<BailoutEntry> bailout_entries_;
759 ZoneList<BailoutEntry> stack_checks_; 770 ZoneList<BailoutEntry> stack_checks_;
771 ZoneList<TypeFeedbackCellEntry> type_feedback_cells_;
760 Handle<FixedArray> handler_table_; 772 Handle<FixedArray> handler_table_;
761 773
762 friend class NestedStatement; 774 friend class NestedStatement;
763 775
764 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 776 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
765 }; 777 };
766 778
767 779
768 } } // namespace v8::internal 780 } } // namespace v8::internal
769 781
770 #endif // V8_FULL_CODEGEN_H_ 782 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/full-codegen.cc » ('j') | src/type-info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698