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

Side by Side Diff: src/ast.cc

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 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/ast.h ('k') | src/basic-block-profiler.h » ('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 // 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 #include "src/ast.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 } 787 }
788 788
789 789
790 // Convert regular expression trees to a simple sexp representation. 790 // Convert regular expression trees to a simple sexp representation.
791 // This representation should be different from the input grammar 791 // This representation should be different from the input grammar
792 // in as many cases as possible, to make it more difficult for incorrect 792 // in as many cases as possible, to make it more difficult for incorrect
793 // parses to look as correct ones which is likely if the input and 793 // parses to look as correct ones which is likely if the input and
794 // output formats are alike. 794 // output formats are alike.
795 class RegExpUnparser FINAL : public RegExpVisitor { 795 class RegExpUnparser FINAL : public RegExpVisitor {
796 public: 796 public:
797 RegExpUnparser(OStream& os, Zone* zone) : os_(os), zone_(zone) {} 797 RegExpUnparser(std::ostream& os, Zone* zone) : os_(os), zone_(zone) {}
798 void VisitCharacterRange(CharacterRange that); 798 void VisitCharacterRange(CharacterRange that);
799 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \ 799 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \
800 void* data) OVERRIDE; 800 void* data) OVERRIDE;
801 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) 801 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
802 #undef MAKE_CASE 802 #undef MAKE_CASE
803 private: 803 private:
804 OStream& os_; 804 std::ostream& os_;
805 Zone* zone_; 805 Zone* zone_;
806 }; 806 };
807 807
808 808
809 void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { 809 void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) {
810 os_ << "(|"; 810 os_ << "(|";
811 for (int i = 0; i < that->alternatives()->length(); i++) { 811 for (int i = 0; i < that->alternatives()->length(); i++) {
812 os_ << " "; 812 os_ << " ";
813 that->alternatives()->at(i)->Accept(this, data); 813 that->alternatives()->at(i)->Accept(this, data);
814 } 814 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 return NULL; 937 return NULL;
938 } 938 }
939 939
940 940
941 void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) { 941 void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) {
942 os_ << '%'; 942 os_ << '%';
943 return NULL; 943 return NULL;
944 } 944 }
945 945
946 946
947 OStream& RegExpTree::Print(OStream& os, Zone* zone) { // NOLINT 947 std::ostream& RegExpTree::Print(std::ostream& os, Zone* zone) { // NOLINT
948 RegExpUnparser unparser(os, zone); 948 RegExpUnparser unparser(os, zone);
949 Accept(&unparser, NULL); 949 Accept(&unparser, NULL);
950 return os; 950 return os;
951 } 951 }
952 952
953 953
954 RegExpDisjunction::RegExpDisjunction(ZoneList<RegExpTree*>* alternatives) 954 RegExpDisjunction::RegExpDisjunction(ZoneList<RegExpTree*>* alternatives)
955 : alternatives_(alternatives) { 955 : alternatives_(alternatives) {
956 DCHECK(alternatives->length() > 1); 956 DCHECK(alternatives->length() > 1);
957 RegExpTree* first_alternative = alternatives->at(0); 957 RegExpTree* first_alternative = alternatives->at(0);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); 1137 SNPrintF(buffer, "%d", Smi::cast(*value())->value());
1138 str = arr; 1138 str = arr;
1139 } else { 1139 } else {
1140 str = DoubleToCString(value()->Number(), buffer); 1140 str = DoubleToCString(value()->Number(), buffer);
1141 } 1141 }
1142 return isolate_->factory()->NewStringFromAsciiChecked(str); 1142 return isolate_->factory()->NewStringFromAsciiChecked(str);
1143 } 1143 }
1144 1144
1145 1145
1146 } } // namespace v8::internal 1146 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/basic-block-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698