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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | src/hydrogen-instructions.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 13f8e425134a9de3a85df02a1e9cda9d761ed3c0..b02f25d9dec60962f71236030dc63d8b5b1b2158 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -69,6 +69,7 @@ namespace internal {
V(InternalArrayNoArgumentConstructor) \
V(InternalArraySingleArgumentConstructor) \
V(KeyedLoadGeneric) \
+ V(LoadGlobalContextField) \
V(LoadDictionaryElement) \
V(LoadFastElement) \
V(MegamorphicLoad) \
@@ -2020,6 +2021,48 @@ class DoubleToIStub : public PlatformCodeStub {
};
+class LoadGlobalContextFieldStub : public HandlerStub {
+ public:
+ LoadGlobalContextFieldStub(
+ Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result)
+ : HandlerStub(isolate) {
+ DCHECK(Accepted(lookup_result));
+ set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) |
+ SlotIndexBits::encode(lookup_result->slot_index));
+ }
+
+ int context_index() const {
+ return ContextIndexBits::decode(sub_minor_key());
+ }
+
+ int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); }
+
+ static bool Accepted(const GlobalContextTable::LookupResult* lookup_result) {
+ return lookup_result->context_index >= 0 &&
+ lookup_result->slot_index >= 0 &&
+ lookup_result->context_index < (1 << kContextIndexBits) &&
+ lookup_result->slot_index < (1 << kSlotIndexBits);
+ }
+
+ private:
+ static const int kContextIndexBits = 13;
+ static const int kSlotIndexBits = 13;
+ class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {};
+ class SlotIndexBits
+ : public BitField<int, kContextIndexBits, kSlotIndexBits> {};
+
+ virtual Code::Kind kind() const { return Code::LOAD_IC; }
+ virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; }
+
+
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE {
+ return ContextOnlyDescriptor(isolate());
+ }
+
+ DEFINE_HANDLER_CODE_STUB(LoadGlobalContextField, HandlerStub);
+};
+
+
class LoadFastElementStub : public HydrogenCodeStub {
public:
LoadFastElementStub(Isolate* isolate, bool is_js_array,
« 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