OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 V(CreateAllocationSite) \ | 62 V(CreateAllocationSite) \ |
63 V(ElementsTransitionAndStore) \ | 63 V(ElementsTransitionAndStore) \ |
64 V(FastCloneShallowArray) \ | 64 V(FastCloneShallowArray) \ |
65 V(FastCloneShallowObject) \ | 65 V(FastCloneShallowObject) \ |
66 V(FastNewClosure) \ | 66 V(FastNewClosure) \ |
67 V(FastNewContext) \ | 67 V(FastNewContext) \ |
68 V(InternalArrayNArgumentsConstructor) \ | 68 V(InternalArrayNArgumentsConstructor) \ |
69 V(InternalArrayNoArgumentConstructor) \ | 69 V(InternalArrayNoArgumentConstructor) \ |
70 V(InternalArraySingleArgumentConstructor) \ | 70 V(InternalArraySingleArgumentConstructor) \ |
71 V(KeyedLoadGeneric) \ | 71 V(KeyedLoadGeneric) \ |
72 V(LoadGlobalContextField) \ | 72 V(LoadScriptContextField) \ |
73 V(LoadDictionaryElement) \ | 73 V(LoadDictionaryElement) \ |
74 V(LoadFastElement) \ | 74 V(LoadFastElement) \ |
75 V(MegamorphicLoad) \ | 75 V(MegamorphicLoad) \ |
76 V(NameDictionaryLookup) \ | 76 V(NameDictionaryLookup) \ |
77 V(NumberToString) \ | 77 V(NumberToString) \ |
78 V(RegExpConstructResult) \ | 78 V(RegExpConstructResult) \ |
79 V(StoreFastElement) \ | 79 V(StoreFastElement) \ |
80 V(StoreGlobalContextField) \ | 80 V(StoreScriptContextField) \ |
81 V(StringAdd) \ | 81 V(StringAdd) \ |
82 V(ToBoolean) \ | 82 V(ToBoolean) \ |
83 V(TransitionElementsKind) \ | 83 V(TransitionElementsKind) \ |
84 V(VectorKeyedLoad) \ | 84 V(VectorKeyedLoad) \ |
85 V(VectorLoad) \ | 85 V(VectorLoad) \ |
86 /* IC Handler stubs */ \ | 86 /* IC Handler stubs */ \ |
87 V(LoadConstant) \ | 87 V(LoadConstant) \ |
88 V(LoadField) \ | 88 V(LoadField) \ |
89 V(KeyedLoadSloppyArguments) \ | 89 V(KeyedLoadSloppyArguments) \ |
90 V(StoreField) \ | 90 V(StoreField) \ |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 class SkipFastPathBits: | 2011 class SkipFastPathBits: |
2012 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT | 2012 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT |
2013 class SSE3Bits: | 2013 class SSE3Bits: |
2014 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT | 2014 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
2015 | 2015 |
2016 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 2016 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
2017 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); | 2017 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); |
2018 }; | 2018 }; |
2019 | 2019 |
2020 | 2020 |
2021 class GlobalContextFieldStub : public HandlerStub { | 2021 class ScriptContextFieldStub : public HandlerStub { |
2022 public: | 2022 public: |
2023 GlobalContextFieldStub(Isolate* isolate, | 2023 ScriptContextFieldStub(Isolate* isolate, |
2024 const GlobalContextTable::LookupResult* lookup_result) | 2024 const ScriptContextTable::LookupResult* lookup_result) |
2025 : HandlerStub(isolate) { | 2025 : HandlerStub(isolate) { |
2026 DCHECK(Accepted(lookup_result)); | 2026 DCHECK(Accepted(lookup_result)); |
2027 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) | | 2027 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) | |
2028 SlotIndexBits::encode(lookup_result->slot_index)); | 2028 SlotIndexBits::encode(lookup_result->slot_index)); |
2029 } | 2029 } |
2030 | 2030 |
2031 int context_index() const { | 2031 int context_index() const { |
2032 return ContextIndexBits::decode(sub_minor_key()); | 2032 return ContextIndexBits::decode(sub_minor_key()); |
2033 } | 2033 } |
2034 | 2034 |
2035 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); } | 2035 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); } |
2036 | 2036 |
2037 static bool Accepted(const GlobalContextTable::LookupResult* lookup_result) { | 2037 static bool Accepted(const ScriptContextTable::LookupResult* lookup_result) { |
2038 return ContextIndexBits::is_valid(lookup_result->context_index) && | 2038 return ContextIndexBits::is_valid(lookup_result->context_index) && |
2039 SlotIndexBits::is_valid(lookup_result->slot_index); | 2039 SlotIndexBits::is_valid(lookup_result->slot_index); |
2040 } | 2040 } |
2041 | 2041 |
2042 private: | 2042 private: |
2043 static const int kContextIndexBits = 13; | 2043 static const int kContextIndexBits = 13; |
2044 static const int kSlotIndexBits = 13; | 2044 static const int kSlotIndexBits = 13; |
2045 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; | 2045 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; |
2046 class SlotIndexBits | 2046 class SlotIndexBits |
2047 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; | 2047 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; |
2048 | 2048 |
2049 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 2049 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
2050 | 2050 |
2051 DEFINE_CODE_STUB_BASE(GlobalContextFieldStub, HandlerStub); | 2051 DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub); |
2052 }; | 2052 }; |
2053 | 2053 |
2054 | 2054 |
2055 class LoadGlobalContextFieldStub : public GlobalContextFieldStub { | 2055 class LoadScriptContextFieldStub : public ScriptContextFieldStub { |
2056 public: | 2056 public: |
2057 LoadGlobalContextFieldStub( | 2057 LoadScriptContextFieldStub( |
2058 Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result) | 2058 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) |
2059 : GlobalContextFieldStub(isolate, lookup_result) {} | 2059 : ScriptContextFieldStub(isolate, lookup_result) {} |
2060 | 2060 |
2061 private: | 2061 private: |
2062 virtual Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } | 2062 virtual Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } |
2063 | 2063 |
2064 DEFINE_HANDLER_CODE_STUB(LoadGlobalContextField, GlobalContextFieldStub); | 2064 DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub); |
2065 }; | 2065 }; |
2066 | 2066 |
2067 | 2067 |
2068 class StoreGlobalContextFieldStub : public GlobalContextFieldStub { | 2068 class StoreScriptContextFieldStub : public ScriptContextFieldStub { |
2069 public: | 2069 public: |
2070 StoreGlobalContextFieldStub( | 2070 StoreScriptContextFieldStub( |
2071 Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result) | 2071 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) |
2072 : GlobalContextFieldStub(isolate, lookup_result) {} | 2072 : ScriptContextFieldStub(isolate, lookup_result) {} |
2073 | 2073 |
2074 private: | 2074 private: |
2075 virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } | 2075 virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } |
2076 | 2076 |
2077 DEFINE_HANDLER_CODE_STUB(StoreGlobalContextField, GlobalContextFieldStub); | 2077 DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub); |
2078 }; | 2078 }; |
2079 | 2079 |
2080 | 2080 |
2081 class LoadFastElementStub : public HydrogenCodeStub { | 2081 class LoadFastElementStub : public HydrogenCodeStub { |
2082 public: | 2082 public: |
2083 LoadFastElementStub(Isolate* isolate, bool is_js_array, | 2083 LoadFastElementStub(Isolate* isolate, bool is_js_array, |
2084 ElementsKind elements_kind) | 2084 ElementsKind elements_kind) |
2085 : HydrogenCodeStub(isolate) { | 2085 : HydrogenCodeStub(isolate) { |
2086 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2086 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
2087 IsJSArrayBits::encode(is_js_array)); | 2087 IsJSArrayBits::encode(is_js_array)); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 | 2610 |
2611 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2611 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2612 #undef DEFINE_PLATFORM_CODE_STUB | 2612 #undef DEFINE_PLATFORM_CODE_STUB |
2613 #undef DEFINE_HANDLER_CODE_STUB | 2613 #undef DEFINE_HANDLER_CODE_STUB |
2614 #undef DEFINE_HYDROGEN_CODE_STUB | 2614 #undef DEFINE_HYDROGEN_CODE_STUB |
2615 #undef DEFINE_CODE_STUB | 2615 #undef DEFINE_CODE_STUB |
2616 #undef DEFINE_CODE_STUB_BASE | 2616 #undef DEFINE_CODE_STUB_BASE |
2617 } } // namespace v8::internal | 2617 } } // namespace v8::internal |
2618 | 2618 |
2619 #endif // V8_CODE_STUBS_H_ | 2619 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |