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

Unified Diff: src/accessors.cc

Issue 2095953002: Refactor CreateApiFunction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Create the template instantiation cache early enough Created 4 years, 6 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 | src/api-natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index 74238eb168e832952a608d24f2da66fffcea172d..73665fa036a081fcea2fa192100ba2be6688a7ed 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -664,29 +664,10 @@ Handle<AccessorInfo> Accessors::ScriptEvalFromFunctionNameInfo(
// Accessors::FunctionPrototype
//
-static Handle<Object> GetFunctionPrototype(Isolate* isolate,
- Handle<JSFunction> function) {
- if (!function->has_prototype()) {
- Handle<Object> proto = isolate->factory()->NewFunctionPrototype(function);
- JSFunction::SetPrototype(function, proto);
- }
- return Handle<Object>(function->prototype(), isolate);
-}
-
-
-MUST_USE_RESULT static MaybeHandle<Object> SetFunctionPrototype(
- Isolate* isolate, Handle<JSFunction> function, Handle<Object> value) {
- JSFunction::SetPrototype(function, value);
- DCHECK(function->prototype() == *value);
- return function;
-}
-
-
MaybeHandle<Object> Accessors::FunctionSetPrototype(Handle<JSFunction> function,
Handle<Object> prototype) {
- DCHECK(function->IsConstructor());
- Isolate* isolate = function->GetIsolate();
- return SetFunctionPrototype(isolate, function, prototype);
+ JSFunction::SetPrototype(function, prototype);
+ return function;
}
@@ -697,7 +678,7 @@ void Accessors::FunctionPrototypeGetter(
HandleScope scope(isolate);
Handle<JSFunction> function =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
- Handle<Object> result = GetFunctionPrototype(isolate, function);
+ Handle<Object> result = JSFunction::GetPrototype(isolate, function);
info.GetReturnValue().Set(Utils::ToLocal(result));
}
@@ -711,9 +692,7 @@ void Accessors::FunctionPrototypeSetter(
Handle<Object> value = Utils::OpenHandle(*val);
Handle<JSFunction> object =
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder()));
- if (SetFunctionPrototype(isolate, object, value).is_null()) {
- isolate->OptionalRescheduleException(false);
- }
+ JSFunction::SetPrototype(object, value);
}
« no previous file with comments | « no previous file | src/api-natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698