Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 151a51ca31d03c123035dfc7a3c789b4a358eae9..4f9a6374591d17955a0771e71244b7462df63563 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -47,7 +47,7 @@ namespace internal { |
V(Compare) \ |
V(CompareIC) \ |
V(MathPow) \ |
- V(ArrayLength) \ |
+ V(FastArrayLength) \ |
V(StringLength) \ |
V(FunctionPrototype) \ |
V(StoreArrayLength) \ |
@@ -597,13 +597,39 @@ class ICStub: public PlatformCodeStub { |
}; |
-class ArrayLengthStub: public ICStub { |
+class FastArrayLengthStub: public HydrogenCodeStub { |
public: |
- explicit ArrayLengthStub(Code::Kind kind) : ICStub(kind) { } |
- virtual void Generate(MacroAssembler* masm); |
+ explicit FastArrayLengthStub(Register receiver) : receiver_(receiver) { } |
+ |
+ virtual Handle<Code> GenerateCode(); |
+ |
+ virtual void InitializeInterfaceDescriptor( |
+ Isolate* isolate, |
+ CodeStubInterfaceDescriptor* descriptor); |
+ |
+ protected: |
+ virtual void FinishCode(Handle<Code> code) { |
+ Code::Flags flags = code->flags(); |
+ flags = static_cast<Code::Flags>( |
+ Code::TypeField::update(flags, Code::CALLBACKS)); |
+ flags = static_cast<Code::Flags>( |
+ Code::ICStateField::update(flags, MONOMORPHIC)); |
+ code->set_flags(flags); |
+ } |
Dmitry Lomov (no reviews)
2013/03/11 17:31:31
Not entirely happy about this code; probably need
danno
2013/03/12 11:16:16
Agreed. You shouldn't have to override FinishCode
|
+ |
+ virtual Code::StubType GetStubType() { |
+ return Code::CALLBACKS; |
+ } |
private: |
- virtual CodeStub::Major MajorKey() { return ArrayLength; } |
+ virtual CodeStub::Major MajorKey() { return FastArrayLength; } |
+ virtual int MinorKey() { return 0; } |
+ |
+ Register receiver_; |
+ // Initialized in InititalizeInterfaceDescriptor |
+ Register registers_[2]; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FastArrayLengthStub); |
}; |