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

Unified Diff: src/code-stubs.h

Issue 12700006: Replace ICStub for array.length with hydrogen stub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: New patch Created 7 years, 9 months 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
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);
};
« no previous file with comments | « src/ast.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | src/code-stubs-hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698