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

Side by Side Diff: src/runtime.cc

Issue 10134010: Fix source property of empty RegExp objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Andreas Rossberg. Created 8 years, 8 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/regexp.js ('k') | test/mjsunit/regress/regress-1217.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 // 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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]); 1773 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, args[2]);
1774 return array; 1774 return array;
1775 } 1775 }
1776 1776
1777 1777
1778 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { 1778 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
1779 AssertNoAllocation no_alloc; 1779 AssertNoAllocation no_alloc;
1780 ASSERT(args.length() == 5); 1780 ASSERT(args.length() == 5);
1781 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); 1781 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
1782 CONVERT_ARG_CHECKED(String, source, 1); 1782 CONVERT_ARG_CHECKED(String, source, 1);
1783 // If source is the empty string we set it to "(?:)" instead as
1784 // suggested by ECMA-262, 5th, section 15.10.4.1.
1785 if (source->length() == 0) source = isolate->heap()->query_colon_symbol();
1783 1786
1784 Object* global = args[2]; 1787 Object* global = args[2];
1785 if (!global->IsTrue()) global = isolate->heap()->false_value(); 1788 if (!global->IsTrue()) global = isolate->heap()->false_value();
1786 1789
1787 Object* ignoreCase = args[3]; 1790 Object* ignoreCase = args[3];
1788 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value(); 1791 if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value();
1789 1792
1790 Object* multiline = args[4]; 1793 Object* multiline = args[4];
1791 if (!multiline->IsTrue()) multiline = isolate->heap()->false_value(); 1794 if (!multiline->IsTrue()) multiline = isolate->heap()->false_value();
1792 1795
(...skipping 11603 matching lines...) Expand 10 before | Expand all | Expand 10 after
13396 // Handle last resort GC and make sure to allow future allocations 13399 // Handle last resort GC and make sure to allow future allocations
13397 // to grow the heap without causing GCs (if possible). 13400 // to grow the heap without causing GCs (if possible).
13398 isolate->counters()->gc_last_resort_from_js()->Increment(); 13401 isolate->counters()->gc_last_resort_from_js()->Increment();
13399 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13402 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13400 "Runtime::PerformGC"); 13403 "Runtime::PerformGC");
13401 } 13404 }
13402 } 13405 }
13403 13406
13404 13407
13405 } } // namespace v8::internal 13408 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | test/mjsunit/regress/regress-1217.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698