From 60f27761e2a0a32d148643a8884071970c911b3e Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Fri, 1 Mar 2013 14:42:31 +0100 Subject: [V8] Remove unnecessary string manipulation methods These methods were used in QtDeclarative but more "V8-friendly" implementations are used now. This change should be squashed into the "[V8] Add hashing and comparison methods to v8::String" commit (566a226893aaba42d7e1f5522b9d80c1cc9dc2a3) in the next V8 rebase. Change-Id: I996480619b6622060c725d88015223f28336ae64 Reviewed-by: Lars Knoll --- src/3rdparty/v8/include/v8.h | 12 -------- src/3rdparty/v8/src/api.cc | 20 ------------- src/3rdparty/v8/src/objects.cc | 66 ------------------------------------------ src/3rdparty/v8/src/objects.h | 3 -- 4 files changed, 101 deletions(-) (limited to 'src') diff --git a/src/3rdparty/v8/include/v8.h b/src/3rdparty/v8/include/v8.h index 6e3cc7a..27c5855 100644 --- a/src/3rdparty/v8/include/v8.h +++ b/src/3rdparty/v8/include/v8.h @@ -1112,16 +1112,6 @@ class String : public Primitive { V8EXPORT static uint32_t ComputeHash(uint16_t *string, int length); V8EXPORT static uint32_t ComputeHash(char *string, int length); - /** - * Returns true if this string is equal to the external - * string data provided. - */ - V8EXPORT bool Equals(uint16_t *string, int length); - V8EXPORT bool Equals(char *string, int length); - inline bool Equals(Handle that) const { - return v8::Value::Equals(that); - } - /** * Write the contents of the string to an external buffer. * If no arguments are given, expects the buffer to be large @@ -1154,8 +1144,6 @@ class String : public Primitive { PRESERVE_ASCII_NULL = 4 }; - V8EXPORT uint16_t GetCharacter(int index); - // 16-bit character codes. V8EXPORT int Write(uint16_t* buffer, int start = 0, diff --git a/src/3rdparty/v8/src/api.cc b/src/3rdparty/v8/src/api.cc index ea3f59e..cbb3a04 100644 --- a/src/3rdparty/v8/src/api.cc +++ b/src/3rdparty/v8/src/api.cc @@ -4004,26 +4004,6 @@ uint32_t String::ComputeHash(char *string, int length) { } -uint16_t String::GetCharacter(int index) { - i::Handle str = Utils::OpenHandle(this); - return str->Get(index); -} - - -bool String::Equals(uint16_t *string, int length) { - i::Handle str = Utils::OpenHandle(this); - if (IsDeadCheck(str->GetIsolate(), "v8::String::Equals()")) return 0; - return str->SlowEqualsExternal(string, length); -} - - -bool String::Equals(char *string, int length) { - i::Handle str = Utils::OpenHandle(this); - if (IsDeadCheck(str->GetIsolate(), "v8::String::Equals()")) return 0; - return str->SlowEqualsExternal(string, length); -} - - int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref, diff --git a/src/3rdparty/v8/src/objects.cc b/src/3rdparty/v8/src/objects.cc index 4273eff..0d3836b 100644 --- a/src/3rdparty/v8/src/objects.cc +++ b/src/3rdparty/v8/src/objects.cc @@ -7367,72 +7367,6 @@ static inline bool CompareStringContentsPartial(Isolate* isolate, } -bool String::SlowEqualsExternal(uc16 *string, int length) { - int len = this->length(); - if (len != length) return false; - if (len == 0) return true; - - // We know the strings are both non-empty. Compare the first chars - // before we try to flatten the strings. - if (this->Get(0) != string[0]) return false; - - String* lhs = this->TryFlattenGetString(); - - if (lhs->IsFlat()) { - String::FlatContent lhs_content = lhs->GetFlatContent(); - if (lhs->IsAsciiRepresentation()) { - Vector vec1 = lhs_content.ToAsciiVector(); - VectorIterator buf1(vec1); - VectorIterator ib(string, length); - return CompareStringContents(&buf1, &ib); - } else { - Vector vec1 = lhs_content.ToUC16Vector(); - Vector vec2(string, length); - return CompareRawStringContents(vec1, vec2); - } - } else { - Isolate* isolate = GetIsolate(); - isolate->objects_string_compare_buffer_a()->Reset(0, lhs); - VectorIterator ib(string, length); - return CompareStringContents(isolate->objects_string_compare_buffer_a(), - &ib); - } -} - - -bool String::SlowEqualsExternal(char *string, int length) { - int len = this->length(); - if (len != length) return false; - if (len == 0) return true; - - // We know the strings are both non-empty. Compare the first chars - // before we try to flatten the strings. - if (this->Get(0) != string[0]) return false; - - String* lhs = this->TryFlattenGetString(); - - if (StringShape(lhs).IsSequentialAscii()) { - const char* str1 = SeqAsciiString::cast(lhs)->GetChars(); - return CompareRawStringContents(Vector(str1, len), - Vector(string, len)); - } - - if (lhs->IsFlat()) { - String::FlatContent lhs_content = lhs->GetFlatContent(); - Vector vec1 = lhs_content.ToUC16Vector(); - VectorIterator buf1(vec1); - VectorIterator buf2(string, length); - return CompareStringContents(&buf1, &buf2); - } else { - Isolate* isolate = GetIsolate(); - isolate->objects_string_compare_buffer_a()->Reset(0, lhs); - VectorIterator ib(string, length); - return CompareStringContents(isolate->objects_string_compare_buffer_a(), - &ib); - } -} - - bool String::SlowEquals(String* other) { // Fast check: negative check with lengths. int len = length(); diff --git a/src/3rdparty/v8/src/objects.h b/src/3rdparty/v8/src/objects.h index 8d826c0..fe9655a 100644 --- a/src/3rdparty/v8/src/objects.h +++ b/src/3rdparty/v8/src/objects.h @@ -7355,9 +7355,6 @@ class String: public HeapObject { bool IsAsciiEqualTo(Vector str); bool IsTwoByteEqualTo(Vector str); - bool SlowEqualsExternal(uc16 *string, int length); - bool SlowEqualsExternal(char *string, int length); - // Return a UTF8 representation of the string. The string is null // terminated but may optionally contain nulls. Length is returned // in length_output if length_output is not a null pointer The string -- cgit v1.2.1