Commit 78bf1bff authored by neis's avatar neis Committed by Commit bot

Minor cleanup: remove an unused declaration, reuse some others.

BUG=

Review-Url: https://codereview.chromium.org/2149763004
Cr-Commit-Position: refs/heads/master@{#37774}
parent 1c1bdfe1
...@@ -1787,13 +1787,11 @@ ScriptCompiler::StreamedSource::GetCachedData() const { ...@@ -1787,13 +1787,11 @@ ScriptCompiler::StreamedSource::GetCachedData() const {
Local<Script> UnboundScript::BindToCurrentContext() { Local<Script> UnboundScript::BindToCurrentContext() {
i::Handle<i::HeapObject> obj = i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Handle<i::SharedFunctionInfo>
function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate());
i::Isolate* isolate = obj->GetIsolate(); i::Isolate* isolate = obj->GetIsolate();
i::Handle<i::SharedFunctionInfo> function_info(
i::Handle<i::JSReceiver> global(isolate->native_context()->global_object()); i::SharedFunctionInfo::cast(*obj), isolate);
i::Handle<i::JSFunction> function = i::Handle<i::JSFunction> function =
obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo( isolate->factory()->NewFunctionFromSharedFunctionInfo(
function_info, isolate->native_context()); function_info, isolate->native_context());
return ToApiHandle<Script>(function); return ToApiHandle<Script>(function);
} }
...@@ -5267,10 +5265,10 @@ int String::WriteUtf8(char* buffer, ...@@ -5267,10 +5265,10 @@ int String::WriteUtf8(char* buffer,
int capacity, int capacity,
int* nchars_ref, int* nchars_ref,
int options) const { int options) const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Handle<i::String> str = Utils::OpenHandle(this);
i::Isolate* isolate = str->GetIsolate();
LOG_API(isolate, String, WriteUtf8); LOG_API(isolate, String, WriteUtf8);
ENTER_V8(isolate); ENTER_V8(isolate);
i::Handle<i::String> str = Utils::OpenHandle(this);
if (options & HINT_MANY_WRITES_EXPECTED) { if (options & HINT_MANY_WRITES_EXPECTED) {
str = i::String::Flatten(str); // Flatten the string for efficiency. str = i::String::Flatten(str); // Flatten the string for efficiency.
} }
...@@ -5286,7 +5284,7 @@ int String::WriteUtf8(char* buffer, ...@@ -5286,7 +5284,7 @@ int String::WriteUtf8(char* buffer,
if (success) return writer.CompleteWrite(write_null, nchars_ref); if (success) return writer.CompleteWrite(write_null, nchars_ref);
} else if (capacity >= string_length) { } else if (capacity >= string_length) {
// First check that the buffer is large enough. // First check that the buffer is large enough.
int utf8_bytes = v8::Utf8Length(*str, str->GetIsolate()); int utf8_bytes = v8::Utf8Length(*str, isolate);
if (utf8_bytes <= capacity) { if (utf8_bytes <= capacity) {
// one-byte fast path. // one-byte fast path.
if (utf8_bytes == string_length) { if (utf8_bytes == string_length) {
...@@ -6871,7 +6869,7 @@ void v8::ArrayBuffer::Neuter() { ...@@ -6871,7 +6869,7 @@ void v8::ArrayBuffer::Neuter() {
"Only externalized ArrayBuffers can be neutered"); "Only externalized ArrayBuffers can be neutered");
Utils::ApiCheck(obj->is_neuterable(), "v8::ArrayBuffer::Neuter", Utils::ApiCheck(obj->is_neuterable(), "v8::ArrayBuffer::Neuter",
"Only neuterable ArrayBuffers can be neutered"); "Only neuterable ArrayBuffers can be neutered");
LOG_API(obj->GetIsolate(), ArrayBuffer, Neuter); LOG_API(isolate, ArrayBuffer, Neuter);
ENTER_V8(isolate); ENTER_V8(isolate);
obj->Neuter(); obj->Neuter();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment