Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index c06c6c1fe498b1a9daf9314017a54d0dcf89f659..b594ff4c2eb0147b624c0831bfb3780dea8d0b4d 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -78,6 +78,7 @@ namespace internal { |
V(InternalArrayNoArgumentConstructor) \ |
V(InternalArraySingleArgumentConstructor) \ |
V(KeyedLoadGeneric) \ |
+ V(LoadGlobalViaContext) \ |
V(LoadScriptContextField) \ |
V(LoadDictionaryElement) \ |
V(NameDictionaryLookup) \ |
@@ -85,6 +86,7 @@ namespace internal { |
V(Typeof) \ |
V(RegExpConstructResult) \ |
V(StoreFastElement) \ |
+ V(StoreGlobalViaContext) \ |
V(StoreScriptContextField) \ |
V(StringAdd) \ |
V(ToBoolean) \ |
@@ -1341,6 +1343,60 @@ class StoreGlobalStub : public HandlerStub { |
}; |
+class LoadGlobalViaContextStub : public HydrogenCodeStub { |
+ public: |
+ // Use the loop version for depths higher than this one. |
+ static const int kDynamicDepth = 7; |
+ |
+ LoadGlobalViaContextStub(Isolate* isolate, int depth) |
+ : HydrogenCodeStub(isolate) { |
+ if (depth > kDynamicDepth) depth = kDynamicDepth; |
+ set_sub_minor_key(DepthBits::encode(depth)); |
+ } |
+ |
+ int depth() const { return DepthBits::decode(sub_minor_key()); } |
+ |
+ private: |
+ class DepthBits : public BitField<unsigned int, 0, 3> {}; |
+ STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); |
+ |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadGlobalViaContext); |
+ DEFINE_HYDROGEN_CODE_STUB(LoadGlobalViaContext, HydrogenCodeStub); |
+}; |
+ |
+ |
+class StoreGlobalViaContextStub : public HydrogenCodeStub { |
+ public: |
+ // Use the loop version for depths higher than this one. |
+ static const int kDynamicDepth = 7; |
+ |
+ StoreGlobalViaContextStub(Isolate* isolate, int depth, |
+ LanguageMode language_mode) |
+ : HydrogenCodeStub(isolate) { |
+ if (depth > kDynamicDepth) depth = kDynamicDepth; |
+ set_sub_minor_key(DepthBits::encode(depth) | |
+ LanguageModeBits::encode(language_mode)); |
+ } |
+ |
+ int depth() const { return DepthBits::decode(sub_minor_key()); } |
+ |
+ LanguageMode language_mode() const { |
+ return LanguageModeBits::decode(sub_minor_key()); |
+ } |
+ |
+ private: |
+ class DepthBits : public BitField<unsigned int, 0, 4> {}; |
+ STATIC_ASSERT(kDynamicDepth <= DepthBits::kMax); |
+ |
+ class LanguageModeBits : public BitField<LanguageMode, 4, 2> {}; |
+ STATIC_ASSERT(LANGUAGE_END == 3); |
+ |
+ private: |
+ DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreGlobalViaContext); |
+ DEFINE_HYDROGEN_CODE_STUB(StoreGlobalViaContext, HydrogenCodeStub); |
+}; |
+ |
+ |
class CallApiFunctionStub : public PlatformCodeStub { |
public: |
explicit CallApiFunctionStub(Isolate* isolate, bool call_data_undefined) |