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

Unified Diff: src/builtins.cc

Issue 1609233002: Do not eagerly instantiate accessors' JSFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 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 | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 35671d2c4c813c5adccd36ca989e9f101e6cb092..d8a7a8f51b02d632fdfa18dc5e94a9357657ba21 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -82,7 +82,8 @@ int BuiltinArguments<BuiltinExtraArguments::kTarget>::length() const {
template <>
Handle<JSFunction> BuiltinArguments<BuiltinExtraArguments::kTarget>::target() {
- return Arguments::at<JSFunction>(Arguments::length() - 1);
+ return Handle<JSFunction>(reinterpret_cast<JSFunction*>(
+ Arguments::operator[](Arguments::length() - 1)));
}
template <>
@@ -3404,13 +3405,19 @@ template <bool is_construct>
MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
Isolate* isolate, BuiltinArguments<BuiltinExtraArguments::kTarget> args) {
HandleScope scope(isolate);
- Handle<JSFunction> function = args.target();
+ Handle<HeapObject> function = args.target();
DCHECK(args.receiver()->IsJSReceiver());
// TODO(ishell): turn this back to a DCHECK.
- CHECK(function->shared()->IsApiFunction());
-
- Handle<FunctionTemplateInfo> fun_data(
- function->shared()->get_api_func_data(), isolate);
+ CHECK(function->IsFunctionTemplateInfo() ||
+ Handle<JSFunction>::cast(function)->shared()->IsApiFunction());
+
+ Handle<FunctionTemplateInfo> fun_data =
+ function->IsFunctionTemplateInfo()
+ ? Handle<FunctionTemplateInfo>::cast(function)
+ : Handle<FunctionTemplateInfo>(Handle<JSFunction>::cast(function)
Toon Verwaest 2016/01/22 12:11:36 Shorter: handle(JSFunction::cast(*function)->share
epertoso 2016/01/22 14:36:35 Done.
+ ->shared()
+ ->get_api_func_data(),
+ isolate);
if (is_construct) {
ASSIGN_RETURN_ON_EXCEPTION(
isolate, fun_data,
@@ -3548,7 +3555,7 @@ class RelocatableArguments
} // namespace
-MaybeHandle<Object> Builtins::InvokeApiFunction(Handle<JSFunction> function,
+MaybeHandle<Object> Builtins::InvokeApiFunction(Handle<HeapObject> function,
Handle<Object> receiver,
int argc,
Handle<Object> args[]) {
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698