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

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

Issue 6542061: [Isolates] Less TLS reads in parser and full codegens. (Closed)
Patch Set: Created 9 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
« no previous file with comments | « src/arm/full-codegen-arm.cc ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Full code generator. 67 // Full code generator.
68 68
69 class FullCodeGenerator: public AstVisitor { 69 class FullCodeGenerator: public AstVisitor {
70 public: 70 public:
71 enum State { 71 enum State {
72 NO_REGISTERS, 72 NO_REGISTERS,
73 TOS_REG 73 TOS_REG
74 }; 74 };
75 75
76 explicit FullCodeGenerator(MacroAssembler* masm) 76 explicit FullCodeGenerator(MacroAssembler* masm)
77 : masm_(masm), 77 : isolate_(Isolate::Current()),
78 masm_(masm),
78 info_(NULL), 79 info_(NULL),
79 nesting_stack_(NULL), 80 nesting_stack_(NULL),
80 loop_depth_(0), 81 loop_depth_(0),
81 context_(NULL), 82 context_(NULL),
82 bailout_entries_(0), 83 bailout_entries_(0),
83 stack_checks_(2), // There's always at least one. 84 stack_checks_(2), // There's always at least one.
84 forward_bailout_stack_(NULL), 85 forward_bailout_stack_(NULL),
85 forward_bailout_pending_(NULL) { 86 forward_bailout_pending_(NULL) {
86 } 87 }
87 88
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void ExitFinallyBlock(); 510 void ExitFinallyBlock();
510 511
511 // Loop nesting counter. 512 // Loop nesting counter.
512 int loop_depth() { return loop_depth_; } 513 int loop_depth() { return loop_depth_; }
513 void increment_loop_depth() { loop_depth_++; } 514 void increment_loop_depth() { loop_depth_++; }
514 void decrement_loop_depth() { 515 void decrement_loop_depth() {
515 ASSERT(loop_depth_ > 0); 516 ASSERT(loop_depth_ > 0);
516 loop_depth_--; 517 loop_depth_--;
517 } 518 }
518 519
520 Isolate* isolate() { return isolate_; }
519 MacroAssembler* masm() { return masm_; } 521 MacroAssembler* masm() { return masm_; }
520 522
521 class ExpressionContext; 523 class ExpressionContext;
522 const ExpressionContext* context() { return context_; } 524 const ExpressionContext* context() { return context_; }
523 void set_new_context(const ExpressionContext* context) { context_ = context; } 525 void set_new_context(const ExpressionContext* context) { context_ = context; }
524 526
525 Handle<Script> script() { return info_->script(); } 527 Handle<Script> script() { return info_->script(); }
526 bool is_eval() { return info_->is_eval(); } 528 bool is_eval() { return info_->is_eval(); }
527 FunctionLiteral* function() { return info_->function(); } 529 FunctionLiteral* function() { return info_->function(); }
528 Scope* scope() { return info_->scope(); } 530 Scope* scope() { return info_->scope(); }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 public: 562 public:
561 explicit ExpressionContext(FullCodeGenerator* codegen) 563 explicit ExpressionContext(FullCodeGenerator* codegen)
562 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { 564 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
563 codegen->set_new_context(this); 565 codegen->set_new_context(this);
564 } 566 }
565 567
566 virtual ~ExpressionContext() { 568 virtual ~ExpressionContext() {
567 codegen_->set_new_context(old_); 569 codegen_->set_new_context(old_);
568 } 570 }
569 571
572 Isolate* isolate() const { return codegen_->isolate(); }
573
570 // Convert constant control flow (true or false) to the result expected for 574 // Convert constant control flow (true or false) to the result expected for
571 // this expression context. 575 // this expression context.
572 virtual void Plug(bool flag) const = 0; 576 virtual void Plug(bool flag) const = 0;
573 577
574 // Emit code to convert a pure value (in a register, slot, as a literal, 578 // Emit code to convert a pure value (in a register, slot, as a literal,
575 // or on top of the stack) into the result expected according to this 579 // or on top of the stack) into the result expected according to this
576 // expression context. 580 // expression context.
577 virtual void Plug(Register reg) const = 0; 581 virtual void Plug(Register reg) const = 0;
578 virtual void Plug(Slot* slot) const = 0; 582 virtual void Plug(Slot* slot) const = 0;
579 virtual void Plug(Handle<Object> lit) const = 0; 583 virtual void Plug(Handle<Object> lit) const = 0;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 Label* done) const; 740 Label* done) const;
737 virtual void PrepareTest(Label* materialize_true, 741 virtual void PrepareTest(Label* materialize_true,
738 Label* materialize_false, 742 Label* materialize_false,
739 Label** if_true, 743 Label** if_true,
740 Label** if_false, 744 Label** if_false,
741 Label** fall_through) const; 745 Label** fall_through) const;
742 virtual void HandleExpression(Expression* expr) const; 746 virtual void HandleExpression(Expression* expr) const;
743 virtual bool IsEffect() const { return true; } 747 virtual bool IsEffect() const { return true; }
744 }; 748 };
745 749
750 Isolate* isolate_;
746 MacroAssembler* masm_; 751 MacroAssembler* masm_;
747 CompilationInfo* info_; 752 CompilationInfo* info_;
748 Label return_label_; 753 Label return_label_;
749 NestedStatement* nesting_stack_; 754 NestedStatement* nesting_stack_;
750 int loop_depth_; 755 int loop_depth_;
751 const ExpressionContext* context_; 756 const ExpressionContext* context_;
752 ZoneList<BailoutEntry> bailout_entries_; 757 ZoneList<BailoutEntry> bailout_entries_;
753 ZoneList<BailoutEntry> stack_checks_; 758 ZoneList<BailoutEntry> stack_checks_;
754 ForwardBailoutStack* forward_bailout_stack_; 759 ForwardBailoutStack* forward_bailout_stack_;
755 ForwardBailoutStack* forward_bailout_pending_; 760 ForwardBailoutStack* forward_bailout_pending_;
756 761
757 friend class NestedStatement; 762 friend class NestedStatement;
758 763
759 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 764 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
760 }; 765 };
761 766
762 767
763 } } // namespace v8::internal 768 } } // namespace v8::internal
764 769
765 #endif // V8_FULL_CODEGEN_H_ 770 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698