 Chromium Code Reviews
 Chromium Code Reviews Issue 12700006:
  Replace ICStub for array.length with hydrogen stub  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 12700006:
  Replace ICStub for array.length with hydrogen stub  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright | 
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. | 
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above | 
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following | 
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided | 
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 V(CallFunction) \ | 40 V(CallFunction) \ | 
| 41 V(CallConstruct) \ | 41 V(CallConstruct) \ | 
| 42 V(UnaryOp) \ | 42 V(UnaryOp) \ | 
| 43 V(BinaryOp) \ | 43 V(BinaryOp) \ | 
| 44 V(StringAdd) \ | 44 V(StringAdd) \ | 
| 45 V(SubString) \ | 45 V(SubString) \ | 
| 46 V(StringCompare) \ | 46 V(StringCompare) \ | 
| 47 V(Compare) \ | 47 V(Compare) \ | 
| 48 V(CompareIC) \ | 48 V(CompareIC) \ | 
| 49 V(MathPow) \ | 49 V(MathPow) \ | 
| 50 V(ArrayLength) \ | 50 V(FastArrayLength) \ | 
| 51 V(StringLength) \ | 51 V(StringLength) \ | 
| 52 V(FunctionPrototype) \ | 52 V(FunctionPrototype) \ | 
| 53 V(StoreArrayLength) \ | 53 V(StoreArrayLength) \ | 
| 54 V(RecordWrite) \ | 54 V(RecordWrite) \ | 
| 55 V(StoreBufferOverflow) \ | 55 V(StoreBufferOverflow) \ | 
| 56 V(RegExpExec) \ | 56 V(RegExpExec) \ | 
| 57 V(TranscendentalCache) \ | 57 V(TranscendentalCache) \ | 
| 58 V(Instanceof) \ | 58 V(Instanceof) \ | 
| 59 V(ConvertToDouble) \ | 59 V(ConvertToDouble) \ | 
| 60 V(WriteInt32ToHeapNumber) \ | 60 V(WriteInt32ToHeapNumber) \ | 
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 | 590 | 
| 591 virtual int MinorKey() { | 591 virtual int MinorKey() { | 
| 592 return KindBits::encode(kind_); | 592 return KindBits::encode(kind_); | 
| 593 } | 593 } | 
| 594 | 594 | 
| 595 private: | 595 private: | 
| 596 Code::Kind kind_; | 596 Code::Kind kind_; | 
| 597 }; | 597 }; | 
| 598 | 598 | 
| 599 | 599 | 
| 600 class ArrayLengthStub: public ICStub { | 600 class FastArrayLengthStub: public HydrogenCodeStub { | 
| 601 public: | 601 public: | 
| 602 explicit ArrayLengthStub(Code::Kind kind) : ICStub(kind) { } | 602 explicit FastArrayLengthStub(Register receiver) : receiver_(receiver) { } | 
| 603 virtual void Generate(MacroAssembler* masm); | 603 | 
| 604 virtual Handle<Code> GenerateCode(); | |
| 605 | |
| 606 virtual void InitializeInterfaceDescriptor( | |
| 607 Isolate* isolate, | |
| 608 CodeStubInterfaceDescriptor* descriptor); | |
| 609 | |
| 610 protected: | |
| 611 virtual void FinishCode(Handle<Code> code) { | |
| 612 Code::Flags flags = code->flags(); | |
| 613 flags = static_cast<Code::Flags>( | |
| 614 Code::TypeField::update(flags, Code::CALLBACKS)); | |
| 615 flags = static_cast<Code::Flags>( | |
| 616 Code::ICStateField::update(flags, MONOMORPHIC)); | |
| 617 code->set_flags(flags); | |
| 618 } | |
| 
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
 | |
| 619 | |
| 620 virtual Code::StubType GetStubType() { | |
| 621 return Code::CALLBACKS; | |
| 622 } | |
| 604 | 623 | 
| 605 private: | 624 private: | 
| 606 virtual CodeStub::Major MajorKey() { return ArrayLength; } | 625 virtual CodeStub::Major MajorKey() { return FastArrayLength; } | 
| 626 virtual int MinorKey() { return 0; } | |
| 627 | |
| 628 Register receiver_; | |
| 629 // Initialized in InititalizeInterfaceDescriptor | |
| 630 Register registers_[2]; | |
| 631 | |
| 632 DISALLOW_COPY_AND_ASSIGN(FastArrayLengthStub); | |
| 607 }; | 633 }; | 
| 608 | 634 | 
| 609 | 635 | 
| 610 class FunctionPrototypeStub: public ICStub { | 636 class FunctionPrototypeStub: public ICStub { | 
| 611 public: | 637 public: | 
| 612 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { } | 638 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { } | 
| 613 virtual void Generate(MacroAssembler* masm); | 639 virtual void Generate(MacroAssembler* masm); | 
| 614 | 640 | 
| 615 private: | 641 private: | 
| 616 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } | 642 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } | 
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1619 | 1645 | 
| 1620 // The current function entry hook. | 1646 // The current function entry hook. | 
| 1621 static FunctionEntryHook entry_hook_; | 1647 static FunctionEntryHook entry_hook_; | 
| 1622 | 1648 | 
| 1623 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1649 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 
| 1624 }; | 1650 }; | 
| 1625 | 1651 | 
| 1626 } } // namespace v8::internal | 1652 } } // namespace v8::internal | 
| 1627 | 1653 | 
| 1628 #endif // V8_CODE_STUBS_H_ | 1654 #endif // V8_CODE_STUBS_H_ | 
| OLD | NEW |