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

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

Issue 2663803002: [string] Migrate String.prototype.{split,replace} to TF (Closed)
Patch Set: Remove debug-evaluate whitelisting Created 3 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/builtins/builtins-regexp.h ('k') | src/builtins/builtins-string.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 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-regexp.h"
6
5 #include "src/builtins/builtins-constructor.h" 7 #include "src/builtins/builtins-constructor.h"
6 #include "src/builtins/builtins-utils.h" 8 #include "src/builtins/builtins-utils.h"
7 #include "src/builtins/builtins.h" 9 #include "src/builtins/builtins.h"
8 #include "src/code-factory.h" 10 #include "src/code-factory.h"
9 #include "src/code-stub-assembler.h" 11 #include "src/code-stub-assembler.h"
10 #include "src/regexp/jsregexp.h" 12 #include "src/regexp/jsregexp.h"
11 #include "src/regexp/regexp-utils.h" 13 #include "src/regexp/regexp-utils.h"
12 #include "src/string-builder.h" 14 #include "src/string-builder.h"
13 15
14 namespace v8 { 16 namespace v8 {
15 namespace internal { 17 namespace internal {
16 18
17 typedef compiler::Node Node;
18 typedef CodeStubAssembler::ParameterMode ParameterMode; 19 typedef CodeStubAssembler::ParameterMode ParameterMode;
19 typedef compiler::CodeAssemblerState CodeAssemblerState;
20 20
21 class RegExpBuiltinsAssembler : public CodeStubAssembler {
22 public:
23 explicit RegExpBuiltinsAssembler(CodeAssemblerState* state)
24 : CodeStubAssembler(state) {}
25
26 protected:
27 Node* FastLoadLastIndex(Node* regexp);
28 Node* SlowLoadLastIndex(Node* context, Node* regexp);
29 Node* LoadLastIndex(Node* context, Node* regexp, bool is_fastpath);
30
31 void FastStoreLastIndex(Node* regexp, Node* value);
32 void SlowStoreLastIndex(Node* context, Node* regexp, Node* value);
33 void StoreLastIndex(Node* context, Node* regexp, Node* value,
34 bool is_fastpath);
35
36 Node* ConstructNewResultFromMatchInfo(Node* const context, Node* const regexp,
37 Node* const match_info,
38 Node* const string);
39
40 Node* RegExpPrototypeExecBodyWithoutResult(Node* const context,
41 Node* const regexp,
42 Node* const string,
43 Label* if_didnotmatch,
44 const bool is_fastpath);
45 Node* RegExpPrototypeExecBody(Node* const context, Node* const regexp,
46 Node* const string, const bool is_fastpath);
47
48 Node* ThrowIfNotJSReceiver(Node* context, Node* maybe_receiver,
49 MessageTemplate::Template msg_template,
50 char const* method_name);
51
52 Node* IsInitialRegExpMap(Node* context, Node* map);
53 void BranchIfFastRegExp(Node* context, Node* map, Label* if_isunmodified,
54 Label* if_ismodified);
55 void BranchIfFastRegExpResult(Node* context, Node* map,
56 Label* if_isunmodified, Label* if_ismodified);
57
58 Node* FlagsGetter(Node* const context, Node* const regexp, bool is_fastpath);
59
60 Node* FastFlagGetter(Node* const regexp, JSRegExp::Flag flag);
61 Node* SlowFlagGetter(Node* const context, Node* const regexp,
62 JSRegExp::Flag flag);
63 Node* FlagGetter(Node* const context, Node* const regexp, JSRegExp::Flag flag,
64 bool is_fastpath);
65 void FlagGetter(JSRegExp::Flag flag, v8::Isolate::UseCounterFeature counter,
66 const char* method_name);
67
68 Node* IsRegExp(Node* const context, Node* const maybe_receiver);
69 Node* RegExpInitialize(Node* const context, Node* const regexp,
70 Node* const maybe_pattern, Node* const maybe_flags);
71
72 Node* RegExpExec(Node* context, Node* regexp, Node* string);
73
74 Node* AdvanceStringIndex(Node* const string, Node* const index,
75 Node* const is_unicode);
76
77 void RegExpPrototypeMatchBody(Node* const context, Node* const regexp,
78 Node* const string, const bool is_fastpath);
79
80 void RegExpPrototypeSearchBodyFast(Node* const context, Node* const regexp,
81 Node* const string);
82 void RegExpPrototypeSearchBodySlow(Node* const context, Node* const regexp,
83 Node* const string);
84
85 void RegExpPrototypeSplitBody(Node* const context, Node* const regexp,
86 Node* const string, Node* const limit);
87
88 Node* ReplaceGlobalCallableFastPath(Node* context, Node* regexp, Node* string,
89 Node* replace_callable);
90 Node* ReplaceSimpleStringFastPath(Node* context, Node* regexp, Node* string,
91 Node* replace_string);
92 };
93 21
94 // ----------------------------------------------------------------------------- 22 // -----------------------------------------------------------------------------
95 // ES6 section 21.2 RegExp Objects 23 // ES6 section 21.2 RegExp Objects
96 24
97 Node* RegExpBuiltinsAssembler::FastLoadLastIndex(Node* regexp) { 25 Node* RegExpBuiltinsAssembler::FastLoadLastIndex(Node* regexp) {
98 // Load the in-object field. 26 // Load the in-object field.
99 static const int field_offset = 27 static const int field_offset =
100 JSRegExp::kSize + JSRegExp::kLastIndexFieldIndex * kPointerSize; 28 JSRegExp::kSize + JSRegExp::kLastIndexFieldIndex * kPointerSize;
101 return LoadObjectField(regexp, field_offset); 29 return LoadObjectField(regexp, field_offset);
102 } 30 }
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after
2589 Bind(&if_matched); 2517 Bind(&if_matched);
2590 { 2518 {
2591 Node* result = 2519 Node* result =
2592 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string); 2520 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string);
2593 Return(result); 2521 Return(result);
2594 } 2522 }
2595 } 2523 }
2596 2524
2597 } // namespace internal 2525 } // namespace internal
2598 } // namespace v8 2526 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-regexp.h ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698