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

Unified Diff: src/api.cc

Issue 6716023: Remove TLS fetches in v8::String API implementation. (Closed)
Patch Set: Created 9 years, 9 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 | « no previous file | no next file » | 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 667aa60b7ef0051d1ebb77913693e84e9233bd7e..b101dc3b3872bcc00f0e89bd42a91804fea55764 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3914,14 +3914,14 @@ Local<String> v8::String::New(const char* data, int length) {
Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) {
- i::Isolate* isolate = i::Isolate::Current();
- EnsureInitializedForIsolate(isolate, "v8::String::New()");
- LOG_API(isolate, "String::New(char)");
- ENTER_V8;
i::Handle<i::String> left_string = Utils::OpenHandle(*left);
+ i::Isolate* isolate = left_string->GetIsolate();
+ EnsureInitializedForIsolate(isolate, "v8::String::Concat()");
+ LOG_API(isolate, "String::Concat()");
+ ENTER_V8;
i::Handle<i::String> right_string = Utils::OpenHandle(*right);
- i::Handle<i::String> result = FACTORY->NewConsString(left_string,
- right_string);
+ i::Handle<i::String> result = isolate->factory()->NewConsString(left_string,
+ right_string);
return Utils::ToLocal(result);
}
@@ -3933,7 +3933,8 @@ Local<String> v8::String::NewUndetectable(const char* data, int length) {
ENTER_V8;
if (length == -1) length = i::StrLength(data);
i::Handle<i::String> result =
- FACTORY->NewStringFromUtf8(i::Vector<const char>(data, length));
+ isolate->factory()->NewStringFromUtf8(
+ i::Vector<const char>(data, length));
result->MarkAsUndetectable();
return Utils::ToLocal(result);
}
@@ -4003,11 +4004,11 @@ Local<String> v8::String::NewExternal(
bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Handle<i::String> obj = Utils::OpenHandle(this);
+ i::Isolate* isolate = obj->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
if (this->IsExternal()) return false; // Already an external string.
ENTER_V8;
- i::Handle<i::String> obj = Utils::OpenHandle(this);
if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
return false;
}
@@ -4033,11 +4034,11 @@ Local<String> v8::String::NewExternal(
bool v8::String::MakeExternal(
v8::String::ExternalAsciiStringResource* resource) {
- i::Isolate* isolate = i::Isolate::Current();
+ i::Handle<i::String> obj = Utils::OpenHandle(this);
+ i::Isolate* isolate = obj->GetIsolate();
if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
if (this->IsExternal()) return false; // Already an external string.
ENTER_V8;
- i::Handle<i::String> obj = Utils::OpenHandle(this);
if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
return false;
}
@@ -4050,9 +4051,9 @@ bool v8::String::MakeExternal(
bool v8::String::CanMakeExternal() {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false;
i::Handle<i::String> obj = Utils::OpenHandle(this);
+ i::Isolate* isolate = obj->GetIsolate();
+ if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false;
if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698