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

Unified Diff: src/stub-cache.h

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/serialize.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache.h
diff --git a/src/stub-cache.h b/src/stub-cache.h
index 2e0faf6a897b2fee0f8401e0300dd1f23c178012..45aaf75c91796a35ad6fbb29330eed2df088e5c2 100644
--- a/src/stub-cache.h
+++ b/src/stub-cache.h
@@ -559,8 +559,30 @@ class KeyedStoreStubCompiler: public StubCompiler {
};
+// List of functions with custom constant call IC stubs.
+//
+// Installation of custom call generators for the selected builtins is
+// handled by the bootstrapper.
+//
+// Each entry has a name of a global function (lowercased), a name of
+// a builtin function on its instance prototype (the one the generator
+// is set for), and a name of a generator itself (used to build ids
+// and generator function names).
+#define CUSTOM_CALL_IC_GENERATORS(V) \
+ V(array, push, ArrayPush) \
+ V(array, pop, ArrayPop)
+
+
class CallStubCompiler: public StubCompiler {
public:
+ enum {
+#define DECLARE_CALL_GENERATOR_ID(ignored1, ignored2, name) \
+ k##name##CallGenerator,
+ CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID)
+#undef DECLARE_CALL_GENERATOR_ID
+ kNumCallGenerators
+ };
+
CallStubCompiler(int argc, InLoopFlag in_loop)
: arguments_(argc), in_loop_(in_loop) { }
@@ -582,17 +604,22 @@ class CallStubCompiler: public StubCompiler {
JSFunction* function,
String* name);
- Object* CompileArrayPushCall(Object* object,
- JSObject* holder,
- JSFunction* function,
- String* name,
- CheckType check);
+ // Compiles a custom call constant IC using the generator with given id.
+ Object* CompileCustomCall(int generator_id,
+ Object* object,
+ JSObject* holder,
+ JSFunction* function,
+ String* name,
+ CheckType check);
- Object* CompileArrayPopCall(Object* object,
- JSObject* holder,
- JSFunction* function,
- String* name,
+#define DECLARE_CALL_GENERATOR(ignored1, ignored2, name) \
+ Object* Compile##name##Call(Object* object, \
+ JSObject* holder, \
+ JSFunction* function, \
+ String* fname, \
CheckType check);
+ CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR)
+#undef DECLARE_CALL_GENERATOR
private:
const ParameterCount arguments_;
@@ -601,6 +628,10 @@ class CallStubCompiler: public StubCompiler {
const ParameterCount& arguments() { return arguments_; }
Object* GetCode(PropertyType type, String* name);
+
+ // Convenience function. Calls GetCode above passing
+ // CONSTANT_FUNCTION type and the name of the given function.
+ Object* GetCode(JSFunction* function);
};
@@ -663,31 +694,6 @@ class CallOptimization BASE_EMBEDDED {
CallHandlerInfo* api_call_info_;
};
-
-typedef Object* (*CustomCallGenerator)(CallStubCompiler* compiler,
- Object* object,
- JSObject* holder,
- JSFunction* function,
- String* name,
- StubCompiler::CheckType check);
-
-
-Object* CompileArrayPushCall(CallStubCompiler* compiler,
- Object* object,
- JSObject* holder,
- JSFunction* function,
- String* name,
- StubCompiler::CheckType check);
-
-
-Object* CompileArrayPopCall(CallStubCompiler* compiler,
- Object* object,
- JSObject* holder,
- JSFunction* function,
- String* name,
- StubCompiler::CheckType check);
-
-
} } // namespace v8::internal
#endif // V8_STUB_CACHE_H_
« no previous file with comments | « src/serialize.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698