| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index d6adf6210f3e5dfd8bc3594a1d5b7d5808cf4ab0..0563443b8bdf1248a2b3bf78bd837bceb406c6d2 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -1862,7 +1862,8 @@ v8::Local<Value> v8::TryCatch::StackTrace() const {
|
| if (!raw_obj->IsJSObject()) return v8::Local<Value>();
|
| i::HandleScope scope(isolate_);
|
| i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
|
| - i::Handle<i::String> name = isolate_->factory()->stack_symbol();
|
| + i::Handle<i::String> name =
|
| + isolate_->factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stack"));
|
| if (!obj->HasProperty(*name)) return v8::Local<Value>();
|
| i::Handle<i::Object> value = i::GetProperty(obj, name);
|
| if (value.is_null()) return v8::Local<Value>();
|
| @@ -3892,15 +3893,6 @@ bool String::MayContainNonAscii() const {
|
| }
|
|
|
|
|
| -bool String::IsOneByte() const {
|
| - i::Handle<i::String> str = Utils::OpenHandle(this);
|
| - if (IsDeadCheck(str->GetIsolate(), "v8::String::IsOneByte()")) {
|
| - return false;
|
| - }
|
| - return str->IsOneByteConvertible();
|
| -}
|
| -
|
| -
|
| class Utf8LengthVisitor {
|
| public:
|
| explicit Utf8LengthVisitor()
|
| @@ -4202,52 +4194,32 @@ int String::WriteAscii(char* buffer,
|
| }
|
|
|
|
|
| -template<typename CharType>
|
| -struct WriteHelper {
|
| - static inline int Write(const String* string,
|
| - CharType* buffer,
|
| - int start,
|
| - int length,
|
| - int options) {
|
| - i::Isolate* isolate = Utils::OpenHandle(string)->GetIsolate();
|
| - if (IsDeadCheck(isolate, "v8::String::Write()")) return 0;
|
| - LOG_API(isolate, "String::Write");
|
| - ENTER_V8(isolate);
|
| - ASSERT(start >= 0 && length >= -1);
|
| - i::Handle<i::String> str = Utils::OpenHandle(string);
|
| - isolate->string_tracker()->RecordWrite(str);
|
| - if (options & String::HINT_MANY_WRITES_EXPECTED) {
|
| - // Flatten the string for efficiency. This applies whether we are
|
| - // using StringCharacterStream or Get(i) to access the characters.
|
| - FlattenString(str);
|
| - }
|
| - int end = start + length;
|
| - if ((length == -1) || (length > str->length() - start) )
|
| - end = str->length();
|
| - if (end < 0) return 0;
|
| - i::String::WriteToFlat(*str, buffer, start, end);
|
| - if (!(options & String::NO_NULL_TERMINATION) &&
|
| - (length == -1 || end - start < length)) {
|
| - buffer[end - start] = '\0';
|
| - }
|
| - return end - start;
|
| - }
|
| -};
|
| -
|
| -
|
| -int String::WriteOneByte(uint8_t* buffer,
|
| - int start,
|
| - int length,
|
| - int options) const {
|
| - return WriteHelper<uint8_t>::Write(this, buffer, start, length, options);
|
| -}
|
| -
|
| -
|
| int String::Write(uint16_t* buffer,
|
| int start,
|
| int length,
|
| int options) const {
|
| - return WriteHelper<uint16_t>::Write(this, buffer, start, length, options);
|
| + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
|
| + if (IsDeadCheck(isolate, "v8::String::Write()")) return 0;
|
| + LOG_API(isolate, "String::Write");
|
| + ENTER_V8(isolate);
|
| + ASSERT(start >= 0 && length >= -1);
|
| + i::Handle<i::String> str = Utils::OpenHandle(this);
|
| + isolate->string_tracker()->RecordWrite(str);
|
| + if (options & HINT_MANY_WRITES_EXPECTED) {
|
| + // Flatten the string for efficiency. This applies whether we are
|
| + // using StringCharacterStream or Get(i) to access the characters.
|
| + FlattenString(str);
|
| + }
|
| + int end = start + length;
|
| + if ((length == -1) || (length > str->length() - start) )
|
| + end = str->length();
|
| + if (end < 0) return 0;
|
| + i::String::WriteToFlat(*str, buffer, start, end);
|
| + if (!(options & NO_NULL_TERMINATION) &&
|
| + (length == -1 || end - start < length)) {
|
| + buffer[end - start] = '\0';
|
| + }
|
| + return end - start;
|
| }
|
|
|
|
|
| @@ -4435,6 +4407,14 @@ static void* ExternalValue(i::Object* obj) {
|
| }
|
|
|
|
|
| +void* Object::GetPointerFromInternalField(int index) {
|
| + i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
|
| + const char* location = "v8::Object::GetPointerFromInternalField()";
|
| + if (!InternalFieldOK(obj, index, location)) return NULL;
|
| + return ExternalValue(obj->GetInternalField(index));
|
| +}
|
| +
|
| +
|
| // --- E n v i r o n m e n t ---
|
|
|
|
|
|
|