diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 13:52:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:41:47 +0100 |
commit | b0fe1620dcb4135ac3ab2d66ff93072373911299 (patch) | |
tree | 3487cdc7e01ec56a6f84ea20f4bae596a0b73986 /src/stub-cache.h | |
parent | df5bff59602802b769e994b0dc1d8869a27fa40c (diff) | |
download | android_external_v8-b0fe1620dcb4135ac3ab2d66ff93072373911299.tar.gz android_external_v8-b0fe1620dcb4135ac3ab2d66ff93072373911299.tar.bz2 android_external_v8-b0fe1620dcb4135ac3ab2d66ff93072373911299.zip |
Update V8 to r6101 as required by WebKit r74534
Change-Id: I7f84af8dd732f11898fd644b2c2b1538914cb78d
Diffstat (limited to 'src/stub-cache.h')
-rw-r--r-- | src/stub-cache.h | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/src/stub-cache.h b/src/stub-cache.h index cef5481c..a7829a60 100644 --- a/src/stub-cache.h +++ b/src/stub-cache.h @@ -29,6 +29,7 @@ #define V8_STUB_CACHE_H_ #include "macro-assembler.h" +#include "zone-inl.h" namespace v8 { namespace internal { @@ -44,6 +45,7 @@ namespace internal { class SCTableReference; + class StubCache : public AllStatic { public: struct Entry { @@ -76,9 +78,10 @@ class StubCache : public AllStatic { JSObject* holder, Object* value); - MUST_USE_RESULT static MaybeObject* ComputeLoadInterceptor(String* name, - JSObject* receiver, - JSObject* holder); + MUST_USE_RESULT static MaybeObject* ComputeLoadInterceptor( + String* name, + JSObject* receiver, + JSObject* holder); MUST_USE_RESULT static MaybeObject* ComputeLoadNormal(); @@ -127,6 +130,9 @@ class StubCache : public AllStatic { String* name, JSFunction* receiver); + MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadSpecialized( + JSObject* receiver); + // --- MUST_USE_RESULT static MaybeObject* ComputeStoreField(String* name, @@ -158,6 +164,9 @@ class StubCache : public AllStatic { int field_index, Map* transition = NULL); + MUST_USE_RESULT static MaybeObject* ComputeKeyedStoreSpecialized( + JSObject* receiver); + // --- MUST_USE_RESULT static MaybeObject* ComputeCallField(int argc, @@ -244,6 +253,11 @@ class StubCache : public AllStatic { // Clear the lookup table (@ mark compact collection). static void Clear(); + // Collect all maps that match the name and flags. + static void CollectMatchingMaps(ZoneMapList* types, + String* name, + Code::Flags flags); + // Generate code for probing the stub cache table. // Arguments extra and extra2 may be used to pass additional scratch // registers. Set to no_reg if not needed. @@ -366,13 +380,6 @@ MaybeObject* KeyedLoadPropertyWithInterceptor(Arguments args); // The stub compiler compiles stubs for the stub cache. class StubCompiler BASE_EMBEDDED { public: - enum CheckType { - RECEIVER_MAP_CHECK, - STRING_CHECK, - NUMBER_CHECK, - BOOLEAN_CHECK - }; - StubCompiler() : scope_(), masm_(NULL, 256), failure_(NULL) { } MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags); @@ -564,7 +571,7 @@ class LoadStubCompiler: public StubCompiler { bool is_dont_delete); private: - MaybeObject* GetCode(PropertyType type, String* name); + MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); }; @@ -593,6 +600,8 @@ class KeyedLoadStubCompiler: public StubCompiler { MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); + MUST_USE_RESULT MaybeObject* CompileLoadSpecialized(JSObject* receiver); + private: MaybeObject* GetCode(PropertyType type, String* name); }; @@ -604,6 +613,7 @@ class StoreStubCompiler: public StubCompiler { int index, Map* transition, String* name); + MUST_USE_RESULT MaybeObject* CompileStoreCallback(JSObject* object, AccessorInfo* callbacks, String* name); @@ -615,53 +625,38 @@ class StoreStubCompiler: public StubCompiler { private: - MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); + MaybeObject* GetCode(PropertyType type, String* name); }; class KeyedStoreStubCompiler: public StubCompiler { public: - MaybeObject* CompileStoreField(JSObject* object, - int index, - Map* transition, - String* name); + MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, + int index, + Map* transition, + String* name); + + MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); private: MaybeObject* GetCode(PropertyType type, String* name); }; -// 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 object property holding an object -// optionally followed by ".prototype" (this controls whether the -// generator is set on the object itself or, in case it's a function, -// on the its instance prototype), a name of a builtin function on the -// object (the one the generator is set for), and a name of the -// generator (used to build ids and generator function names). -#define CUSTOM_CALL_IC_GENERATORS(V) \ - V(Array.prototype, push, ArrayPush) \ - V(Array.prototype, pop, ArrayPop) \ - V(String.prototype, charCodeAt, StringCharCodeAt) \ - V(String.prototype, charAt, StringCharAt) \ - V(String, fromCharCode, StringFromCharCode) \ - V(Math, floor, MathFloor) \ - V(Math, abs, MathAbs) +// Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call +// IC stubs. +#define CUSTOM_CALL_IC_GENERATORS(V) \ + V(ArrayPush) \ + V(ArrayPop) \ + V(StringCharCodeAt) \ + V(StringCharAt) \ + V(StringFromCharCode) \ + V(MathFloor) \ + V(MathAbs) class CallStubCompiler: public StubCompiler { public: - enum { -#define DECLARE_CALL_GENERATOR_ID(ignored1, ignore2, name) \ - k##name##CallGenerator, - CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) -#undef DECLARE_CALL_GENERATOR_ID - kNumCallGenerators - }; - CallStubCompiler(int argc, InLoopFlag in_loop, Code::Kind kind, @@ -685,16 +680,20 @@ class CallStubCompiler: public StubCompiler { JSFunction* function, String* name); - // Compiles a custom call constant/global IC using the generator - // with given id. For constant calls cell is NULL. - MUST_USE_RESULT MaybeObject* CompileCustomCall(int generator_id, + static bool HasCustomCallGenerator(BuiltinFunctionId id); + + private: + // Compiles a custom call constant/global IC. For constant calls + // cell is NULL. Returns undefined if there is no custom call code + // for the given function or it can't be generated. + MUST_USE_RESULT MaybeObject* CompileCustomCall(BuiltinFunctionId id, Object* object, JSObject* holder, JSGlobalPropertyCell* cell, JSFunction* function, String* name); -#define DECLARE_CALL_GENERATOR(ignored1, ignored2, name) \ +#define DECLARE_CALL_GENERATOR(name) \ MUST_USE_RESULT MaybeObject* Compile##name##Call(Object* object, \ JSObject* holder, \ JSGlobalPropertyCell* cell, \ @@ -703,7 +702,6 @@ class CallStubCompiler: public StubCompiler { CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) #undef DECLARE_CALL_GENERATOR - private: const ParameterCount arguments_; const InLoopFlag in_loop_; const Code::Kind kind_; |