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

Side by Side Diff: src/regexp.js

Issue 6602081: Stop using plain Arrays internally in built-in functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changed header in bootstrapper.cc Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/string.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 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 }; 377 };
378 } 378 }
379 379
380 380
381 // Property of the builtins object for recording the result of the last 381 // Property of the builtins object for recording the result of the last
382 // regexp match. The property lastMatchInfo includes the matchIndices 382 // regexp match. The property lastMatchInfo includes the matchIndices
383 // array of the last successful regexp match (an array of start/end index 383 // array of the last successful regexp match (an array of start/end index
384 // pairs for the match and all the captured substrings), the invariant is 384 // pairs for the match and all the captured substrings), the invariant is
385 // that there are at least two capture indeces. The array also contains 385 // that there are at least two capture indeces. The array also contains
386 // the subject string for the last successful match. 386 // the subject string for the last successful match.
387 var lastMatchInfo = [ 387 var lastMatchInfo = new InternalArray(
388 2, // REGEXP_NUMBER_OF_CAPTURES 388 2, // REGEXP_NUMBER_OF_CAPTURES
389 "", // Last subject. 389 "", // Last subject.
390 void 0, // Last input - settable with RegExpSetInput. 390 void 0, // Last input - settable with RegExpSetInput.
391 0, // REGEXP_FIRST_CAPTURE + 0 391 0, // REGEXP_FIRST_CAPTURE + 0
392 0, // REGEXP_FIRST_CAPTURE + 1 392 0 // REGEXP_FIRST_CAPTURE + 1
393 ]; 393 );
394 394
395 // Override last match info with an array of actual substrings. 395 // Override last match info with an array of actual substrings.
396 // Used internally by replace regexp with function. 396 // Used internally by replace regexp with function.
397 // The array has the format of an "apply" argument for a replacement 397 // The array has the format of an "apply" argument for a replacement
398 // function. 398 // function.
399 var lastMatchInfoOverride = null; 399 var lastMatchInfoOverride = null;
400 400
401 // ------------------------------------------------------------------- 401 // -------------------------------------------------------------------
402 402
403 function SetupRegExp() { 403 function SetupRegExp() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 474 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
475 475
476 for (var i = 1; i < 10; ++i) { 476 for (var i = 1; i < 10; ++i) {
477 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); 477 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE);
478 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); 478 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
479 } 479 }
480 } 480 }
481 481
482 482
483 SetupRegExp(); 483 SetupRegExp();
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698