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

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

Issue 1410993008: Remove RegExp.multiline accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git cl set_commit Created 5 years, 1 month 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/regexp-static.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 var RegExpSetInput = function(string) { 360 var RegExpSetInput = function(string) {
361 LAST_INPUT(RegExpLastMatchInfo) = TO_STRING(string); 361 LAST_INPUT(RegExpLastMatchInfo) = TO_STRING(string);
362 }; 362 };
363 363
364 %OptimizeObjectForAddingMultipleProperties(GlobalRegExp, 22); 364 %OptimizeObjectForAddingMultipleProperties(GlobalRegExp, 22);
365 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'input', RegExpGetInput, 365 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'input', RegExpGetInput,
366 RegExpSetInput, DONT_DELETE); 366 RegExpSetInput, DONT_DELETE);
367 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$_', RegExpGetInput, 367 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$_', RegExpGetInput,
368 RegExpSetInput, DONT_ENUM | DONT_DELETE); 368 RegExpSetInput, DONT_ENUM | DONT_DELETE);
369 369
370 // The properties multiline and $* are aliases for each other. When this
371 // value is set in SpiderMonkey, the value it is set to is coerced to a
372 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey
373 // the value of the expression 'RegExp.multiline = null' (for instance) is the
374 // boolean false (i.e., the value after coercion), while in V8 it is the value
375 // null (i.e., the value before coercion).
376
377 // Getter and setter for multiline.
378 var multiline = false;
379 var RegExpGetMultiline = function() { return multiline; };
380 var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; };
381
382 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'multiline', RegExpGetMultiline,
383 RegExpSetMultiline, DONT_DELETE);
384 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$*', RegExpGetMultiline,
385 RegExpSetMultiline,
386 DONT_ENUM | DONT_DELETE);
387
388
389 var NoOpSetter = function(ignored) {}; 370 var NoOpSetter = function(ignored) {};
390 371
391 372
392 // Static properties set by a successful match. 373 // Static properties set by a successful match.
393 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastMatch', RegExpGetLastMatch, 374 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastMatch', RegExpGetLastMatch,
394 NoOpSetter, DONT_DELETE); 375 NoOpSetter, DONT_DELETE);
395 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$&', RegExpGetLastMatch, 376 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$&', RegExpGetLastMatch,
396 NoOpSetter, DONT_ENUM | DONT_DELETE); 377 NoOpSetter, DONT_ENUM | DONT_DELETE);
397 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastParen', RegExpGetLastParen, 378 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastParen', RegExpGetLastParen,
398 NoOpSetter, DONT_DELETE); 379 NoOpSetter, DONT_DELETE);
(...skipping 21 matching lines...) Expand all
420 // Exports 401 // Exports
421 402
422 utils.Export(function(to) { 403 utils.Export(function(to) {
423 to.RegExpExec = DoRegExpExec; 404 to.RegExpExec = DoRegExpExec;
424 to.RegExpExecNoTests = RegExpExecNoTests; 405 to.RegExpExecNoTests = RegExpExecNoTests;
425 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 406 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
426 to.RegExpTest = RegExpTest; 407 to.RegExpTest = RegExpTest;
427 }); 408 });
428 409
429 }) 410 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regexp-static.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698