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

Unified Diff: src/runtime.cc

Issue 4308001: Remove regexp caching. (Closed)
Patch Set: Removed RegExpCloneResult Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index fc1a0232295a73e8b50dc1eea178a9034d9e8b48..dbfec5dd337ad9969e7225e4ede70543d0ef212b 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1424,66 +1424,6 @@ static MaybeObject* Runtime_RegExpConstructResult(Arguments args) {
}
-static MaybeObject* Runtime_RegExpCloneResult(Arguments args) {
- ASSERT(args.length() == 1);
- Map* regexp_result_map;
- {
- AssertNoAllocation no_gc;
- HandleScope handles;
- regexp_result_map = Top::global_context()->regexp_result_map();
- }
- if (!args[0]->IsJSArray()) return args[0];
-
- JSArray* result = JSArray::cast(args[0]);
- // Arguments to RegExpCloneResult should always be fresh RegExp exec call
- // results (either a fresh JSRegExpResult or null).
- // If the argument is not a JSRegExpResult, or isn't unmodified, just return
- // the argument uncloned.
- if (result->map() != regexp_result_map) return result;
-
- // Having the original JSRegExpResult map guarantees that we have
- // fast elements and no properties except the two in-object properties.
- ASSERT(result->HasFastElements());
- ASSERT(result->properties() == Heap::empty_fixed_array());
- ASSERT_EQ(2, regexp_result_map->inobject_properties());
-
- Object* new_array_alloc;
- { MaybeObject* maybe_new_array_alloc =
- Heap::AllocateRaw(JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE);
- if (!maybe_new_array_alloc->ToObject(&new_array_alloc)) {
- return maybe_new_array_alloc;
- }
- }
-
- // Set HeapObject map to JSRegExpResult map.
- reinterpret_cast<HeapObject*>(new_array_alloc)->set_map(regexp_result_map);
-
- JSArray* new_array = JSArray::cast(new_array_alloc);
-
- // Copy JSObject properties.
- new_array->set_properties(result->properties()); // Empty FixedArray.
-
- // Copy JSObject elements as copy-on-write.
- FixedArray* elements = FixedArray::cast(result->elements());
- if (elements != Heap::empty_fixed_array()) {
- elements->set_map(Heap::fixed_cow_array_map());
- }
- new_array->set_elements(elements);
-
- // Copy JSArray length.
- new_array->set_length(result->length());
-
- // Copy JSRegExpResult in-object property fields input and index.
- new_array->FastPropertyAtPut(JSRegExpResult::kIndexIndex,
- result->FastPropertyAt(
- JSRegExpResult::kIndexIndex));
- new_array->FastPropertyAtPut(JSRegExpResult::kInputIndex,
- result->FastPropertyAt(
- JSRegExpResult::kInputIndex));
- return new_array;
-}
-
-
static MaybeObject* Runtime_RegExpInitializeObject(Arguments args) {
AssertNoAllocation no_alloc;
ASSERT(args.length() == 5);
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698