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(Handle<Code> code) { } | 178 virtual void FinishCode(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(Handle<Code> code) { | 444 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } |
445 code->set_compare_state(state_); | |
446 } | |
447 | 445 |
448 virtual CodeStub::Major MajorKey() { return CompareIC; } | 446 virtual CodeStub::Major MajorKey() { return CompareIC; } |
449 virtual int MinorKey(); | 447 virtual int MinorKey(); |
450 | 448 |
451 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 449 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
452 | 450 |
453 void GenerateSmis(MacroAssembler* masm); | 451 void GenerateSmis(MacroAssembler* masm); |
454 void GenerateHeapNumbers(MacroAssembler* masm); | 452 void GenerateHeapNumbers(MacroAssembler* masm); |
455 void GenerateSymbols(MacroAssembler* masm); | 453 void GenerateSymbols(MacroAssembler* masm); |
456 void GenerateStrings(MacroAssembler* masm); | 454 void GenerateStrings(MacroAssembler* masm); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 class IncludeNumberCompareField: public BitField<bool, 2, 1> {}; | 537 class IncludeNumberCompareField: public BitField<bool, 2, 1> {}; |
540 class IncludeSmiCompareField: public BitField<bool, 3, 1> {}; | 538 class IncludeSmiCompareField: public BitField<bool, 3, 1> {}; |
541 class RegisterField: public BitField<bool, 4, 1> {}; | 539 class RegisterField: public BitField<bool, 4, 1> {}; |
542 class ConditionField: public BitField<int, 5, 11> {}; | 540 class ConditionField: public BitField<int, 5, 11> {}; |
543 | 541 |
544 Major MajorKey() { return Compare; } | 542 Major MajorKey() { return Compare; } |
545 | 543 |
546 int MinorKey(); | 544 int MinorKey(); |
547 | 545 |
548 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 546 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
549 virtual void FinishCode(Handle<Code> code) { | 547 virtual void FinishCode(Code* code) { |
550 code->set_compare_state(CompareIC::GENERIC); | 548 code->set_compare_state(CompareIC::GENERIC); |
551 } | 549 } |
552 | 550 |
553 // Branch to the label if the given object isn't a symbol. | 551 // Branch to the label if the given object isn't a symbol. |
554 void BranchIfNonSymbol(MacroAssembler* masm, | 552 void BranchIfNonSymbol(MacroAssembler* masm, |
555 Label* label, | 553 Label* label, |
556 Register object, | 554 Register object, |
557 Register scratch); | 555 Register scratch); |
558 | 556 |
559 // Unfortunately you have to run without snapshots to see most of these | 557 // 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... |
604 JSEntryStub() { } | 602 JSEntryStub() { } |
605 | 603 |
606 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 604 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
607 | 605 |
608 protected: | 606 protected: |
609 void GenerateBody(MacroAssembler* masm, bool is_construct); | 607 void GenerateBody(MacroAssembler* masm, bool is_construct); |
610 | 608 |
611 private: | 609 private: |
612 Major MajorKey() { return JSEntry; } | 610 Major MajorKey() { return JSEntry; } |
613 int MinorKey() { return 0; } | 611 int MinorKey() { return 0; } |
614 | |
615 virtual void FinishCode(Handle<Code> code); | |
616 | |
617 int handler_offset_; | |
618 }; | 612 }; |
619 | 613 |
620 | 614 |
621 class JSConstructEntryStub : public JSEntryStub { | 615 class JSConstructEntryStub : public JSEntryStub { |
622 public: | 616 public: |
623 JSConstructEntryStub() { } | 617 JSConstructEntryStub() { } |
624 | 618 |
625 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 619 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
626 | 620 |
627 private: | 621 private: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 }; | 678 }; |
685 | 679 |
686 | 680 |
687 class CallFunctionStub: public CodeStub { | 681 class CallFunctionStub: public CodeStub { |
688 public: | 682 public: |
689 CallFunctionStub(int argc, CallFunctionFlags flags) | 683 CallFunctionStub(int argc, CallFunctionFlags flags) |
690 : argc_(argc), flags_(flags) { } | 684 : argc_(argc), flags_(flags) { } |
691 | 685 |
692 void Generate(MacroAssembler* masm); | 686 void Generate(MacroAssembler* masm); |
693 | 687 |
694 virtual void FinishCode(Handle<Code> code); | 688 virtual void FinishCode(Code* code); |
695 | 689 |
696 static void Clear(Heap* heap, Address address); | 690 static void Clear(Heap* heap, Address address); |
697 | 691 |
698 static Object* GetCachedValue(Address address); | 692 static Object* GetCachedValue(Address address); |
699 | 693 |
700 static int ExtractArgcFromMinorKey(int minor_key) { | 694 static int ExtractArgcFromMinorKey(int minor_key) { |
701 return ArgcBits::decode(minor_key); | 695 return ArgcBits::decode(minor_key); |
702 } | 696 } |
703 | 697 |
704 // The object that indicates an uninitialized cache. | 698 // The object that indicates an uninitialized cache. |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 void Generate(MacroAssembler* masm); | 989 void Generate(MacroAssembler* masm); |
996 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } | 990 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } |
997 virtual void PrintName(StringStream* stream); | 991 virtual void PrintName(StringStream* stream); |
998 | 992 |
999 virtual bool SometimesSetsUpAFrame() { return false; } | 993 virtual bool SometimesSetsUpAFrame() { return false; } |
1000 | 994 |
1001 private: | 995 private: |
1002 Major MajorKey() { return ToBoolean; } | 996 Major MajorKey() { return ToBoolean; } |
1003 int MinorKey() { return (tos_.code() << NUMBER_OF_TYPES) | types_.ToByte(); } | 997 int MinorKey() { return (tos_.code() << NUMBER_OF_TYPES) | types_.ToByte(); } |
1004 | 998 |
1005 virtual void FinishCode(Handle<Code> code) { | 999 virtual void FinishCode(Code* code) { |
1006 code->set_to_boolean_state(types_.ToByte()); | 1000 code->set_to_boolean_state(types_.ToByte()); |
1007 } | 1001 } |
1008 | 1002 |
1009 void CheckOddball(MacroAssembler* masm, | 1003 void CheckOddball(MacroAssembler* masm, |
1010 Type type, | 1004 Type type, |
1011 Heap::RootListIndex value, | 1005 Heap::RootListIndex value, |
1012 bool result); | 1006 bool result); |
1013 void GenerateTypeTransition(MacroAssembler* masm); | 1007 void GenerateTypeTransition(MacroAssembler* masm); |
1014 | 1008 |
1015 Register tos_; | 1009 Register tos_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 int MinorKey() { return 0; } | 1056 int MinorKey() { return 0; } |
1063 | 1057 |
1064 void Generate(MacroAssembler* masm); | 1058 void Generate(MacroAssembler* masm); |
1065 | 1059 |
1066 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1060 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1067 }; | 1061 }; |
1068 | 1062 |
1069 } } // namespace v8::internal | 1063 } } // namespace v8::internal |
1070 | 1064 |
1071 #endif // V8_CODE_STUBS_H_ | 1065 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |