| 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 27 matching lines...) Expand all Loading... |
| 38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 39 V(CallFunction) \ | 39 V(CallFunction) \ |
| 40 V(UnaryOp) \ | 40 V(UnaryOp) \ |
| 41 V(BinaryOp) \ | 41 V(BinaryOp) \ |
| 42 V(StringAdd) \ | 42 V(StringAdd) \ |
| 43 V(SubString) \ | 43 V(SubString) \ |
| 44 V(StringCompare) \ | 44 V(StringCompare) \ |
| 45 V(Compare) \ | 45 V(Compare) \ |
| 46 V(CompareIC) \ | 46 V(CompareIC) \ |
| 47 V(MathPow) \ | 47 V(MathPow) \ |
| 48 V(RecordWrite) \ |
| 49 V(StoreBufferOverflow) \ |
| 50 V(RegExpExec) \ |
| 48 V(TranscendentalCache) \ | 51 V(TranscendentalCache) \ |
| 49 V(Instanceof) \ | 52 V(Instanceof) \ |
| 50 /* All stubs above this line only exist in a few versions, which are */ \ | 53 /* All stubs above this line only exist in a few versions, which are */ \ |
| 51 /* generated ahead of time. Therefore compiling a call to one of */ \ | 54 /* generated ahead of time. Therefore compiling a call to one of */ \ |
| 52 /* them can't cause a new stub to be compiled, so compiling a call to */ \ | 55 /* them can't cause a new stub to be compiled, so compiling a call to */ \ |
| 53 /* them is GC safe. The ones below this line exist in many variants */ \ | 56 /* them is GC safe. The ones below this line exist in many variants */ \ |
| 54 /* so code compiling a call to one can cause a GC. This means they */ \ | 57 /* so code compiling a call to one can cause a GC. This means they */ \ |
| 55 /* can't be called from other stubs, since stub generation code is */ \ | 58 /* can't be called from other stubs, since stub generation code is */ \ |
| 56 /* not GC safe. */ \ | 59 /* not GC safe. */ \ |
| 57 V(ConvertToDouble) \ | 60 V(ConvertToDouble) \ |
| 58 V(WriteInt32ToHeapNumber) \ | 61 V(WriteInt32ToHeapNumber) \ |
| 59 V(StackCheck) \ | 62 V(StackCheck) \ |
| 60 V(FastNewClosure) \ | 63 V(FastNewClosure) \ |
| 61 V(FastNewContext) \ | 64 V(FastNewContext) \ |
| 62 V(FastCloneShallowArray) \ | 65 V(FastCloneShallowArray) \ |
| 63 V(RevertToNumber) \ | 66 V(RevertToNumber) \ |
| 64 V(ToBoolean) \ | 67 V(ToBoolean) \ |
| 65 V(ToNumber) \ | 68 V(ToNumber) \ |
| 66 V(CounterOp) \ | 69 V(CounterOp) \ |
| 67 V(ArgumentsAccess) \ | 70 V(ArgumentsAccess) \ |
| 68 V(RegExpExec) \ | |
| 69 V(RegExpConstructResult) \ | 71 V(RegExpConstructResult) \ |
| 70 V(NumberToString) \ | 72 V(NumberToString) \ |
| 71 V(CEntry) \ | 73 V(CEntry) \ |
| 72 V(JSEntry) \ | 74 V(JSEntry) \ |
| 73 V(KeyedLoadElement) \ | 75 V(KeyedLoadElement) \ |
| 74 V(KeyedStoreElement) \ | 76 V(KeyedStoreElement) \ |
| 75 V(DebuggerStatement) \ | 77 V(DebuggerStatement) \ |
| 76 V(StringDictionaryLookup) | 78 V(StringDictionaryLookup) |
| 77 | 79 |
| 78 // List of code stubs only used on ARM platforms. | 80 // List of code stubs only used on ARM platforms. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // Generates the assembler code for the stub. | 175 // Generates the assembler code for the stub. |
| 174 virtual void Generate(MacroAssembler* masm) = 0; | 176 virtual void Generate(MacroAssembler* masm) = 0; |
| 175 | 177 |
| 176 // Perform bookkeeping required after code generation when stub code is | 178 // Perform bookkeeping required after code generation when stub code is |
| 177 // initially generated. | 179 // initially generated. |
| 178 void RecordCodeGeneration(Code* code, MacroAssembler* masm); | 180 void RecordCodeGeneration(Code* code, MacroAssembler* masm); |
| 179 | 181 |
| 180 // Finish the code object after it has been generated. | 182 // Finish the code object after it has been generated. |
| 181 virtual void FinishCode(Code* code) { } | 183 virtual void FinishCode(Code* code) { } |
| 182 | 184 |
| 185 // Returns true if TryGetCode should fail if it failed |
| 186 // to register newly generated stub in the stub cache. |
| 187 virtual bool MustBeInStubCache() { return false; } |
| 188 |
| 189 // Activate newly generated stub. Is called after |
| 190 // registering stub in the stub cache. |
| 191 virtual void Activate(Code* code) { } |
| 192 |
| 183 // Returns information for computing the number key. | 193 // Returns information for computing the number key. |
| 184 virtual Major MajorKey() = 0; | 194 virtual Major MajorKey() = 0; |
| 185 virtual int MinorKey() = 0; | 195 virtual int MinorKey() = 0; |
| 186 | 196 |
| 187 // BinaryOpStub needs to override this. | 197 // BinaryOpStub needs to override this. |
| 188 virtual int GetCodeKind(); | 198 virtual int GetCodeKind(); |
| 189 | 199 |
| 190 // BinaryOpStub needs to override this. | 200 // BinaryOpStub needs to override this. |
| 191 virtual InlineCacheState GetICState() { | 201 virtual InlineCacheState GetICState() { |
| 192 return UNINITIALIZED; | 202 return UNINITIALIZED; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 Register scratch); | 547 Register scratch); |
| 538 | 548 |
| 539 // Unfortunately you have to run without snapshots to see most of these | 549 // Unfortunately you have to run without snapshots to see most of these |
| 540 // names in the profile since most compare stubs end up in the snapshot. | 550 // names in the profile since most compare stubs end up in the snapshot. |
| 541 virtual void PrintName(StringStream* stream); | 551 virtual void PrintName(StringStream* stream); |
| 542 }; | 552 }; |
| 543 | 553 |
| 544 | 554 |
| 545 class CEntryStub : public CodeStub { | 555 class CEntryStub : public CodeStub { |
| 546 public: | 556 public: |
| 547 explicit CEntryStub(int result_size) | 557 explicit CEntryStub(int result_size, |
| 548 : result_size_(result_size), save_doubles_(false) { } | 558 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
| 559 : result_size_(result_size), save_doubles_(save_doubles) { } |
| 549 | 560 |
| 550 void Generate(MacroAssembler* masm); | 561 void Generate(MacroAssembler* masm); |
| 551 void SaveDoubles() { save_doubles_ = true; } | |
| 552 | 562 |
| 553 // The version of this stub that doesn't save doubles is generated ahead of | 563 // The version of this stub that doesn't save doubles is generated ahead of |
| 554 // time, so it's OK to call it from other stubs that can't cope with GC during | 564 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 555 // their code generation. On machines that always have gp registers (x64) we | 565 // their code generation. On machines that always have gp registers (x64) we |
| 556 // can generate both variants ahead of time. | 566 // can generate both variants ahead of time. |
| 557 virtual bool CompilingCallsToThisStubIsGCSafe(); | 567 virtual bool CompilingCallsToThisStubIsGCSafe(); |
| 558 | 568 |
| 559 private: | 569 private: |
| 560 void GenerateCore(MacroAssembler* masm, | 570 void GenerateCore(MacroAssembler* masm, |
| 561 Label* throw_normal_exception, | 571 Label* throw_normal_exception, |
| 562 Label* throw_termination_exception, | 572 Label* throw_termination_exception, |
| 563 Label* throw_out_of_memory_exception, | 573 Label* throw_out_of_memory_exception, |
| 564 bool do_gc, | 574 bool do_gc, |
| 565 bool always_allocate_scope); | 575 bool always_allocate_scope); |
| 566 void GenerateThrowTOS(MacroAssembler* masm); | 576 void GenerateThrowTOS(MacroAssembler* masm); |
| 567 void GenerateThrowUncatchable(MacroAssembler* masm, | 577 void GenerateThrowUncatchable(MacroAssembler* masm, |
| 568 UncatchableExceptionType type); | 578 UncatchableExceptionType type); |
| 569 | 579 |
| 570 // Number of pointers/values returned. | 580 // Number of pointers/values returned. |
| 571 const int result_size_; | 581 const int result_size_; |
| 572 bool save_doubles_; | 582 SaveFPRegsMode save_doubles_; |
| 573 | 583 |
| 574 Major MajorKey() { return CEntry; } | 584 Major MajorKey() { return CEntry; } |
| 575 int MinorKey(); | 585 int MinorKey(); |
| 576 | 586 |
| 577 bool NeedsImmovableCode(); | 587 bool NeedsImmovableCode(); |
| 578 }; | 588 }; |
| 579 | 589 |
| 580 | 590 |
| 581 class JSEntryStub : public CodeStub { | 591 class JSEntryStub : public CodeStub { |
| 582 public: | 592 public: |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 bool result); | 979 bool result); |
| 970 void GenerateTypeTransition(MacroAssembler* masm); | 980 void GenerateTypeTransition(MacroAssembler* masm); |
| 971 | 981 |
| 972 Register tos_; | 982 Register tos_; |
| 973 Types types_; | 983 Types types_; |
| 974 }; | 984 }; |
| 975 | 985 |
| 976 } } // namespace v8::internal | 986 } } // namespace v8::internal |
| 977 | 987 |
| 978 #endif // V8_CODE_STUBS_H_ | 988 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |