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

Side by Side Diff: src/builtins/builtins-regexp.cc

Issue 2577653002: [regexp] Let RegExp.prototype.compile return this (Closed)
Patch Set: Created 4 years 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 | « no previous file | test/mjsunit/regress/regress-585775.js » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 #include "src/regexp/jsregexp.h" 9 #include "src/regexp/jsregexp.h"
10 #include "src/regexp/regexp-utils.h" 10 #include "src/regexp/regexp-utils.h"
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 Node* const new_flags = FlagsGetter(context, pattern, true); 845 Node* const new_flags = FlagsGetter(context, pattern, true);
846 Node* const new_pattern = LoadObjectField(pattern, JSRegExp::kSourceOffset); 846 Node* const new_pattern = LoadObjectField(pattern, JSRegExp::kSourceOffset);
847 847
848 var_flags.Bind(new_flags); 848 var_flags.Bind(new_flags);
849 var_pattern.Bind(new_pattern); 849 var_pattern.Bind(new_pattern);
850 850
851 Goto(&next); 851 Goto(&next);
852 Bind(&next); 852 Bind(&next);
853 } 853 }
854 854
855 RegExpInitialize(context, receiver, var_pattern.value(), var_flags.value()); 855 Node* const result = RegExpInitialize(context, receiver, var_pattern.value(),
856 856 var_flags.value());
857 // Return undefined for compatibility with JSC. 857 Return(result);
858 // See http://crbug.com/585775 for web compat details.
859
860 Return(UndefinedConstant());
861 } 858 }
862 859
863 // ES6 21.2.5.10. 860 // ES6 21.2.5.10.
864 TF_BUILTIN(RegExpPrototypeSourceGetter, RegExpBuiltinsAssembler) { 861 TF_BUILTIN(RegExpPrototypeSourceGetter, RegExpBuiltinsAssembler) {
865 Node* const receiver = Parameter(0); 862 Node* const receiver = Parameter(0);
866 Node* const context = Parameter(3); 863 Node* const context = Parameter(3);
867 864
868 // Check whether we have an unmodified regexp instance. 865 // Check whether we have an unmodified regexp instance.
869 Label if_isjsregexp(this), if_isnotjsregexp(this, Label::kDeferred); 866 Label if_isjsregexp(this), if_isnotjsregexp(this, Label::kDeferred);
870 867
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 Bind(&if_matched); 2543 Bind(&if_matched);
2547 { 2544 {
2548 Node* result = 2545 Node* result =
2549 ConstructNewResultFromMatchInfo(context, match_indices, string); 2546 ConstructNewResultFromMatchInfo(context, match_indices, string);
2550 Return(result); 2547 Return(result);
2551 } 2548 }
2552 } 2549 }
2553 2550
2554 } // namespace internal 2551 } // namespace internal
2555 } // namespace v8 2552 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-585775.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698