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

Side by Side Diff: src/regexp-delay.js

Issue 42115: Faster string.replace with regexp pattern. (Closed)
Patch Set: Addressed review comments Created 11 years, 9 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 if (this.global) 194 if (this.global)
195 this.lastIndex = lastMatchInfo[CAPTURE1]; 195 this.lastIndex = lastMatchInfo[CAPTURE1];
196 result.index = lastMatchInfo[CAPTURE0]; 196 result.index = lastMatchInfo[CAPTURE0];
197 result.input = s; 197 result.input = s;
198 return result; 198 return result;
199 } 199 }
200 200
201 201
202 // Section 15.10.6.3 doesn't actually make sense, but the intention seems to be 202 // Section 15.10.6.3 doesn't actually make sense, but the intention seems to be
203 // that test is defined in terms of String.prototype.exec even if the method is 203 // that test is defined in terms of String.prototype.exec. However, it probably
204 // called on a non-RegExp object. However, it probably means the original 204 // means the original value of String.prototype.exec, which is what everybody
205 // value of String.prototype.exec, which is what everybody else implements. 205 // else implements.
206 function RegExpTest(string) { 206 function RegExpTest(string) {
207 if (!IS_REGEXP(this)) { 207 if (!IS_REGEXP(this)) {
208 throw MakeTypeError('method_called_on_incompatible', 208 throw MakeTypeError('method_called_on_incompatible',
209 ['RegExp.prototype.test', this]); 209 ['RegExp.prototype.test', this]);
210 } 210 }
211 if (%_ArgumentsLength() == 0) { 211 if (%_ArgumentsLength() == 0) {
212 var regExpInput = LAST_INPUT(lastMatchInfo); 212 var regExpInput = LAST_INPUT(lastMatchInfo);
213 if (IS_UNDEFINED(regExpInput)) { 213 if (IS_UNDEFINED(regExpInput)) {
214 throw MakeError('no_input_to_regexp', [this]); 214 throw MakeError('no_input_to_regexp', [this]);
215 } 215 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 404 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
405 405
406 for (var i = 1; i < 10; ++i) { 406 for (var i = 1; i < 10; ++i) {
407 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); 407 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE);
408 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); 408 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
409 } 409 }
410 } 410 }
411 411
412 412
413 SetupRegExp(); 413 SetupRegExp();
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/regexp-macro-assembler-ia32.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698