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

Unified Diff: src/bootstrapper.cc

Issue 1540953004: [runtime] Rewrite Function.prototype.toString in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typos. Created 5 years 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
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 4409d935229c792c59d0039a7d8ad205f0357fc4..56e9676c14dcb64d7af747a4cefc0e2db920db27 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2513,7 +2513,7 @@ bool Genesis::InstallNatives(ContextType context_type) {
// Set the lengths for the functions to satisfy ECMA-262.
concat->shared()->set_length(1);
}
- // Install Function.prototype.call and apply.
+ // Install Function.prototype.apply, call, and toString.
{
Handle<String> key = factory()->Function_string();
Handle<JSFunction> function =
@@ -2522,24 +2522,13 @@ bool Genesis::InstallNatives(ContextType context_type) {
Handle<JSObject> proto =
Handle<JSObject>(JSObject::cast(function->instance_prototype()));
- // Install the call and the apply functions.
- Handle<JSFunction> call =
- InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize,
- MaybeHandle<JSObject>(), Builtins::kFunctionCall);
- Handle<JSFunction> apply =
- InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize,
- MaybeHandle<JSObject>(), Builtins::kFunctionApply);
-
- // Make sure that Function.prototype.call appears to be compiled.
- // The code will never be called, but inline caching for call will
- // only work if it appears to be compiled.
- apply->shared()->DontAdaptArguments();
- call->shared()->DontAdaptArguments();
- DCHECK(call->is_compiled());
-
- // Set the lengths for the functions to satisfy ECMA-262.
- apply->shared()->set_length(2);
- call->shared()->set_length(1);
+ // Install the apply, call and toString functions.
+ SimpleInstallFunction(proto, factory()->apply_string(),
+ Builtins::kFunctionPrototypeApply, 2, false);
+ SimpleInstallFunction(proto, factory()->call_string(),
+ Builtins::kFunctionPrototypeCall, 1, false);
+ SimpleInstallFunction(proto, factory()->toString_string(),
+ Builtins::kFunctionPrototypeToString, 0, false);
}
// Set up the Promise constructor.
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('j') | src/debug/mirrors.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698