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

Unified Diff: src/api.cc

Issue 11931013: Revert trunk to version 3.16.4. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 11 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 | « include/v8.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ---
« no previous file with comments | « include/v8.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698