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

Unified Diff: src/stub-cache.h

Issue 3291015: Custom call IC for String.fromCharCode. (Closed)
Patch Set: Removed todo Created 10 years, 3 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
Index: src/stub-cache.h
diff --git a/src/stub-cache.h b/src/stub-cache.h
index bf14a4fe28c49517474729fa2153e75396a6bfe3..388bb52ca689865f2715be15bfa1c98c6328022b 100644
--- a/src/stub-cache.h
+++ b/src/stub-cache.h
@@ -612,21 +612,29 @@ class KeyedStoreStubCompiler: public StubCompiler {
// 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) \
- V(string, charCodeAt, StringCharCodeAt) \
- V(string, charAt, StringCharAt)
+// Each entry has a name of a global function (lowercased), a flag
+// controlling whether the generator is set on the function itself or
+// on its instance prototype, a name of a builtin function on the
+// function or 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, INSTANCE_PROTOTYPE, push, ArrayPush) \
+ V(array, INSTANCE_PROTOTYPE, pop, ArrayPop) \
+ V(string, INSTANCE_PROTOTYPE, charCodeAt, StringCharCodeAt) \
+ V(string, INSTANCE_PROTOTYPE, charAt, StringCharAt) \
+ V(string, FUNCTION, fromCharCode, StringFromCharCode)
class CallStubCompiler: public StubCompiler {
public:
+ enum CustomGeneratorOwner {
+ FUNCTION,
+ INSTANCE_PROTOTYPE
+ };
+
enum {
-#define DECLARE_CALL_GENERATOR_ID(ignored1, ignored2, name) \
+#define DECLARE_CALL_GENERATOR_ID(ignored1, ignore2, ignored3, name) \
k##name##CallGenerator,
CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID)
#undef DECLARE_CALL_GENERATOR_ID
@@ -656,20 +664,21 @@ class CallStubCompiler: public StubCompiler {
JSFunction* function,
String* name);
- // Compiles a custom call constant IC using the generator with given id.
+ // Compiles a custom call constant/global IC using the generator
+ // with given id. For constant calls cell is NULL.
Object* CompileCustomCall(int generator_id,
Object* object,
JSObject* holder,
+ JSGlobalPropertyCell* cell,
JSFunction* function,
- String* name,
- CheckType check);
+ String* name);
-#define DECLARE_CALL_GENERATOR(ignored1, ignored2, name) \
- Object* Compile##name##Call(Object* object, \
- JSObject* holder, \
- JSFunction* function, \
- String* fname, \
- CheckType check);
+#define DECLARE_CALL_GENERATOR(ignored1, ignored2, ignored3, name) \
+ Object* Compile##name##Call(Object* object, \
+ JSObject* holder, \
+ JSGlobalPropertyCell* cell, \
+ JSFunction* function, \
+ String* fname);
CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR)
#undef DECLARE_CALL_GENERATOR
@@ -689,6 +698,17 @@ class CallStubCompiler: public StubCompiler {
void GenerateNameCheck(String* name, Label* miss);
+ void GenerateGlobalReceiverCheck(JSObject* object,
+ JSObject* holder,
+ String* name,
+ Label* miss);
+
+ // Generates code to load the function from the cell checking that
+ // it still contains the same function.
+ void GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell,
+ JSFunction* function,
+ Label* miss);
+
// Generates a jump to CallIC miss stub. Returns Failure if the jump cannot
// be generated.
Object* GenerateMissBranch();

Powered by Google App Engine
This is Rietveld 408576698