Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index c68862e93c887442a22528015f0b1d33d5731a55..ce739dd858acf7299a94fe52f9ec9ce8acae06e2 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) \ |
@@ -309,7 +310,7 @@ class CodeStubInterfaceDescriptor { |
return register_params_[index]; |
} |
- Representation GetRegisterParameterRepresentation(int index) const { |
+ Representation GetParameterRepresentation(int index) const { |
ASSERT(index < register_param_count_); |
if (register_param_representations_.get() == NULL) { |
return Representation::Tagged(); |
@@ -712,6 +713,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, 16, 1> {}; |
danno
2014/07/11 12:30:30
Any particular reason you start this field at bit
mvstanton
2014/07/21 09:41:17
Oops, thanks that is a bug because I removed a New
|
+ |
+ uint32_t bit_field_; |
+ |
+ Major MajorKey() { return GrowArrayElements; } |
+ int NotMissMinorKey() { return bit_field_; } |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GrowArrayElementsStub); |
+}; |
+ |
+ |
class InstanceofStub: public PlatformCodeStub { |
public: |
enum Flags { |