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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 // Returns a name for logging/debugging purposes. | 203 // Returns a name for logging/debugging purposes. |
204 SmartArrayPointer<const char> GetName(); | 204 SmartArrayPointer<const char> GetName(); |
205 | 205 |
206 protected: | 206 protected: |
207 static bool CanUseFPRegisters(); | 207 static bool CanUseFPRegisters(); |
208 | 208 |
209 // Generates the assembler code for the stub. | 209 // Generates the assembler code for the stub. |
210 virtual Handle<Code> GenerateCode(Isolate* isolate) = 0; | 210 virtual Handle<Code> GenerateCode(Isolate* isolate) = 0; |
211 | 211 |
| 212 virtual void VerifyPlatformFeatures(Isolate* isolate); |
212 | 213 |
213 // Returns whether the code generated for this stub needs to be allocated as | 214 // Returns whether the code generated for this stub needs to be allocated as |
214 // a fixed (non-moveable) code object. | 215 // a fixed (non-moveable) code object. |
215 virtual bool NeedsImmovableCode() { return false; } | 216 virtual bool NeedsImmovableCode() { return false; } |
216 | 217 |
217 virtual void PrintBaseName(StringStream* stream); | 218 virtual void PrintBaseName(StringStream* stream); |
218 virtual void PrintState(StringStream* stream) { } | 219 virtual void PrintState(StringStream* stream) { } |
219 | 220 |
220 private: | 221 private: |
221 // Perform bookkeeping required after code generation when stub code is | 222 // Perform bookkeeping required after code generation when stub code is |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 | 1037 |
1037 virtual Code::Kind GetCodeKind() const { return Code::BINARY_OP_IC; } | 1038 virtual Code::Kind GetCodeKind() const { return Code::BINARY_OP_IC; } |
1038 virtual InlineCacheState GetICState() { | 1039 virtual InlineCacheState GetICState() { |
1039 if (Max(left_state_, right_state_) == NONE) { | 1040 if (Max(left_state_, right_state_) == NONE) { |
1040 return ::v8::internal::UNINITIALIZED; | 1041 return ::v8::internal::UNINITIALIZED; |
1041 } | 1042 } |
1042 if (Max(left_state_, right_state_) == GENERIC) return MEGAMORPHIC; | 1043 if (Max(left_state_, right_state_) == GENERIC) return MEGAMORPHIC; |
1043 return MONOMORPHIC; | 1044 return MONOMORPHIC; |
1044 } | 1045 } |
1045 | 1046 |
| 1047 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1048 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1049 } |
| 1050 |
1046 virtual Code::ExtraICState GetExtraICState() { | 1051 virtual Code::ExtraICState GetExtraICState() { |
1047 bool sse_field = Max(result_state_, Max(left_state_, right_state_)) > SMI && | 1052 bool sse_field = Max(result_state_, Max(left_state_, right_state_)) > SMI && |
1048 CpuFeatures::IsSafeForSnapshot(SSE2); | 1053 CpuFeatures::IsSafeForSnapshot(SSE2); |
1049 | 1054 |
1050 return OpBits::encode(encode_token(op_)) | 1055 return OpBits::encode(encode_token(op_)) |
1051 | LeftStateField::encode(left_state_) | 1056 | LeftStateField::encode(left_state_) |
1052 | RightStateField::encode(fixed_right_arg_.has_value | 1057 | RightStateField::encode(fixed_right_arg_.has_value |
1053 ? NONE : right_state_) | 1058 ? NONE : right_state_) |
1054 | ResultStateField::encode(result_state_) | 1059 | ResultStateField::encode(result_state_) |
1055 | HasFixedRightArgBits::encode(fixed_right_arg_.has_value) | 1060 | HasFixedRightArgBits::encode(fixed_right_arg_.has_value) |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 | 1346 |
1342 void Generate(MacroAssembler* masm); | 1347 void Generate(MacroAssembler* masm); |
1343 | 1348 |
1344 // The version of this stub that doesn't save doubles is generated ahead of | 1349 // The version of this stub that doesn't save doubles is generated ahead of |
1345 // time, so it's OK to call it from other stubs that can't cope with GC during | 1350 // time, so it's OK to call it from other stubs that can't cope with GC during |
1346 // their code generation. On machines that always have gp registers (x64) we | 1351 // their code generation. On machines that always have gp registers (x64) we |
1347 // can generate both variants ahead of time. | 1352 // can generate both variants ahead of time. |
1348 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE; | 1353 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE; |
1349 static void GenerateAheadOfTime(Isolate* isolate); | 1354 static void GenerateAheadOfTime(Isolate* isolate); |
1350 | 1355 |
| 1356 protected: |
| 1357 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1358 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1359 }; |
| 1360 |
1351 private: | 1361 private: |
1352 void GenerateCore(MacroAssembler* masm, | 1362 void GenerateCore(MacroAssembler* masm, |
1353 Label* throw_normal_exception, | 1363 Label* throw_normal_exception, |
1354 Label* throw_termination_exception, | 1364 Label* throw_termination_exception, |
1355 Label* throw_out_of_memory_exception, | 1365 Label* throw_out_of_memory_exception, |
1356 bool do_gc, | 1366 bool do_gc, |
1357 bool always_allocate_scope); | 1367 bool always_allocate_scope); |
1358 | 1368 |
1359 // Number of pointers/values returned. | 1369 // Number of pointers/values returned. |
1360 Isolate* isolate_; | 1370 Isolate* isolate_; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 } | 1769 } |
1760 | 1770 |
1761 int offset() { | 1771 int offset() { |
1762 return OffsetBits::decode(bit_field_); | 1772 return OffsetBits::decode(bit_field_); |
1763 } | 1773 } |
1764 | 1774 |
1765 void Generate(MacroAssembler* masm); | 1775 void Generate(MacroAssembler* masm); |
1766 | 1776 |
1767 virtual bool SometimesSetsUpAFrame() { return false; } | 1777 virtual bool SometimesSetsUpAFrame() { return false; } |
1768 | 1778 |
| 1779 protected: |
| 1780 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1781 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1782 } |
| 1783 |
1769 private: | 1784 private: |
1770 static const int kBitsPerRegisterNumber = 6; | 1785 static const int kBitsPerRegisterNumber = 6; |
1771 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); | 1786 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); |
1772 class SourceRegisterBits: | 1787 class SourceRegisterBits: |
1773 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT | 1788 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT |
1774 class DestinationRegisterBits: | 1789 class DestinationRegisterBits: |
1775 public BitField<int, kBitsPerRegisterNumber, | 1790 public BitField<int, kBitsPerRegisterNumber, |
1776 kBitsPerRegisterNumber> {}; // NOLINT | 1791 kBitsPerRegisterNumber> {}; // NOLINT |
1777 class IsTruncatingBits: | 1792 class IsTruncatingBits: |
1778 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT | 1793 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 int MinorKey() { return 0; } | 2356 int MinorKey() { return 0; } |
2342 | 2357 |
2343 void Generate(MacroAssembler* masm); | 2358 void Generate(MacroAssembler* masm); |
2344 | 2359 |
2345 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2360 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2346 }; | 2361 }; |
2347 | 2362 |
2348 } } // namespace v8::internal | 2363 } } // namespace v8::internal |
2349 | 2364 |
2350 #endif // V8_CODE_STUBS_H_ | 2365 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |