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

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

Issue 1417733012: [regexp] remove no-op RegExp.multiline accessor and alias (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add mozilla test expectations 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 var RegExpSetInput = function(string) { 409 var RegExpSetInput = function(string) {
410 LAST_INPUT(RegExpLastMatchInfo) = TO_STRING(string); 410 LAST_INPUT(RegExpLastMatchInfo) = TO_STRING(string);
411 }; 411 };
412 412
413 %OptimizeObjectForAddingMultipleProperties(GlobalRegExp, 22); 413 %OptimizeObjectForAddingMultipleProperties(GlobalRegExp, 22);
414 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'input', RegExpGetInput, 414 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'input', RegExpGetInput,
415 RegExpSetInput, DONT_DELETE); 415 RegExpSetInput, DONT_DELETE);
416 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$_', RegExpGetInput, 416 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$_', RegExpGetInput,
417 RegExpSetInput, DONT_ENUM | DONT_DELETE); 417 RegExpSetInput, DONT_ENUM | DONT_DELETE);
418 418
419 // The properties multiline and $* are aliases for each other. When this
420 // value is set in SpiderMonkey, the value it is set to is coerced to a
421 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey
422 // the value of the expression 'RegExp.multiline = null' (for instance) is the
423 // boolean false (i.e., the value after coercion), while in V8 it is the value
424 // null (i.e., the value before coercion).
425
426 // Getter and setter for multiline.
427 var multiline = false;
428 var RegExpGetMultiline = function() { return multiline; };
429 var RegExpSetMultiline = function(flag) { multiline = flag ? true : false; };
430
431 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'multiline', RegExpGetMultiline,
432 RegExpSetMultiline, DONT_DELETE);
433 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$*', RegExpGetMultiline,
434 RegExpSetMultiline,
435 DONT_ENUM | DONT_DELETE);
436
437
438 var NoOpSetter = function(ignored) {}; 419 var NoOpSetter = function(ignored) {};
439 420
440 421
441 // Static properties set by a successful match. 422 // Static properties set by a successful match.
442 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastMatch', RegExpGetLastMatch, 423 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastMatch', RegExpGetLastMatch,
443 NoOpSetter, DONT_DELETE); 424 NoOpSetter, DONT_DELETE);
444 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$&', RegExpGetLastMatch, 425 %DefineAccessorPropertyUnchecked(GlobalRegExp, '$&', RegExpGetLastMatch,
445 NoOpSetter, DONT_ENUM | DONT_DELETE); 426 NoOpSetter, DONT_ENUM | DONT_DELETE);
446 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastParen', RegExpGetLastParen, 427 %DefineAccessorPropertyUnchecked(GlobalRegExp, 'lastParen', RegExpGetLastParen,
447 NoOpSetter, DONT_DELETE); 428 NoOpSetter, DONT_DELETE);
(...skipping 21 matching lines...) Expand all
469 // Exports 450 // Exports
470 451
471 utils.Export(function(to) { 452 utils.Export(function(to) {
472 to.RegExpExec = DoRegExpExec; 453 to.RegExpExec = DoRegExpExec;
473 to.RegExpExecNoTests = RegExpExecNoTests; 454 to.RegExpExecNoTests = RegExpExecNoTests;
474 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 455 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
475 to.RegExpTest = RegExpTest; 456 to.RegExpTest = RegExpTest;
476 }); 457 });
477 458
478 }) 459 })
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