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

Unified Diff: src/heap.cc

Issue 11308066: Rename IsAsciiRepresentation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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/heap.h ('k') | src/heap-inl.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 307960b737564e495b508be5cc33b70ae9f9c8f5..976d65e959fdc35e50a8efe8964ff9e00a1388c4 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2805,7 +2805,7 @@ bool Heap::CreateInitialObjects() {
set_termination_exception(obj);
// Allocate the empty string.
- { MaybeObject* maybe_obj = AllocateRawAsciiString(0, TENURED);
+ { MaybeObject* maybe_obj = AllocateRawOneByteString(0, TENURED);
if (!maybe_obj->ToObject(&obj)) return false;
}
set_empty_string(String::cast(obj));
@@ -3177,7 +3177,7 @@ MaybeObject* Heap::NumberToString(Object* number,
}
Object* js_string;
- MaybeObject* maybe_js_string = AllocateStringFromAscii(CStrVector(str));
+ MaybeObject* maybe_js_string = AllocateStringFromOneByte(CStrVector(str));
if (maybe_js_string->ToObject(&js_string)) {
SetNumberStringCache(number, String::cast(js_string));
}
@@ -3351,7 +3351,7 @@ MUST_USE_RESULT static inline MaybeObject* MakeOrFindTwoCharacterString(
} else if ((c1 | c2) <= String::kMaxAsciiCharCodeU) { // We can do this
ASSERT(IsPowerOf2(String::kMaxAsciiCharCodeU + 1)); // because of this.
Object* result;
- { MaybeObject* maybe_result = heap->AllocateRawAsciiString(2);
+ { MaybeObject* maybe_result = heap->AllocateRawOneByteString(2);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
char* dest = SeqOneByteString::cast(result)->GetChars();
@@ -3393,8 +3393,8 @@ MaybeObject* Heap::AllocateConsString(String* first, String* second) {
return MakeOrFindTwoCharacterString(this, c1, c2);
}
- bool first_is_ascii = first->IsAsciiRepresentation();
- bool second_is_ascii = second->IsAsciiRepresentation();
+ bool first_is_ascii = first->IsOneByteRepresentation();
+ bool second_is_ascii = second->IsOneByteRepresentation();
bool is_ascii = first_is_ascii && second_is_ascii;
// Make sure that an out of memory exception is thrown if the length
@@ -3424,7 +3424,7 @@ MaybeObject* Heap::AllocateConsString(String* first, String* second) {
ASSERT(second->IsFlat());
if (is_ascii) {
Object* result;
- { MaybeObject* maybe_result = AllocateRawAsciiString(length);
+ { MaybeObject* maybe_result = AllocateRawOneByteString(length);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
// Copy the characters into the new object.
@@ -3448,7 +3448,7 @@ MaybeObject* Heap::AllocateConsString(String* first, String* second) {
} else {
if (is_ascii_data_in_two_byte_string) {
Object* result;
- { MaybeObject* maybe_result = AllocateRawAsciiString(length);
+ { MaybeObject* maybe_result = AllocateRawOneByteString(length);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
// Copy the characters into the new object.
@@ -3519,16 +3519,16 @@ MaybeObject* Heap::AllocateSubString(String* buffer,
// WriteToFlat takes care of the case when an indirect string has a
// different encoding from its underlying string. These encodings may
// differ because of externalization.
- bool is_ascii = buffer->IsAsciiRepresentation();
+ bool is_ascii = buffer->IsOneByteRepresentation();
{ MaybeObject* maybe_result = is_ascii
- ? AllocateRawAsciiString(length, pretenure)
+ ? AllocateRawOneByteString(length, pretenure)
: AllocateRawTwoByteString(length, pretenure);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
String* string_result = String::cast(result);
// Copy the characters into the new object.
if (is_ascii) {
- ASSERT(string_result->IsAsciiRepresentation());
+ ASSERT(string_result->IsOneByteRepresentation());
char* dest = SeqOneByteString::cast(string_result)->GetChars();
String::WriteToFlat(buffer, dest, start, end);
} else {
@@ -3553,7 +3553,7 @@ MaybeObject* Heap::AllocateSubString(String* buffer,
// indirect ASCII string is pointing to a two-byte string, the two-byte char
// codes of the underlying string must still fit into ASCII (because
// externalization must not change char codes).
- { Map* map = buffer->IsAsciiRepresentation()
+ { Map* map = buffer->IsOneByteRepresentation()
? sliced_ascii_string_map()
: sliced_string_map();
MaybeObject* maybe_result = Allocate(map, NEW_SPACE);
@@ -4559,7 +4559,7 @@ MaybeObject* Heap::ReinitializeJSGlobalProxy(JSFunction* constructor,
}
-MaybeObject* Heap::AllocateStringFromAscii(Vector<const char> string,
+MaybeObject* Heap::AllocateStringFromOneByte(Vector<const char> string,
PretenureFlag pretenure) {
int length = string.length();
if (length == 1) {
@@ -4567,7 +4567,7 @@ MaybeObject* Heap::AllocateStringFromAscii(Vector<const char> string,
}
Object* result;
{ MaybeObject* maybe_result =
- AllocateRawAsciiString(string.length(), pretenure);
+ AllocateRawOneByteString(string.length(), pretenure);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
@@ -4625,7 +4625,7 @@ MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string,
const uc16* start = string.start();
if (String::IsAscii(start, length)) {
- MaybeObject* maybe_result = AllocateRawAsciiString(length, pretenure);
+ MaybeObject* maybe_result = AllocateRawOneByteString(length, pretenure);
if (!maybe_result->ToObject(&result)) return maybe_result;
CopyChars(SeqOneByteString::cast(result)->GetChars(), start, length);
} else { // It's not an ASCII string.
@@ -4726,7 +4726,8 @@ MaybeObject* Heap::AllocateInternalSymbol(unibrow::CharacterStream* buffer,
}
-MaybeObject* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) {
+MaybeObject* Heap::AllocateRawOneByteString(int length,
+ PretenureFlag pretenure) {
if (length < 0 || length > SeqOneByteString::kMaxLength) {
return Failure::OutOfMemoryException();
}
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698