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

Unified Diff: src/builtins.cc

Issue 1679683004: Revert of Do not eagerly instantiate accessors' JSFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 86d84007791c5728216234a2e4bd2d05ce3ed48f..c0c5d58ee8f458f4103ebdd77bc99fd96e3934fb 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -59,8 +59,7 @@
return Arguments::at<Object>(0);
}
- template <class S>
- Handle<S> target();
+ Handle<JSFunction> target();
Handle<HeapObject> new_target();
// Gets the total number of arguments including the receiver (but
@@ -82,9 +81,8 @@
}
template <>
-template <class S>
-Handle<S> BuiltinArguments<BuiltinExtraArguments::kTarget>::target() {
- return Arguments::at<S>(Arguments::length() - 1);
+Handle<JSFunction> BuiltinArguments<BuiltinExtraArguments::kTarget>::target() {
+ return Arguments::at<JSFunction>(Arguments::length() - 1);
}
template <>
@@ -105,10 +103,9 @@
}
template <>
-template <class S>
-Handle<S>
+Handle<JSFunction>
BuiltinArguments<BuiltinExtraArguments::kTargetAndNewTarget>::target() {
- return Arguments::at<S>(Arguments::length() - 2);
+ return Arguments::at<JSFunction>(Arguments::length() - 2);
}
template <>
@@ -1942,7 +1939,7 @@
BUILTIN(GlobalEval) {
HandleScope scope(isolate);
Handle<Object> x = args.atOrUndefined(isolate, 1);
- Handle<JSFunction> target = args.target<JSFunction>();
+ Handle<JSFunction> target = args.target();
Handle<JSObject> target_global_proxy(target->global_proxy(), isolate);
if (!x->IsString()) return *x;
Handle<JSFunction> function;
@@ -2438,7 +2435,7 @@
BUILTIN(DateConstructor_ConstructStub) {
HandleScope scope(isolate);
int const argc = args.length() - 1;
- Handle<JSFunction> target = args.target<JSFunction>();
+ Handle<JSFunction> target = args.target();
Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
double time_val;
if (argc == 0) {
@@ -3322,7 +3319,7 @@
// Compile the string in the constructor and not a helper so that errors to
// come from here.
- Handle<JSFunction> target = args.target<JSFunction>();
+ Handle<JSFunction> target = args.target();
Handle<JSObject> target_global_proxy(target->global_proxy(), isolate);
Handle<JSFunction> function;
{
@@ -3507,7 +3504,7 @@
// ES6 section 24.1.2.1 ArrayBuffer ( length ) for the [[Call]] case.
BUILTIN(ArrayBufferConstructor) {
HandleScope scope(isolate);
- Handle<JSFunction> target = args.target<JSFunction>();
+ Handle<JSFunction> target = args.target();
DCHECK(*target == target->native_context()->array_buffer_fun() ||
*target == target->native_context()->shared_array_buffer_fun());
THROW_NEW_ERROR_RETURN_FAILURE(
@@ -3519,7 +3516,7 @@
// ES6 section 24.1.2.1 ArrayBuffer ( length ) for the [[Construct]] case.
BUILTIN(ArrayBufferConstructor_ConstructStub) {
HandleScope scope(isolate);
- Handle<JSFunction> target = args.target<JSFunction>();
+ Handle<JSFunction> target = args.target();
Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
Handle<Object> length = args.atOrUndefined(isolate, 1);
DCHECK(*target == target->native_context()->array_buffer_fun() ||
@@ -3616,16 +3613,13 @@
MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
Isolate* isolate, BuiltinArguments<BuiltinExtraArguments::kTarget> args) {
HandleScope scope(isolate);
- Handle<HeapObject> function = args.target<HeapObject>();
+ Handle<JSFunction> function = args.target();
Handle<JSReceiver> receiver;
// TODO(ishell): turn this back to a DCHECK.
- CHECK(function->IsFunctionTemplateInfo() ||
- Handle<JSFunction>::cast(function)->shared()->IsApiFunction());
-
- Handle<FunctionTemplateInfo> fun_data =
- function->IsFunctionTemplateInfo()
- ? Handle<FunctionTemplateInfo>::cast(function)
- : handle(JSFunction::cast(*function)->shared()->get_api_func_data());
+ CHECK(function->shared()->IsApiFunction());
+
+ Handle<FunctionTemplateInfo> fun_data(
+ function->shared()->get_api_func_data(), isolate);
if (is_construct) {
DCHECK(args.receiver()->IsTheHole());
if (fun_data->instance_template()->IsUndefined()) {
@@ -3812,7 +3806,8 @@
} // namespace
-MaybeHandle<Object> Builtins::InvokeApiFunction(Handle<HeapObject> function,
+
+MaybeHandle<Object> Builtins::InvokeApiFunction(Handle<JSFunction> 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