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

Side by Side Diff: src/regexp.js

Issue 10440045: Enable map transitions for accessor properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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') | no next file » | 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 // 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 // value is set the value it is set to is coerced to a string. 420 // value is set the value it is set to is coerced to a string.
421 // Getter and setter for the input. 421 // Getter and setter for the input.
422 var RegExpGetInput = function() { 422 var RegExpGetInput = function() {
423 var regExpInput = LAST_INPUT(lastMatchInfo); 423 var regExpInput = LAST_INPUT(lastMatchInfo);
424 return IS_UNDEFINED(regExpInput) ? "" : regExpInput; 424 return IS_UNDEFINED(regExpInput) ? "" : regExpInput;
425 }; 425 };
426 var RegExpSetInput = function(string) { 426 var RegExpSetInput = function(string) {
427 LAST_INPUT(lastMatchInfo) = ToString(string); 427 LAST_INPUT(lastMatchInfo) = ToString(string);
428 }; 428 };
429 429
430 %OptimizeObjectForAddingMultipleProperties($RegExp, 22);
430 %DefineOrRedefineAccessorProperty($RegExp, 'input', RegExpGetInput, 431 %DefineOrRedefineAccessorProperty($RegExp, 'input', RegExpGetInput,
431 RegExpSetInput, DONT_DELETE); 432 RegExpSetInput, DONT_DELETE);
432 %DefineOrRedefineAccessorProperty($RegExp, '$_', RegExpGetInput, 433 %DefineOrRedefineAccessorProperty($RegExp, '$_', RegExpGetInput,
433 RegExpSetInput, DONT_ENUM | DONT_DELETE); 434 RegExpSetInput, DONT_ENUM | DONT_DELETE);
434 %DefineOrRedefineAccessorProperty($RegExp, '$input', RegExpGetInput, 435 %DefineOrRedefineAccessorProperty($RegExp, '$input', RegExpGetInput,
435 RegExpSetInput, DONT_ENUM | DONT_DELETE); 436 RegExpSetInput, DONT_ENUM | DONT_DELETE);
436 437
437 // The properties multiline and $* are aliases for each other. When this 438 // The properties multiline and $* are aliases for each other. When this
438 // value is set in SpiderMonkey, the value it is set to is coerced to a 439 // value is set in SpiderMonkey, the value it is set to is coerced to a
439 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey 440 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 RegExpGetRightContext, NoOpSetter, 475 RegExpGetRightContext, NoOpSetter,
475 DONT_DELETE); 476 DONT_DELETE);
476 %DefineOrRedefineAccessorProperty($RegExp, "$'", RegExpGetRightContext, 477 %DefineOrRedefineAccessorProperty($RegExp, "$'", RegExpGetRightContext,
477 NoOpSetter, DONT_ENUM | DONT_DELETE); 478 NoOpSetter, DONT_ENUM | DONT_DELETE);
478 479
479 for (var i = 1; i < 10; ++i) { 480 for (var i = 1; i < 10; ++i) {
480 %DefineOrRedefineAccessorProperty($RegExp, '$' + i, 481 %DefineOrRedefineAccessorProperty($RegExp, '$' + i,
481 RegExpMakeCaptureGetter(i), NoOpSetter, 482 RegExpMakeCaptureGetter(i), NoOpSetter,
482 DONT_DELETE); 483 DONT_DELETE);
483 } 484 }
485 %ToFastProperties($RegExp);
484 } 486 }
485 487
486 SetUpRegExp(); 488 SetUpRegExp();
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698