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

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

Issue 1725963002: Version 4.9.385.25 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.9
Patch Set: Created 4 years, 10 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 | « src/js/harmony-unicode-regexps.js ('k') | test/mjsunit/es6/regexp-flags.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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 var matchEnd = RegExpLastMatchInfo[CAPTURE(index + 1)]; 449 var matchEnd = RegExpLastMatchInfo[CAPTURE(index + 1)];
450 if (matchStart == -1 || matchEnd == -1) return ''; 450 if (matchStart == -1 || matchEnd == -1) return '';
451 return %_SubString(LAST_SUBJECT(RegExpLastMatchInfo), matchStart, matchEnd); 451 return %_SubString(LAST_SUBJECT(RegExpLastMatchInfo), matchStart, matchEnd);
452 }; 452 };
453 } 453 }
454 454
455 455
456 // ES6 21.2.5.4. 456 // ES6 21.2.5.4.
457 function RegExpGetGlobal() { 457 function RegExpGetGlobal() {
458 if (!IS_REGEXP(this)) { 458 if (!IS_REGEXP(this)) {
459 // TODO(littledan): Remove this RegExp compat workaround
460 if (this === GlobalRegExpPrototype) {
461 return UNDEFINED;
462 }
459 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.global"); 463 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.global");
460 } 464 }
461 return !!REGEXP_GLOBAL(this); 465 return !!REGEXP_GLOBAL(this);
462 } 466 }
463 %FunctionSetName(RegExpGetGlobal, "RegExp.prototype.global"); 467 %FunctionSetName(RegExpGetGlobal, "RegExp.prototype.global");
464 %SetNativeFlag(RegExpGetGlobal); 468 %SetNativeFlag(RegExpGetGlobal);
465 469
466 470
467 // ES6 21.2.5.5. 471 // ES6 21.2.5.5.
468 function RegExpGetIgnoreCase() { 472 function RegExpGetIgnoreCase() {
469 if (!IS_REGEXP(this)) { 473 if (!IS_REGEXP(this)) {
474 // TODO(littledan): Remove this RegExp compat workaround
475 if (this === GlobalRegExpPrototype) {
476 return UNDEFINED;
477 }
470 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.ignoreCase"); 478 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.ignoreCase");
471 } 479 }
472 return !!REGEXP_IGNORE_CASE(this); 480 return !!REGEXP_IGNORE_CASE(this);
473 } 481 }
474 %FunctionSetName(RegExpGetIgnoreCase, "RegExp.prototype.ignoreCase"); 482 %FunctionSetName(RegExpGetIgnoreCase, "RegExp.prototype.ignoreCase");
475 %SetNativeFlag(RegExpGetIgnoreCase); 483 %SetNativeFlag(RegExpGetIgnoreCase);
476 484
477 485
478 // ES6 21.2.5.7. 486 // ES6 21.2.5.7.
479 function RegExpGetMultiline() { 487 function RegExpGetMultiline() {
480 if (!IS_REGEXP(this)) { 488 if (!IS_REGEXP(this)) {
489 // TODO(littledan): Remove this RegExp compat workaround
490 if (this === GlobalRegExpPrototype) {
491 return UNDEFINED;
492 }
481 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.multiline"); 493 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.multiline");
482 } 494 }
483 return !!REGEXP_MULTILINE(this); 495 return !!REGEXP_MULTILINE(this);
484 } 496 }
485 %FunctionSetName(RegExpGetMultiline, "RegExp.prototype.multiline"); 497 %FunctionSetName(RegExpGetMultiline, "RegExp.prototype.multiline");
486 %SetNativeFlag(RegExpGetMultiline); 498 %SetNativeFlag(RegExpGetMultiline);
487 499
488 500
489 // ES6 21.2.5.10. 501 // ES6 21.2.5.10.
490 function RegExpGetSource() { 502 function RegExpGetSource() {
491 if (!IS_REGEXP(this)) { 503 if (!IS_REGEXP(this)) {
504 // TODO(littledan): Remove this RegExp compat workaround
505 if (this === GlobalRegExpPrototype) {
506 return UNDEFINED;
507 }
492 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.source"); 508 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.source");
493 } 509 }
494 return REGEXP_SOURCE(this); 510 return REGEXP_SOURCE(this);
495 } 511 }
496 %FunctionSetName(RegExpGetSource, "RegExp.prototype.source"); 512 %FunctionSetName(RegExpGetSource, "RegExp.prototype.source");
497 %SetNativeFlag(RegExpGetSource); 513 %SetNativeFlag(RegExpGetSource);
498 514
499 // ------------------------------------------------------------------- 515 // -------------------------------------------------------------------
500 516
501 %FunctionSetInstanceClassName(GlobalRegExp, 'RegExp'); 517 %FunctionSetInstanceClassName(GlobalRegExp, 'RegExp');
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // Exports 588 // Exports
573 589
574 utils.Export(function(to) { 590 utils.Export(function(to) {
575 to.RegExpExec = DoRegExpExec; 591 to.RegExpExec = DoRegExpExec;
576 to.RegExpExecNoTests = RegExpExecNoTests; 592 to.RegExpExecNoTests = RegExpExecNoTests;
577 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 593 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
578 to.RegExpTest = RegExpTest; 594 to.RegExpTest = RegExpTest;
579 }); 595 });
580 596
581 }) 597 })
OLDNEW
« no previous file with comments | « src/js/harmony-unicode-regexps.js ('k') | test/mjsunit/es6/regexp-flags.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698