Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index ac59871ffcc649434975f334eb04d5dfc64d74a9..96792b887f0c7ebf60750aa5475c4e9e320c6cc8 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -44,6 +44,7 @@ namespace internal { |
V(FastCloneShallowArray) \ |
V(FastCloneShallowObject) \ |
V(CreateAllocationSite) \ |
+ V(GrowArrayElements) \ |
V(ToBoolean) \ |
V(ToNumber) \ |
V(ArgumentsAccess) \ |
@@ -727,6 +728,57 @@ class CreateAllocationSiteStub : public HydrogenCodeStub { |
}; |
+class GrowArrayElementsStub : public HydrogenCodeStub { |
+ public: |
+ explicit GrowArrayElementsStub(Isolate* isolate, bool is_js_array, |
+ ElementsKind kind) |
+ : HydrogenCodeStub(isolate) { |
+ bit_field_ = ElementsKindBits::encode(kind) | |
+ IsJsArrayBits::encode(is_js_array); |
+ } |
+ |
+ virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
+ |
+ static void GenerateAheadOfTime(Isolate* isolate); |
+ |
+ enum RegisterInfo { |
+ kObjectIndex, |
+ kKeyIndex, |
+ kCapacityIndex, |
+ kRegisterArgumentCount |
+ }; |
+ static const Register ObjectRegister(); |
+ static const Register KeyRegister(); |
+ static const Register CapacityRegister(); |
+ |
+ virtual void InitializeInterfaceDescriptor( |
+ CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
+ |
+ static void InstallDescriptors(Isolate* isolate) { |
+ GrowArrayElementsStub stub(isolate, true, GetInitialFastElementsKind()); |
+ stub.InitializeInterfaceDescriptor( |
+ isolate->code_stub_interface_descriptor(CodeStub::GrowArrayElements)); |
+ } |
+ |
+ ElementsKind elements_kind() const { |
+ return ElementsKindBits::decode(bit_field_); |
+ } |
+ |
+ bool is_js_array() const { return IsJsArrayBits::decode(bit_field_); } |
+ |
+ private: |
+ class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
+ class IsJsArrayBits: public BitField<bool, ElementsKindBits::kNext, 1> {}; |
+ |
+ uint32_t bit_field_; |
+ |
+ Major MajorKey() const { return GrowArrayElements; } |
+ int NotMissMinorKey() const { return bit_field_; } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GrowArrayElementsStub); |
+}; |
+ |
+ |
class InstanceofStub: public PlatformCodeStub { |
public: |
enum Flags { |