OLD | NEW |
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 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.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 42 matching lines...) Loading... |
53 | 53 |
54 Handle<String> flags_string; | 54 Handle<String> flags_string; |
55 if (flags->IsUndefined(isolate)) { | 55 if (flags->IsUndefined(isolate)) { |
56 flags_string = isolate->factory()->empty_string(); | 56 flags_string = isolate->factory()->empty_string(); |
57 } else { | 57 } else { |
58 ASSIGN_RETURN_ON_EXCEPTION(isolate, flags_string, | 58 ASSIGN_RETURN_ON_EXCEPTION(isolate, flags_string, |
59 Object::ToString(isolate, flags), JSRegExp); | 59 Object::ToString(isolate, flags), JSRegExp); |
60 } | 60 } |
61 | 61 |
62 // TODO(jgruber): We could avoid the flags back and forth conversions. | 62 // TODO(jgruber): We could avoid the flags back and forth conversions. |
63 RETURN_RESULT(isolate, | 63 return JSRegExp::Initialize(regexp, pattern_string, flags_string); |
64 JSRegExp::Initialize(regexp, pattern_string, flags_string), | |
65 JSRegExp); | |
66 } | 64 } |
67 | 65 |
68 } // namespace | 66 } // namespace |
69 | 67 |
70 // ES#sec-regexp-pattern-flags | 68 // ES#sec-regexp-pattern-flags |
71 // RegExp ( pattern, flags ) | 69 // RegExp ( pattern, flags ) |
72 BUILTIN(RegExpConstructor) { | 70 BUILTIN(RegExpConstructor) { |
73 HandleScope scope(isolate); | 71 HandleScope scope(isolate); |
74 | 72 |
75 Handle<HeapObject> new_target = args.new_target(); | 73 Handle<HeapObject> new_target = args.new_target(); |
(...skipping 1632 matching lines...) Loading... |
1708 { | 1706 { |
1709 Node* const match_elements = a->LoadElements(match_indices); | 1707 Node* const match_elements = a->LoadElements(match_indices); |
1710 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, | 1708 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, |
1711 match_elements, string); | 1709 match_elements, string); |
1712 a->Return(result); | 1710 a->Return(result); |
1713 } | 1711 } |
1714 } | 1712 } |
1715 | 1713 |
1716 } // namespace internal | 1714 } // namespace internal |
1717 } // namespace v8 | 1715 } // namespace v8 |
OLD | NEW |