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

Side by Side Diff: runtime/lib/regexp.cc

Issue 1305993005: VM: Simplify irregexp entry stub. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: simplify ExecuteMatch Created 5 years, 3 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 | « no previous file | runtime/vm/flow_graph_type_propagator.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/regexp_parser.h" 10 #include "vm/regexp_parser.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 String::New("Regular expression is not initialized yet. ")); 76 String::New("Regular expression is not initialized yet. "));
77 const String& message = String::Handle(String::Concat(errmsg, pattern)); 77 const String& message = String::Handle(String::Concat(errmsg, pattern));
78 const Array& args = Array::Handle(Array::New(1)); 78 const Array& args = Array::Handle(Array::New(1));
79 args.SetAt(0, message); 79 args.SetAt(0, message);
80 Exceptions::ThrowByType(Exceptions::kFormat, args); 80 Exceptions::ThrowByType(Exceptions::kFormat, args);
81 return Object::null(); 81 return Object::null();
82 } 82 }
83 83
84 84
85 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_ExecuteMatch, 3) { 85 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_ExecuteMatch, 3) {
86 // This function is intrinsified. See Intrinsifier::JSRegExp_ExecuteMatch.
86 const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0)); 87 const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0));
87 ASSERT(!regexp.IsNull()); 88 ASSERT(!regexp.IsNull());
88 GET_NON_NULL_NATIVE_ARGUMENT(String, subject, arguments->NativeArgAt(1)); 89 GET_NON_NULL_NATIVE_ARGUMENT(String, subject, arguments->NativeArgAt(1));
89 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_index, arguments->NativeArgAt(2)); 90 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_index, arguments->NativeArgAt(2));
90 91
91 if (FLAG_interpret_irregexp) { 92 if (FLAG_interpret_irregexp) {
92 return BytecodeRegExpMacroAssembler::Interpret(regexp, subject, start_index, 93 return BytecodeRegExpMacroAssembler::Interpret(regexp, subject, start_index,
93 zone); 94 zone);
94 } 95 }
95 96
96 // This function is intrinsified. See Intrinsifier::JSRegExp_ExecuteMatch. 97 return IRRegExpMacroAssembler::Execute(regexp, subject, start_index, zone);
97 const intptr_t cid = subject.GetClassId();
98
99 // Retrieve the cached function.
100 const Function& fn = Function::Handle(regexp.function(cid));
101 ASSERT(!fn.IsNull());
102
103 // And finally call the generated code.
104 return IRRegExpMacroAssembler::Execute(fn, subject, start_index, zone);
105 } 98 }
106 99
107 } // namespace dart 100 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698