diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2013-03-01 14:42:31 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-12 11:20:52 +0100 |
commit | 60f27761e2a0a32d148643a8884071970c911b3e (patch) | |
tree | b7795975c5e0511e650c57463ee5efdf821515af | |
parent | 74789955e363144418947d7711174083dbd14504 (diff) | |
download | qtjsbackend-60f27761e2a0a32d148643a8884071970c911b3e.tar.gz |
[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 <lars.knoll@digia.com>
-rw-r--r-- | src/3rdparty/v8/include/v8.h | 12 | ||||
-rw-r--r-- | src/3rdparty/v8/src/api.cc | 20 | ||||
-rw-r--r-- | src/3rdparty/v8/src/objects.cc | 66 | ||||
-rw-r--r-- | src/3rdparty/v8/src/objects.h | 3 |
4 files changed, 0 insertions, 101 deletions
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 @@ -1113,16 +1113,6 @@ class String : public Primitive { 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<Value> 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 * enough to hold the entire string and NULL terminator. Copies @@ -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<i::String> str = Utils::OpenHandle(this); - return str->Get(index); -} - - -bool String::Equals(uint16_t *string, int length) { - i::Handle<i::String> 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<i::String> 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<const char> vec1 = lhs_content.ToAsciiVector(); - VectorIterator<char> buf1(vec1); - VectorIterator<uc16> ib(string, length); - return CompareStringContents(&buf1, &ib); - } else { - Vector<const uc16> vec1 = lhs_content.ToUC16Vector(); - Vector<const uc16> vec2(string, length); - return CompareRawStringContents(vec1, vec2); - } - } else { - Isolate* isolate = GetIsolate(); - isolate->objects_string_compare_buffer_a()->Reset(0, lhs); - VectorIterator<uc16> 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<const char>(str1, len), - Vector<const char>(string, len)); - } - - if (lhs->IsFlat()) { - String::FlatContent lhs_content = lhs->GetFlatContent(); - Vector<const uc16> vec1 = lhs_content.ToUC16Vector(); - VectorIterator<const uc16> buf1(vec1); - VectorIterator<char> buf2(string, length); - return CompareStringContents(&buf1, &buf2); - } else { - Isolate* isolate = GetIsolate(); - isolate->objects_string_compare_buffer_a()->Reset(0, lhs); - VectorIterator<char> 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<const char> str); bool IsTwoByteEqualTo(Vector<const uc16> 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 |