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

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

Issue 7172030: Revert "Merge arguments branch to bleeding merge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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/factory.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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return NULL; 106 return NULL;
107 } 107 }
108 108
109 private: 109 private:
110 class Breakable; 110 class Breakable;
111 class Iteration; 111 class Iteration;
112 class TryCatch; 112 class TryCatch;
113 class TryFinally; 113 class TryFinally;
114 class Finally; 114 class Finally;
115 class ForIn; 115 class ForIn;
116 class TestContext;
116 117
117 class NestedStatement BASE_EMBEDDED { 118 class NestedStatement BASE_EMBEDDED {
118 public: 119 public:
119 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) { 120 explicit NestedStatement(FullCodeGenerator* codegen) : codegen_(codegen) {
120 // Link into codegen's nesting stack. 121 // Link into codegen's nesting stack.
121 previous_ = codegen->nesting_stack_; 122 previous_ = codegen->nesting_stack_;
122 codegen->nesting_stack_ = this; 123 codegen->nesting_stack_ = this;
123 } 124 }
124 virtual ~NestedStatement() { 125 virtual ~NestedStatement() {
125 // Unlink from codegen's nesting stack. 126 // Unlink from codegen's nesting stack.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // parameter slot. 292 // parameter slot.
292 int SlotOffset(Slot* slot); 293 int SlotOffset(Slot* slot);
293 294
294 // Determine whether or not to inline the smi case for the given 295 // Determine whether or not to inline the smi case for the given
295 // operation. 296 // operation.
296 bool ShouldInlineSmiCase(Token::Value op); 297 bool ShouldInlineSmiCase(Token::Value op);
297 298
298 // Helper function to convert a pure value into a test context. The value 299 // Helper function to convert a pure value into a test context. The value
299 // is expected on the stack or the accumulator, depending on the platform. 300 // is expected on the stack or the accumulator, depending on the platform.
300 // See the platform-specific implementation for details. 301 // See the platform-specific implementation for details.
301 void DoTest(Label* if_true, Label* if_false, Label* fall_through); 302 void DoTest(Expression* condition,
303 Label* if_true,
304 Label* if_false,
305 Label* fall_through);
306 void DoTest(const TestContext* context);
302 307
303 // Helper function to split control flow and avoid a branch to the 308 // Helper function to split control flow and avoid a branch to the
304 // fall-through label if it is set up. 309 // fall-through label if it is set up.
305 #ifdef V8_TARGET_ARCH_MIPS 310 #ifdef V8_TARGET_ARCH_MIPS
306 void Split(Condition cc, 311 void Split(Condition cc,
307 Register lhs, 312 Register lhs,
308 const Operand& rhs, 313 const Operand& rhs,
309 Label* if_true, 314 Label* if_true,
310 Label* if_false, 315 Label* if_false,
311 Label* fall_through); 316 Label* fall_through);
(...skipping 28 matching lines...) Expand all
340 345
341 void VisitForStackValue(Expression* expr) { 346 void VisitForStackValue(Expression* expr) {
342 StackValueContext context(this); 347 StackValueContext context(this);
343 VisitInCurrentContext(expr); 348 VisitInCurrentContext(expr);
344 } 349 }
345 350
346 void VisitForControl(Expression* expr, 351 void VisitForControl(Expression* expr,
347 Label* if_true, 352 Label* if_true,
348 Label* if_false, 353 Label* if_false,
349 Label* fall_through) { 354 Label* fall_through) {
350 TestContext context(this, if_true, if_false, fall_through); 355 TestContext context(this, expr, if_true, if_false, fall_through);
351 VisitInCurrentContext(expr); 356 VisitInCurrentContext(expr);
352 } 357 }
353 358
354 void VisitDeclarations(ZoneList<Declaration*>* declarations); 359 void VisitDeclarations(ZoneList<Declaration*>* declarations);
355 void DeclareGlobals(Handle<FixedArray> pairs); 360 void DeclareGlobals(Handle<FixedArray> pairs);
356 361
357 // Try to perform a comparison as a fast inlined literal compare if 362 // Try to perform a comparison as a fast inlined literal compare if
358 // the operands allow it. Returns true if the compare operations 363 // the operands allow it. Returns true if the compare operations
359 // has been matched and all code generated; false otherwise. 364 // has been matched and all code generated; false otherwise.
360 bool TryLiteralCompare(Token::Value op, 365 bool TryLiteralCompare(Token::Value op,
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 virtual void PrepareTest(Label* materialize_true, 668 virtual void PrepareTest(Label* materialize_true,
664 Label* materialize_false, 669 Label* materialize_false,
665 Label** if_true, 670 Label** if_true,
666 Label** if_false, 671 Label** if_false,
667 Label** fall_through) const; 672 Label** fall_through) const;
668 virtual bool IsStackValue() const { return true; } 673 virtual bool IsStackValue() const { return true; }
669 }; 674 };
670 675
671 class TestContext : public ExpressionContext { 676 class TestContext : public ExpressionContext {
672 public: 677 public:
673 explicit TestContext(FullCodeGenerator* codegen, 678 TestContext(FullCodeGenerator* codegen,
674 Label* true_label, 679 Expression* condition,
675 Label* false_label, 680 Label* true_label,
676 Label* fall_through) 681 Label* false_label,
682 Label* fall_through)
677 : ExpressionContext(codegen), 683 : ExpressionContext(codegen),
684 condition_(condition),
678 true_label_(true_label), 685 true_label_(true_label),
679 false_label_(false_label), 686 false_label_(false_label),
680 fall_through_(fall_through) { } 687 fall_through_(fall_through) { }
681 688
682 static const TestContext* cast(const ExpressionContext* context) { 689 static const TestContext* cast(const ExpressionContext* context) {
683 ASSERT(context->IsTest()); 690 ASSERT(context->IsTest());
684 return reinterpret_cast<const TestContext*>(context); 691 return reinterpret_cast<const TestContext*>(context);
685 } 692 }
686 693
694 Expression* condition() const { return condition_; }
687 Label* true_label() const { return true_label_; } 695 Label* true_label() const { return true_label_; }
688 Label* false_label() const { return false_label_; } 696 Label* false_label() const { return false_label_; }
689 Label* fall_through() const { return fall_through_; } 697 Label* fall_through() const { return fall_through_; }
690 698
691 virtual void Plug(bool flag) const; 699 virtual void Plug(bool flag) const;
692 virtual void Plug(Register reg) const; 700 virtual void Plug(Register reg) const;
693 virtual void Plug(Label* materialize_true, Label* materialize_false) const; 701 virtual void Plug(Label* materialize_true, Label* materialize_false) const;
694 virtual void Plug(Slot* slot) const; 702 virtual void Plug(Slot* slot) const;
695 virtual void Plug(Handle<Object> lit) const; 703 virtual void Plug(Handle<Object> lit) const;
696 virtual void Plug(Heap::RootListIndex) const; 704 virtual void Plug(Heap::RootListIndex) const;
697 virtual void PlugTOS() const; 705 virtual void PlugTOS() const;
698 virtual void DropAndPlug(int count, Register reg) const; 706 virtual void DropAndPlug(int count, Register reg) const;
699 virtual void PrepareTest(Label* materialize_true, 707 virtual void PrepareTest(Label* materialize_true,
700 Label* materialize_false, 708 Label* materialize_false,
701 Label** if_true, 709 Label** if_true,
702 Label** if_false, 710 Label** if_false,
703 Label** fall_through) const; 711 Label** fall_through) const;
704 virtual bool IsTest() const { return true; } 712 virtual bool IsTest() const { return true; }
705 713
706 private: 714 private:
715 Expression* condition_;
707 Label* true_label_; 716 Label* true_label_;
708 Label* false_label_; 717 Label* false_label_;
709 Label* fall_through_; 718 Label* fall_through_;
710 }; 719 };
711 720
712 class EffectContext : public ExpressionContext { 721 class EffectContext : public ExpressionContext {
713 public: 722 public:
714 explicit EffectContext(FullCodeGenerator* codegen) 723 explicit EffectContext(FullCodeGenerator* codegen)
715 : ExpressionContext(codegen) { } 724 : ExpressionContext(codegen) { }
716 725
(...skipping 26 matching lines...) Expand all
743 752
744 friend class NestedStatement; 753 friend class NestedStatement;
745 754
746 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 755 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
747 }; 756 };
748 757
749 758
750 } } // namespace v8::internal 759 } } // namespace v8::internal
751 760
752 #endif // V8_FULL_CODEGEN_H_ 761 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698