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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 V(InternalArraySingleArgumentConstructor) \ | 70 V(InternalArraySingleArgumentConstructor) \ |
71 V(KeyedLoadGeneric) \ | 71 V(KeyedLoadGeneric) \ |
72 V(LoadGlobalContextField) \ | 72 V(LoadGlobalContextField) \ |
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(StringAdd) \ | 81 V(StringAdd) \ |
81 V(ToBoolean) \ | 82 V(ToBoolean) \ |
82 V(TransitionElementsKind) \ | 83 V(TransitionElementsKind) \ |
83 V(VectorKeyedLoad) \ | 84 V(VectorKeyedLoad) \ |
84 V(VectorLoad) \ | 85 V(VectorLoad) \ |
85 /* IC Handler stubs */ \ | 86 /* IC Handler stubs */ \ |
86 V(LoadConstant) \ | 87 V(LoadConstant) \ |
87 V(LoadField) \ | 88 V(LoadField) \ |
88 V(KeyedLoadSloppyArguments) \ | 89 V(KeyedLoadSloppyArguments) \ |
89 V(StoreField) \ | 90 V(StoreField) \ |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2010 class SkipFastPathBits: | 2011 class SkipFastPathBits: |
2011 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT | 2012 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT |
2012 class SSE3Bits: | 2013 class SSE3Bits: |
2013 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT | 2014 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
2014 | 2015 |
2015 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 2016 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
2016 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); | 2017 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); |
2017 }; | 2018 }; |
2018 | 2019 |
2019 | 2020 |
2020 class LoadGlobalContextFieldStub : public HandlerStub { | 2021 class GlobalContextFieldStub : public HandlerStub { |
2021 public: | 2022 public: |
2022 LoadGlobalContextFieldStub( | 2023 GlobalContextFieldStub(Isolate* isolate, |
2023 Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result) | 2024 const GlobalContextTable::LookupResult* lookup_result) |
2024 : HandlerStub(isolate) { | 2025 : HandlerStub(isolate) { |
2025 DCHECK(Accepted(lookup_result)); | 2026 DCHECK(Accepted(lookup_result)); |
2026 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) | | 2027 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) | |
2027 SlotIndexBits::encode(lookup_result->slot_index)); | 2028 SlotIndexBits::encode(lookup_result->slot_index)); |
2028 } | 2029 } |
2029 | 2030 |
2030 int context_index() const { | 2031 int context_index() const { |
2031 return ContextIndexBits::decode(sub_minor_key()); | 2032 return ContextIndexBits::decode(sub_minor_key()); |
2032 } | 2033 } |
2033 | 2034 |
2034 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); } | 2035 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); } |
2035 | 2036 |
2036 static bool Accepted(const GlobalContextTable::LookupResult* lookup_result) { | 2037 static bool Accepted(const GlobalContextTable::LookupResult* lookup_result) { |
2037 return ContextIndexBits::is_valid(lookup_result->context_index) && | 2038 return ContextIndexBits::is_valid(lookup_result->context_index) && |
2038 SlotIndexBits::is_valid(lookup_result->slot_index); | 2039 SlotIndexBits::is_valid(lookup_result->slot_index); |
2039 } | 2040 } |
2040 | 2041 |
2041 private: | 2042 private: |
2042 static const int kContextIndexBits = 13; | 2043 static const int kContextIndexBits = 13; |
2043 static const int kSlotIndexBits = 13; | 2044 static const int kSlotIndexBits = 13; |
2044 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; | 2045 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; |
2045 class SlotIndexBits | 2046 class SlotIndexBits |
2046 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; | 2047 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; |
2047 | 2048 |
2048 virtual Code::Kind kind() const { return Code::LOAD_IC; } | |
2049 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 2049 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
2050 | 2050 |
2051 | 2051 DEFINE_CODE_STUB_BASE(GlobalContextFieldStub, HandlerStub); |
2052 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | |
2053 return ContextOnlyDescriptor(isolate()); | |
2054 } | |
2055 | |
2056 DEFINE_HANDLER_CODE_STUB(LoadGlobalContextField, HandlerStub); | |
2057 }; | 2052 }; |
2058 | 2053 |
2059 | 2054 |
2055 class LoadGlobalContextFieldStub : public GlobalContextFieldStub { | |
2056 public: | |
2057 LoadGlobalContextFieldStub( | |
2058 Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result) | |
2059 : GlobalContextFieldStub(isolate, lookup_result) {} | |
2060 | |
2061 private: | |
2062 virtual Code::Kind kind() const { return Code::LOAD_IC; } | |
rossberg
2014/11/11 12:37:39
OVERRIDE?
Dmitry Lomov (no reviews)
2014/11/11 15:15:25
Done.
| |
2063 | |
2064 DEFINE_HANDLER_CODE_STUB(LoadGlobalContextField, GlobalContextFieldStub); | |
2065 }; | |
2066 | |
2067 | |
2068 class StoreGlobalContextFieldStub : public GlobalContextFieldStub { | |
2069 public: | |
2070 StoreGlobalContextFieldStub( | |
2071 Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result) | |
2072 : GlobalContextFieldStub(isolate, lookup_result) {} | |
2073 | |
2074 private: | |
2075 virtual Code::Kind kind() const { return Code::STORE_IC; } | |
rossberg
2014/11/11 12:37:39
OVERRIDE?
Dmitry Lomov (no reviews)
2014/11/11 15:15:25
Done.
| |
2076 | |
2077 DEFINE_HANDLER_CODE_STUB(StoreGlobalContextField, GlobalContextFieldStub); | |
2078 }; | |
2079 | |
2080 | |
2060 class LoadFastElementStub : public HydrogenCodeStub { | 2081 class LoadFastElementStub : public HydrogenCodeStub { |
2061 public: | 2082 public: |
2062 LoadFastElementStub(Isolate* isolate, bool is_js_array, | 2083 LoadFastElementStub(Isolate* isolate, bool is_js_array, |
2063 ElementsKind elements_kind) | 2084 ElementsKind elements_kind) |
2064 : HydrogenCodeStub(isolate) { | 2085 : HydrogenCodeStub(isolate) { |
2065 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2086 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
2066 IsJSArrayBits::encode(is_js_array)); | 2087 IsJSArrayBits::encode(is_js_array)); |
2067 } | 2088 } |
2068 | 2089 |
2069 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2090 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2589 | 2610 |
2590 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2611 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2591 #undef DEFINE_PLATFORM_CODE_STUB | 2612 #undef DEFINE_PLATFORM_CODE_STUB |
2592 #undef DEFINE_HANDLER_CODE_STUB | 2613 #undef DEFINE_HANDLER_CODE_STUB |
2593 #undef DEFINE_HYDROGEN_CODE_STUB | 2614 #undef DEFINE_HYDROGEN_CODE_STUB |
2594 #undef DEFINE_CODE_STUB | 2615 #undef DEFINE_CODE_STUB |
2595 #undef DEFINE_CODE_STUB_BASE | 2616 #undef DEFINE_CODE_STUB_BASE |
2596 } } // namespace v8::internal | 2617 } } // namespace v8::internal |
2597 | 2618 |
2598 #endif // V8_CODE_STUBS_H_ | 2619 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |