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

Side by Side Diff: src/code-stubs.h

Issue 696783005: harmony-scoping: Implement LoadIC handler for loads from global contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Finished/rebased Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | src/hydrogen-instructions.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(LoadDictionaryElement) \ 73 V(LoadDictionaryElement) \
73 V(LoadFastElement) \ 74 V(LoadFastElement) \
74 V(MegamorphicLoad) \ 75 V(MegamorphicLoad) \
75 V(NameDictionaryLookup) \ 76 V(NameDictionaryLookup) \
76 V(NumberToString) \ 77 V(NumberToString) \
77 V(RegExpConstructResult) \ 78 V(RegExpConstructResult) \
78 V(StoreFastElement) \ 79 V(StoreFastElement) \
79 V(StringAdd) \ 80 V(StringAdd) \
80 V(ToBoolean) \ 81 V(ToBoolean) \
81 V(TransitionElementsKind) \ 82 V(TransitionElementsKind) \
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 class SkipFastPathBits: 2014 class SkipFastPathBits:
2014 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT 2015 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT
2015 class SSE3Bits: 2016 class SSE3Bits:
2016 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT 2017 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT
2017 2018
2018 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); 2019 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR();
2019 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub); 2020 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub);
2020 }; 2021 };
2021 2022
2022 2023
2024 class LoadGlobalContextFieldStub : public HandlerStub {
2025 public:
2026 LoadGlobalContextFieldStub(
2027 Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result)
2028 : HandlerStub(isolate) {
2029 DCHECK(Accepted(lookup_result));
2030 set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) |
2031 SlotIndexBits::encode(lookup_result->slot_index));
2032 }
2033
2034 int context_index() const {
2035 return ContextIndexBits::decode(sub_minor_key());
2036 }
2037
2038 int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); }
2039
2040 static bool Accepted(const GlobalContextTable::LookupResult* lookup_result) {
2041 return lookup_result->context_index >= 0 &&
2042 lookup_result->slot_index >= 0 &&
2043 lookup_result->context_index < (1 << kContextIndexBits) &&
2044 lookup_result->slot_index < (1 << kSlotIndexBits);
2045 }
2046
2047 private:
2048 static const int kContextIndexBits = 13;
2049 static const int kSlotIndexBits = 13;
2050 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {};
2051 class SlotIndexBits
2052 : public BitField<int, kContextIndexBits, kSlotIndexBits> {};
2053
2054 virtual Code::Kind kind() const { return Code::LOAD_IC; }
2055 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
2056
2057
2058 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
2059 return ContextOnlyDescriptor(isolate());
2060 }
2061
2062 DEFINE_HANDLER_CODE_STUB(LoadGlobalContextField, HandlerStub);
2063 };
2064
2065
2023 class LoadFastElementStub : public HydrogenCodeStub { 2066 class LoadFastElementStub : public HydrogenCodeStub {
2024 public: 2067 public:
2025 LoadFastElementStub(Isolate* isolate, bool is_js_array, 2068 LoadFastElementStub(Isolate* isolate, bool is_js_array,
2026 ElementsKind elements_kind) 2069 ElementsKind elements_kind)
2027 : HydrogenCodeStub(isolate) { 2070 : HydrogenCodeStub(isolate) {
2028 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | 2071 set_sub_minor_key(ElementsKindBits::encode(elements_kind) |
2029 IsJSArrayBits::encode(is_js_array)); 2072 IsJSArrayBits::encode(is_js_array));
2030 } 2073 }
2031 2074
2032 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } 2075 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 2595
2553 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR 2596 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2554 #undef DEFINE_PLATFORM_CODE_STUB 2597 #undef DEFINE_PLATFORM_CODE_STUB
2555 #undef DEFINE_HANDLER_CODE_STUB 2598 #undef DEFINE_HANDLER_CODE_STUB
2556 #undef DEFINE_HYDROGEN_CODE_STUB 2599 #undef DEFINE_HYDROGEN_CODE_STUB
2557 #undef DEFINE_CODE_STUB 2600 #undef DEFINE_CODE_STUB
2558 #undef DEFINE_CODE_STUB_BASE 2601 #undef DEFINE_CODE_STUB_BASE
2559 } } // namespace v8::internal 2602 } } // namespace v8::internal
2560 2603
2561 #endif // V8_CODE_STUBS_H_ 2604 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698