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

Unified Diff: src/heap.cc

Issue 8143018: Revert "Added ability to lock strings to prevent their representation or encoding from changing." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.h ('k') | src/json-parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 522861deda05e2a163861ac527be202631387441..05af2cd2d8c68edafe6bdc2391fda89861e51896 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2340,7 +2340,6 @@ bool Heap::CreateInitialObjects() {
set_intrinsic_function_names(StringDictionary::cast(obj));
if (InitializeNumberStringCache()->IsFailure()) return false;
- if (InitializeStringLocks()->IsFailure()) return false;
// Allocate cache for single character ASCII strings.
{ MaybeObject* maybe_obj =
@@ -2557,76 +2556,6 @@ MaybeObject* Heap::Uint32ToString(uint32_t value,
}
-MaybeObject* Heap::LockString(String* string) {
- ASSERT(!string->IsConsString());
- FixedArray* locks = string_locks();
- ASSERT(locks->length() > 1);
- int length = locks->length();
- int element_count = Smi::cast(locks->get(0))->value();
- int element_index = element_count + 1;
- if (element_index >= length) {
- int new_length = length * 2;
- MaybeObject* allocation = AllocateFixedArray(new_length);
- FixedArray* new_locks = NULL; // Initialized to please compiler.
- if (!allocation->To<FixedArray>(&new_locks)) return allocation;
- for (int i = 1; i < length; i++) {
- new_locks->set(i, locks->get(i));
- }
- set_string_locks(new_locks);
- locks = new_locks;
- }
- locks->set(element_index, string);
- locks->set(0, Smi::FromInt(element_index));
- return string;
-}
-
-
-void Heap::UnlockString(String* string) {
- FixedArray* locks = string_locks();
- ASSERT(locks->length() > 1);
- int element_count = Smi::cast(locks->get(0))->value();
- ASSERT(element_count > 0);
- ASSERT(element_count < locks->length());
- for (int i = 1; i <= element_count; i++) {
- String* element = String::cast(locks->get(i));
- if (element == string) {
- if (i < element_count) {
- locks->set(i, locks->get(element_count));
- }
- locks->set_undefined(element_count);
- locks->set(0, Smi::FromInt(element_count - 1));
- return;
- }
- }
- // We should have found the string. It's an error to try to unlock
- // a string that hasn't been locked.
- UNREACHABLE();
-}
-
-
-bool Heap::IsStringLocked(String* string) {
- if (string->IsConsString()) return false;
- FixedArray* locks = string_locks();
- ASSERT(locks->length() > 1);
- int element_count = Smi::cast(locks->get(0))->value();
- for (int i = 1; i <= element_count; i++) {
- if (locks->get(i) == string) return true;
- }
- return false;
-}
-
-
-MaybeObject* Heap::InitializeStringLocks() {
- const int kInitialSize = 6;
- MaybeObject* allocation = AllocateFixedArray(kInitialSize);
- if (allocation->IsFailure()) return allocation;
- FixedArray* new_array = FixedArray::cast(allocation->ToObjectUnchecked());
- new_array->set(0, Smi::FromInt(0));
- set_string_locks(new_array);
- return new_array;
-}
-
-
Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) {
return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]);
}
« no previous file with comments | « src/heap.h ('k') | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698