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

Unified Diff: src/api.cc

Issue 1871503002: Lazily compute boundfunction .name and .length if possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed Created 4 years, 8 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 | « src/accessors.cc ('k') | src/bootstrapper.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 3e52cc0e6fd61cf0607644ae4cde52316685010e..bfc5d3e1023aaa8b70919008f9a8b3848461023c 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4505,16 +4505,20 @@ void Function::SetName(v8::Local<v8::String> name) {
Local<Value> Function::GetName() const {
auto self = Utils::OpenHandle(this);
+ i::Isolate* isolate = self->GetIsolate();
if (self->IsJSBoundFunction()) {
auto func = i::Handle<i::JSBoundFunction>::cast(self);
- return Utils::ToLocal(handle(func->name(), func->GetIsolate()));
+ i::Handle<i::Object> name;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, name,
+ i::JSBoundFunction::GetName(isolate, func),
+ Local<Value>());
+ return Utils::ToLocal(name);
}
if (self->IsJSFunction()) {
auto func = i::Handle<i::JSFunction>::cast(self);
- return Utils::ToLocal(handle(func->shared()->name(), func->GetIsolate()));
+ return Utils::ToLocal(handle(func->shared()->name(), isolate));
}
- return ToApiHandle<Primitive>(
- self->GetIsolate()->factory()->undefined_value());
+ return ToApiHandle<Primitive>(isolate->factory()->undefined_value());
}
« no previous file with comments | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698