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

Side by Side Diff: src/ast.cc

Issue 1451373003: Revert of Experimental support for RegExp lookbehind. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/ast.h ('k') | src/bootstrapper.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 // 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 Interval RegExpAlternative::CaptureRegisters() { 843 Interval RegExpAlternative::CaptureRegisters() {
844 return ListCaptureRegisters(nodes()); 844 return ListCaptureRegisters(nodes());
845 } 845 }
846 846
847 847
848 Interval RegExpDisjunction::CaptureRegisters() { 848 Interval RegExpDisjunction::CaptureRegisters() {
849 return ListCaptureRegisters(alternatives()); 849 return ListCaptureRegisters(alternatives());
850 } 850 }
851 851
852 852
853 Interval RegExpLookaround::CaptureRegisters() { 853 Interval RegExpLookahead::CaptureRegisters() {
854 return body()->CaptureRegisters(); 854 return body()->CaptureRegisters();
855 } 855 }
856 856
857 857
858 Interval RegExpCapture::CaptureRegisters() { 858 Interval RegExpCapture::CaptureRegisters() {
859 Interval self(StartRegister(index()), EndRegister(index())); 859 Interval self(StartRegister(index()), EndRegister(index()));
860 return self.Union(body()->CaptureRegisters()); 860 return self.Union(body()->CaptureRegisters());
861 } 861 }
862 862
863 863
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 bool RegExpDisjunction::IsAnchoredAtEnd() { 911 bool RegExpDisjunction::IsAnchoredAtEnd() {
912 ZoneList<RegExpTree*>* alternatives = this->alternatives(); 912 ZoneList<RegExpTree*>* alternatives = this->alternatives();
913 for (int i = 0; i < alternatives->length(); i++) { 913 for (int i = 0; i < alternatives->length(); i++) {
914 if (!alternatives->at(i)->IsAnchoredAtEnd()) 914 if (!alternatives->at(i)->IsAnchoredAtEnd())
915 return false; 915 return false;
916 } 916 }
917 return true; 917 return true;
918 } 918 }
919 919
920 920
921 bool RegExpLookaround::IsAnchoredAtStart() { 921 bool RegExpLookahead::IsAnchoredAtStart() {
922 return is_positive() && type() == LOOKAHEAD && body()->IsAnchoredAtStart(); 922 return is_positive() && body()->IsAnchoredAtStart();
923 } 923 }
924 924
925 925
926 bool RegExpCapture::IsAnchoredAtStart() { 926 bool RegExpCapture::IsAnchoredAtStart() {
927 return body()->IsAnchoredAtStart(); 927 return body()->IsAnchoredAtStart();
928 } 928 }
929 929
930 930
931 bool RegExpCapture::IsAnchoredAtEnd() { 931 bool RegExpCapture::IsAnchoredAtEnd() {
932 return body()->IsAnchoredAtEnd(); 932 return body()->IsAnchoredAtEnd();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 1061
1062 1062
1063 void* RegExpUnparser::VisitCapture(RegExpCapture* that, void* data) { 1063 void* RegExpUnparser::VisitCapture(RegExpCapture* that, void* data) {
1064 os_ << "(^ "; 1064 os_ << "(^ ";
1065 that->body()->Accept(this, data); 1065 that->body()->Accept(this, data);
1066 os_ << ")"; 1066 os_ << ")";
1067 return NULL; 1067 return NULL;
1068 } 1068 }
1069 1069
1070 1070
1071 void* RegExpUnparser::VisitLookaround(RegExpLookaround* that, void* data) { 1071 void* RegExpUnparser::VisitLookahead(RegExpLookahead* that, void* data) {
1072 os_ << "("; 1072 os_ << "(-> " << (that->is_positive() ? "+ " : "- ");
1073 os_ << (that->type() == RegExpLookaround::LOOKAHEAD ? "->" : "<-");
1074 os_ << (that->is_positive() ? " + " : " - ");
1075 that->body()->Accept(this, data); 1073 that->body()->Accept(this, data);
1076 os_ << ")"; 1074 os_ << ")";
1077 return NULL; 1075 return NULL;
1078 } 1076 }
1079 1077
1080 1078
1081 void* RegExpUnparser::VisitBackReference(RegExpBackReference* that, 1079 void* RegExpUnparser::VisitBackReference(RegExpBackReference* that,
1082 void* data) { 1080 void* data) {
1083 os_ << "(<- " << that->index() << ")"; 1081 os_ << "(<- " << that->index() << ")";
1084 return NULL; 1082 return NULL;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 bool Literal::Match(void* literal1, void* literal2) { 1152 bool Literal::Match(void* literal1, void* literal2) {
1155 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1153 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1156 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1154 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1157 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1155 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1158 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1156 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1159 } 1157 }
1160 1158
1161 1159
1162 } // namespace internal 1160 } // namespace internal
1163 } // namespace v8 1161 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698