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

Side by Side Diff: src/regexp.js

Issue 2834028: X64: Make the ToBoolean inline code do even less if the value is known to be a smi. (Closed)
Patch Set: Created 10 years, 5 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 | « no previous file | src/x64/codegen-x64.cc » ('j') | src/x64/codegen-x64.cc » ('J')
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 var lastIndex = this.lastIndex; 290 var lastIndex = this.lastIndex;
291 var cache = regExpCache; 291 var cache = regExpCache;
292 if (%_ObjectEquals(cache.type, 'test') && 292 if (%_ObjectEquals(cache.type, 'test') &&
293 %_ObjectEquals(cache.regExp, this) && 293 %_ObjectEquals(cache.regExp, this) &&
294 %_ObjectEquals(cache.subject, string) && 294 %_ObjectEquals(cache.subject, string) &&
295 %_ObjectEquals(cache.lastIndex, lastIndex)) { 295 %_ObjectEquals(cache.lastIndex, lastIndex)) {
296 return cache.answer; 296 return cache.answer;
297 } 297 }
298 298
299 // Remove irrelevant preceeding '.*' in a test regexp. The expression 299 // Remove irrelevant preceeding '.*' in a test regexp. The expression
300 // checks whether this.source starts with '.*' and that the third 300 // checks whether this.source starts with '.*' and that the third
301 // char is not a '?' 301 // char is not a '?'
302 if (%_StringCharCodeAt(this.source,0) == 46 && // '.' 302 if (%_StringCharCodeAt(this.source,0) == 46 && // '.'
303 %_StringCharCodeAt(this.source,1) == 42 && // '*' 303 %_StringCharCodeAt(this.source,1) == 42 && // '*'
304 %_StringCharCodeAt(this.source,2) != 63) { // '?' 304 %_StringCharCodeAt(this.source,2) != 63) { // '?'
305 if (!%_ObjectEquals(regexp_key, this)) { 305 if (!%_ObjectEquals(regexp_key, this)) {
306 regexp_key = this; 306 regexp_key = this;
307 regexp_val = new $RegExp(this.source.substring(2, this.source.length), 307 regexp_val = new $RegExp(this.source.substring(2, this.source.length),
308 (this.global ? 'g' : '') 308 (this.global ? 'g' : '')
309 + (this.ignoreCase ? 'i' : '') 309 + (this.ignoreCase ? 'i' : '')
310 + (this.multiline ? 'm' : '')); 310 + (this.multiline ? 'm' : ''));
311 } 311 }
312 if (!regexp_val.test(s)) return false; 312 if (!regexp_val.test(s)) return false;
313 } 313 }
314 314
315 var length = s.length; 315 var length = s.length;
316 var i = this.global ? TO_INTEGER(lastIndex) : 0; 316 var i = this.global ? TO_INTEGER(lastIndex) : 0;
317 317
318 cache.type = 'test'; 318 cache.type = 'test';
319 cache.regExp = this; 319 cache.regExp = this;
320 cache.subject = s; 320 cache.subject = s;
321 cache.lastIndex = i; 321 cache.lastIndex = i;
322 322
323 if (i < 0 || i > length) { 323 if (i < 0 || i > length) {
324 this.lastIndex = 0; 324 this.lastIndex = 0;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 540 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
541 541
542 for (var i = 1; i < 10; ++i) { 542 for (var i = 1; i < 10; ++i) {
543 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); 543 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE);
544 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); 544 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
545 } 545 }
546 } 546 }
547 547
548 548
549 SetupRegExp(); 549 SetupRegExp();
OLDNEW
« no previous file with comments | « no previous file | src/x64/codegen-x64.cc » ('j') | src/x64/codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698