Chromium Code Reviews| Index: src/code-stubs.h |
| diff --git a/src/code-stubs.h b/src/code-stubs.h |
| index 05750f535f6677ba97788f4040a1510316a014f5..f8e014498b7f506afbaa7faf1311a5f20cc18db1 100644 |
| --- a/src/code-stubs.h |
| +++ b/src/code-stubs.h |
| @@ -66,6 +66,28 @@ namespace internal { |
| V(NumberToString) \ |
| V(CEntry) \ |
| V(JSEntry) \ |
| + V(ObjectKeyedLoad) \ |
| + V(JSArrayKeyedLoad) \ |
| + V(ObjectKeyedStore) \ |
| + V(JSArrayKeyedStore) \ |
| + V(ExternalByteArrayLoad) \ |
| + V(ExternalUnsignedByteArrayLoad) \ |
| + V(ExternalShortArrayLoad) \ |
| + V(ExternalUnsignedShortArrayLoad) \ |
| + V(ExternalIntArrayLoad) \ |
| + V(ExternalUnsignedIntArrayLoad) \ |
| + V(ExternalFloatArrayLoad) \ |
| + V(ExternalDoubleArrayLoad) \ |
| + V(ExternalPixelArrayLoad) \ |
| + V(ExternalByteArrayStore) \ |
| + V(ExternalUnsignedByteArrayStore) \ |
| + V(ExternalShortArrayStore) \ |
| + V(ExternalUnsignedShortArrayStore) \ |
| + V(ExternalIntArrayStore) \ |
| + V(ExternalUnsignedIntArrayStore) \ |
| + V(ExternalFloatArrayStore) \ |
| + V(ExternalDoubleArrayStore) \ |
| + V(ExternalPixelArrayStore) \ |
| V(DebuggerStatement) \ |
| V(StringDictionaryNegativeLookup) |
| @@ -921,6 +943,166 @@ class AllowStubCallsScope { |
| DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); |
| }; |
| +#ifdef DEBUG |
| +#define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); } |
| +#else |
| +#define DECLARE_ARRAY_STUB_PRINT(name) |
| +#endif |
| + |
| + |
| +class KeyedLoadStub : public CodeStub { |
| + public: |
| + explicit KeyedLoadStub(bool is_js_array) |
| + : is_js_array_(is_js_array) { |
| + } |
| + |
| + void Generate(MacroAssembler* masm); |
| + private: |
| + bool is_js_array_; |
| +}; |
| + |
| + |
| +class ObjectKeyedLoadStub: public KeyedLoadStub { |
| + public: |
| + ObjectKeyedLoadStub() : KeyedLoadStub(false) { } |
| + |
| + private: |
| + Major MajorKey() { return ObjectKeyedLoad; } |
| + int MinorKey() { return 0; } |
| + |
| + const char* GetName() { return "ObjectKeyedLoadStub"; } |
| + |
| + DECLARE_ARRAY_STUB_PRINT(ObjectKeyedLoadStub) |
| +}; |
| + |
| + |
| +class JSArrayKeyedLoadStub: public KeyedLoadStub { |
| + public: |
| + JSArrayKeyedLoadStub() : KeyedLoadStub(true) { } |
| + |
| + private: |
| + Major MajorKey() { return JSArrayKeyedLoad; } |
| + int MinorKey() { return 0; } |
| + |
| + const char* GetName() { return "JSArrayKeyedLoadStub"; } |
| + |
| + DECLARE_ARRAY_STUB_PRINT(JSArrayKeyedLoadStub) |
| +}; |
| + |
| + |
| +class KeyedStoreStub : public CodeStub { |
|
Mads Ager (chromium)
2011/05/10 13:38:06
Why not just have this one and have a minor key fo
danno
2011/05/11 14:20:19
Yes, that's a really good idea. Should have though
|
| + public: |
| + explicit KeyedStoreStub(bool is_js_array) |
| + : is_js_array_(is_js_array) { } |
| + |
| + void Generate(MacroAssembler* masm); |
| + private: |
| + bool is_js_array_; |
| +}; |
| + |
| + |
| +class ObjectKeyedStoreStub: public KeyedStoreStub { |
| + public: |
| + ObjectKeyedStoreStub() : KeyedStoreStub(false) { } |
| + |
| + private: |
| + Major MajorKey() { return ObjectKeyedStore; } |
| + int MinorKey() { return 0; } |
| + |
| + const char* GetName() { return "ObjectKeyedStoreStub"; } |
| + |
| + DECLARE_ARRAY_STUB_PRINT(ObjectKeyedStoreStub) |
| +}; |
| + |
| + |
| +class JSArrayKeyedStoreStub: public KeyedStoreStub { |
| + public: |
| + JSArrayKeyedStoreStub() : KeyedStoreStub(true) { } |
| + |
| + private: |
| + Major MajorKey() { return JSArrayKeyedStore; } |
| + int MinorKey() { return 0; } |
| + |
| + const char* GetName() { return "JSArrayKeyedStoreStub"; } |
| + |
| + DECLARE_ARRAY_STUB_PRINT(JSArrayKeyedStoreStub) |
| +}; |
| + |
| + |
| +class ExternalArrayStub : public CodeStub { |
| + public: |
| + explicit ExternalArrayStub(ExternalArrayType array_type) |
| + : array_type_(array_type) { } |
| + |
| + Major MajorKey() { |
|
Mads Ager (chromium)
2011/05/10 13:38:06
Just don't implement Major and Minor key?
danno
2011/05/11 14:20:19
Done.
|
| + UNREACHABLE(); |
| + return static_cast<Major>(0); |
| + } |
| + int MinorKey() { |
| + UNREACHABLE(); |
| + return 0; |
| + } |
| + |
| + protected: |
| + ExternalArrayType array_type_; |
| +}; |
| + |
| + |
| +class ExternalArrayLoadStub : public ExternalArrayStub { |
| + public: |
| + explicit ExternalArrayLoadStub(ExternalArrayType array_type) |
| + : ExternalArrayStub(array_type) { } |
| + |
| + void Generate(MacroAssembler* masm); |
| +}; |
| + |
| + |
| +class ExternalArrayStoreStub : public ExternalArrayStub { |
| + public: |
| + explicit ExternalArrayStoreStub(ExternalArrayType array_type) |
| + : ExternalArrayStub(array_type) { } |
| + |
| + void Generate(MacroAssembler* masm); |
| +}; |
| + |
| + |
| +#define DECLARE_EXTERNAL_ARRAY_STUB(op, type) \ |
|
Mads Ager (chromium)
2011/05/10 13:38:06
Do you really need all of these different types he
danno
2011/05/11 14:20:19
Done.
|
| +class External##type##Array##op##Stub : public ExternalArray##op##Stub {\ |
| + public: \ |
| + External##type##Array##op##Stub() \ |
| + : ExternalArray##op##Stub(k##External##type##Array) { } \ |
| + \ |
| + private: \ |
| + Major MajorKey() { return External##type##Array##op; } \ |
| + int MinorKey() { return 0; } \ |
| + \ |
| + const char* GetName() { return "External" #type "Array" #op; } \ |
| + \ |
| + DECLARE_ARRAY_STUB_PRINT(External##type##Array##op##Stub) \ |
| +} |
| + |
| + |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, Byte); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, UnsignedByte); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, Short); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, UnsignedShort); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, Int); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, UnsignedInt); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, Float); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, Double); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Load, Pixel); |
| + |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, Byte); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, UnsignedByte); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, Short); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, UnsignedShort); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, Int); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, UnsignedInt); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, Float); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, Double); |
| +DECLARE_EXTERNAL_ARRAY_STUB(Store, Pixel); |
| + |
| + |
| } } // namespace v8::internal |
| #endif // V8_CODE_STUBS_H_ |