| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 void GenerateCode(MacroAssembler* masm); | 168 void GenerateCode(MacroAssembler* masm); |
| 169 | 169 |
| 170 // Generates the assembler code for the stub. | 170 // Generates the assembler code for the stub. |
| 171 virtual void Generate(MacroAssembler* masm) = 0; | 171 virtual void Generate(MacroAssembler* masm) = 0; |
| 172 | 172 |
| 173 // Perform bookkeeping required after code generation when stub code is | 173 // Perform bookkeeping required after code generation when stub code is |
| 174 // initially generated. | 174 // initially generated. |
| 175 void RecordCodeGeneration(Code* code, MacroAssembler* masm); | 175 void RecordCodeGeneration(Code* code, MacroAssembler* masm); |
| 176 | 176 |
| 177 // Finish the code object after it has been generated. | 177 // Finish the code object after it has been generated. |
| 178 virtual void FinishCode(Code* code) { } | 178 virtual void FinishCode(Handle<Code> code) { } |
| 179 | 179 |
| 180 // Activate newly generated stub. Is called after | 180 // Activate newly generated stub. Is called after |
| 181 // registering stub in the stub cache. | 181 // registering stub in the stub cache. |
| 182 virtual void Activate(Code* code) { } | 182 virtual void Activate(Code* code) { } |
| 183 | 183 |
| 184 // Returns information for computing the number key. | 184 // Returns information for computing the number key. |
| 185 virtual Major MajorKey() = 0; | 185 virtual Major MajorKey() = 0; |
| 186 virtual int MinorKey() = 0; | 186 virtual int MinorKey() = 0; |
| 187 | 187 |
| 188 // BinaryOpStub needs to override this. | 188 // BinaryOpStub needs to override this. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 : op_(op), state_(state) { | 434 : op_(op), state_(state) { |
| 435 ASSERT(Token::IsCompareOp(op)); | 435 ASSERT(Token::IsCompareOp(op)); |
| 436 } | 436 } |
| 437 | 437 |
| 438 virtual void Generate(MacroAssembler* masm); | 438 virtual void Generate(MacroAssembler* masm); |
| 439 | 439 |
| 440 private: | 440 private: |
| 441 class OpField: public BitField<int, 0, 3> { }; | 441 class OpField: public BitField<int, 0, 3> { }; |
| 442 class StateField: public BitField<int, 3, 5> { }; | 442 class StateField: public BitField<int, 3, 5> { }; |
| 443 | 443 |
| 444 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } | 444 virtual void FinishCode(Handle<Code> code) { |
| 445 code->set_compare_state(state_); |
| 446 } |
| 445 | 447 |
| 446 virtual CodeStub::Major MajorKey() { return CompareIC; } | 448 virtual CodeStub::Major MajorKey() { return CompareIC; } |
| 447 virtual int MinorKey(); | 449 virtual int MinorKey(); |
| 448 | 450 |
| 449 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 451 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
| 450 | 452 |
| 451 void GenerateSmis(MacroAssembler* masm); | 453 void GenerateSmis(MacroAssembler* masm); |
| 452 void GenerateHeapNumbers(MacroAssembler* masm); | 454 void GenerateHeapNumbers(MacroAssembler* masm); |
| 453 void GenerateSymbols(MacroAssembler* masm); | 455 void GenerateSymbols(MacroAssembler* masm); |
| 454 void GenerateStrings(MacroAssembler* masm); | 456 void GenerateStrings(MacroAssembler* masm); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 class IncludeNumberCompareField: public BitField<bool, 2, 1> {}; | 539 class IncludeNumberCompareField: public BitField<bool, 2, 1> {}; |
| 538 class IncludeSmiCompareField: public BitField<bool, 3, 1> {}; | 540 class IncludeSmiCompareField: public BitField<bool, 3, 1> {}; |
| 539 class RegisterField: public BitField<bool, 4, 1> {}; | 541 class RegisterField: public BitField<bool, 4, 1> {}; |
| 540 class ConditionField: public BitField<int, 5, 11> {}; | 542 class ConditionField: public BitField<int, 5, 11> {}; |
| 541 | 543 |
| 542 Major MajorKey() { return Compare; } | 544 Major MajorKey() { return Compare; } |
| 543 | 545 |
| 544 int MinorKey(); | 546 int MinorKey(); |
| 545 | 547 |
| 546 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 548 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
| 547 virtual void FinishCode(Code* code) { | 549 virtual void FinishCode(Handle<Code> code) { |
| 548 code->set_compare_state(CompareIC::GENERIC); | 550 code->set_compare_state(CompareIC::GENERIC); |
| 549 } | 551 } |
| 550 | 552 |
| 551 // Branch to the label if the given object isn't a symbol. | 553 // Branch to the label if the given object isn't a symbol. |
| 552 void BranchIfNonSymbol(MacroAssembler* masm, | 554 void BranchIfNonSymbol(MacroAssembler* masm, |
| 553 Label* label, | 555 Label* label, |
| 554 Register object, | 556 Register object, |
| 555 Register scratch); | 557 Register scratch); |
| 556 | 558 |
| 557 // Unfortunately you have to run without snapshots to see most of these | 559 // Unfortunately you have to run without snapshots to see most of these |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 JSEntryStub() { } | 604 JSEntryStub() { } |
| 603 | 605 |
| 604 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 606 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
| 605 | 607 |
| 606 protected: | 608 protected: |
| 607 void GenerateBody(MacroAssembler* masm, bool is_construct); | 609 void GenerateBody(MacroAssembler* masm, bool is_construct); |
| 608 | 610 |
| 609 private: | 611 private: |
| 610 Major MajorKey() { return JSEntry; } | 612 Major MajorKey() { return JSEntry; } |
| 611 int MinorKey() { return 0; } | 613 int MinorKey() { return 0; } |
| 614 |
| 615 virtual void FinishCode(Handle<Code> code); |
| 616 |
| 617 int handler_offset_; |
| 612 }; | 618 }; |
| 613 | 619 |
| 614 | 620 |
| 615 class JSConstructEntryStub : public JSEntryStub { | 621 class JSConstructEntryStub : public JSEntryStub { |
| 616 public: | 622 public: |
| 617 JSConstructEntryStub() { } | 623 JSConstructEntryStub() { } |
| 618 | 624 |
| 619 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 625 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
| 620 | 626 |
| 621 private: | 627 private: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 }; | 684 }; |
| 679 | 685 |
| 680 | 686 |
| 681 class CallFunctionStub: public CodeStub { | 687 class CallFunctionStub: public CodeStub { |
| 682 public: | 688 public: |
| 683 CallFunctionStub(int argc, CallFunctionFlags flags) | 689 CallFunctionStub(int argc, CallFunctionFlags flags) |
| 684 : argc_(argc), flags_(flags) { } | 690 : argc_(argc), flags_(flags) { } |
| 685 | 691 |
| 686 void Generate(MacroAssembler* masm); | 692 void Generate(MacroAssembler* masm); |
| 687 | 693 |
| 688 virtual void FinishCode(Code* code); | 694 virtual void FinishCode(Handle<Code> code); |
| 689 | 695 |
| 690 static void Clear(Heap* heap, Address address); | 696 static void Clear(Heap* heap, Address address); |
| 691 | 697 |
| 692 static Object* GetCachedValue(Address address); | 698 static Object* GetCachedValue(Address address); |
| 693 | 699 |
| 694 static int ExtractArgcFromMinorKey(int minor_key) { | 700 static int ExtractArgcFromMinorKey(int minor_key) { |
| 695 return ArgcBits::decode(minor_key); | 701 return ArgcBits::decode(minor_key); |
| 696 } | 702 } |
| 697 | 703 |
| 698 // The object that indicates an uninitialized cache. | 704 // The object that indicates an uninitialized cache. |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 void Generate(MacroAssembler* masm); | 995 void Generate(MacroAssembler* masm); |
| 990 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } | 996 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } |
| 991 virtual void PrintName(StringStream* stream); | 997 virtual void PrintName(StringStream* stream); |
| 992 | 998 |
| 993 virtual bool SometimesSetsUpAFrame() { return false; } | 999 virtual bool SometimesSetsUpAFrame() { return false; } |
| 994 | 1000 |
| 995 private: | 1001 private: |
| 996 Major MajorKey() { return ToBoolean; } | 1002 Major MajorKey() { return ToBoolean; } |
| 997 int MinorKey() { return (tos_.code() << NUMBER_OF_TYPES) | types_.ToByte(); } | 1003 int MinorKey() { return (tos_.code() << NUMBER_OF_TYPES) | types_.ToByte(); } |
| 998 | 1004 |
| 999 virtual void FinishCode(Code* code) { | 1005 virtual void FinishCode(Handle<Code> code) { |
| 1000 code->set_to_boolean_state(types_.ToByte()); | 1006 code->set_to_boolean_state(types_.ToByte()); |
| 1001 } | 1007 } |
| 1002 | 1008 |
| 1003 void CheckOddball(MacroAssembler* masm, | 1009 void CheckOddball(MacroAssembler* masm, |
| 1004 Type type, | 1010 Type type, |
| 1005 Heap::RootListIndex value, | 1011 Heap::RootListIndex value, |
| 1006 bool result); | 1012 bool result); |
| 1007 void GenerateTypeTransition(MacroAssembler* masm); | 1013 void GenerateTypeTransition(MacroAssembler* masm); |
| 1008 | 1014 |
| 1009 Register tos_; | 1015 Register tos_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 int MinorKey() { return 0; } | 1062 int MinorKey() { return 0; } |
| 1057 | 1063 |
| 1058 void Generate(MacroAssembler* masm); | 1064 void Generate(MacroAssembler* masm); |
| 1059 | 1065 |
| 1060 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1066 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 1061 }; | 1067 }; |
| 1062 | 1068 |
| 1063 } } // namespace v8::internal | 1069 } } // namespace v8::internal |
| 1064 | 1070 |
| 1065 #endif // V8_CODE_STUBS_H_ | 1071 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |