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

Unified Diff: src/bootstrapper.cc

Issue 1981002: Refactored custom call IC generators: (Closed)
Patch Set: Review fixes. Created 10 years, 7 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/assembler.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 657d0dc3dac7acc3ec7084b22c66aafd583569ba..df1e98a66b0ec7c63a5f7ea9ff2f2d42cfbdbd5f 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -37,6 +37,7 @@
#include "macro-assembler.h"
#include "natives.h"
#include "snapshot.h"
+#include "stub-cache.h"
namespace v8 {
namespace internal {
@@ -228,6 +229,7 @@ class Genesis BASE_EMBEDDED {
// Used for creating a context from scratch.
void InstallNativeFunctions();
bool InstallNatives();
+ void InstallCustomCallGenerators();
void InstallJSFunctionResultCaches();
// Used both for deserialized and from-scratch contexts to add the extensions
// provided.
@@ -1229,6 +1231,8 @@ bool Genesis::InstallNatives() {
InstallNativeFunctions();
+ InstallCustomCallGenerators();
+
// Install Function.prototype.call and apply.
{ Handle<String> key = Factory::function_class_symbol();
Handle<JSFunction> function =
@@ -1326,6 +1330,29 @@ bool Genesis::InstallNatives() {
}
+static void InstallCustomCallGenerator(Handle<JSFunction> holder_function,
+ const char* function_name,
+ int id) {
+ Handle<JSObject> proto(JSObject::cast(holder_function->instance_prototype()));
+ Handle<String> name = Factory::LookupAsciiSymbol(function_name);
+ Handle<JSFunction> function(JSFunction::cast(proto->GetProperty(*name)));
+ function->shared()->set_function_data(Smi::FromInt(id));
+}
+
+
+void Genesis::InstallCustomCallGenerators() {
+ HandleScope scope;
+#define INSTALL_CALL_GENERATOR(holder_fun, fun_name, name) \
+ { \
+ Handle<JSFunction> holder(global_context()->holder_fun##_function()); \
+ const int id = CallStubCompiler::k##name##CallGenerator; \
+ InstallCustomCallGenerator(holder, #fun_name, id); \
+ }
+ CUSTOM_CALL_IC_GENERATORS(INSTALL_CALL_GENERATOR)
+#undef INSTALL_CALL_GENERATOR
+}
+
+
// Do not forget to update macros.py with named constant
// of cache id.
#define JSFUNCTION_RESULT_CACHE_LIST(F) \
« no previous file with comments | « src/assembler.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698