| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
| 6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
| 7 | 7 |
| 8 #include "allocation.h" | 8 #include "allocation.h" |
| 9 #include "assembler.h" | 9 #include "assembler.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { | 1162 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { |
| 1163 return state_.GetICState(); | 1163 return state_.GetICState(); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { | 1166 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { |
| 1167 return state_.GetExtraICState(); | 1167 return state_.GetExtraICState(); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 virtual void VerifyPlatformFeatures() V8_FINAL V8_OVERRIDE { | 1170 virtual void VerifyPlatformFeatures() V8_FINAL V8_OVERRIDE { } |
| 1171 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | |
| 1172 } | |
| 1173 | 1171 |
| 1174 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1172 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1175 | 1173 |
| 1176 const BinaryOpIC::State& state() const { return state_; } | 1174 const BinaryOpIC::State& state() const { return state_; } |
| 1177 | 1175 |
| 1178 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; | 1176 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; |
| 1179 | 1177 |
| 1180 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } | 1178 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } |
| 1181 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { | 1179 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { |
| 1182 return GetExtraICState(); | 1180 return GetExtraICState(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 } | 1215 } |
| 1218 | 1216 |
| 1219 virtual InlineCacheState GetICState() V8_OVERRIDE { | 1217 virtual InlineCacheState GetICState() V8_OVERRIDE { |
| 1220 return state_.GetICState(); | 1218 return state_.GetICState(); |
| 1221 } | 1219 } |
| 1222 | 1220 |
| 1223 virtual ExtraICState GetExtraICState() V8_OVERRIDE { | 1221 virtual ExtraICState GetExtraICState() V8_OVERRIDE { |
| 1224 return state_.GetExtraICState(); | 1222 return state_.GetExtraICState(); |
| 1225 } | 1223 } |
| 1226 | 1224 |
| 1227 virtual void VerifyPlatformFeatures() V8_OVERRIDE { | 1225 virtual void VerifyPlatformFeatures() V8_OVERRIDE { } |
| 1228 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | |
| 1229 } | |
| 1230 | 1226 |
| 1231 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1227 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
| 1232 | 1228 |
| 1233 virtual void PrintState(StringStream* stream) V8_OVERRIDE; | 1229 virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
| 1234 | 1230 |
| 1235 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } | 1231 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } |
| 1236 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } | 1232 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } |
| 1237 | 1233 |
| 1238 private: | 1234 private: |
| 1239 static void GenerateAheadOfTime(Isolate* isolate, | 1235 static void GenerateAheadOfTime(Isolate* isolate, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 PretenureFlagBits::encode(pretenure_flag)) {} | 1296 PretenureFlagBits::encode(pretenure_flag)) {} |
| 1301 | 1297 |
| 1302 StringAddFlags flags() const { | 1298 StringAddFlags flags() const { |
| 1303 return StringAddFlagsBits::decode(bit_field_); | 1299 return StringAddFlagsBits::decode(bit_field_); |
| 1304 } | 1300 } |
| 1305 | 1301 |
| 1306 PretenureFlag pretenure_flag() const { | 1302 PretenureFlag pretenure_flag() const { |
| 1307 return PretenureFlagBits::decode(bit_field_); | 1303 return PretenureFlagBits::decode(bit_field_); |
| 1308 } | 1304 } |
| 1309 | 1305 |
| 1310 virtual void VerifyPlatformFeatures() V8_OVERRIDE { | 1306 virtual void VerifyPlatformFeatures() V8_OVERRIDE { } |
| 1311 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | |
| 1312 } | |
| 1313 | 1307 |
| 1314 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1308 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1315 | 1309 |
| 1316 virtual void InitializeInterfaceDescriptor( | 1310 virtual void InitializeInterfaceDescriptor( |
| 1317 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1311 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1318 | 1312 |
| 1319 static void InstallDescriptors(Isolate* isolate); | 1313 static void InstallDescriptors(Isolate* isolate); |
| 1320 | 1314 |
| 1321 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1315 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1322 static const int kLeft = 0; | 1316 static const int kLeft = 0; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 | 1508 |
| 1515 void Generate(MacroAssembler* masm); | 1509 void Generate(MacroAssembler* masm); |
| 1516 | 1510 |
| 1517 // The version of this stub that doesn't save doubles is generated ahead of | 1511 // The version of this stub that doesn't save doubles is generated ahead of |
| 1518 // time, so it's OK to call it from other stubs that can't cope with GC during | 1512 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 1519 // their code generation. On machines that always have gp registers (x64) we | 1513 // their code generation. On machines that always have gp registers (x64) we |
| 1520 // can generate both variants ahead of time. | 1514 // can generate both variants ahead of time. |
| 1521 static void GenerateAheadOfTime(Isolate* isolate); | 1515 static void GenerateAheadOfTime(Isolate* isolate); |
| 1522 | 1516 |
| 1523 protected: | 1517 protected: |
| 1524 virtual void VerifyPlatformFeatures() V8_OVERRIDE { | 1518 virtual void VerifyPlatformFeatures() V8_OVERRIDE { } |
| 1525 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | |
| 1526 }; | |
| 1527 | 1519 |
| 1528 private: | 1520 private: |
| 1529 // Number of pointers/values returned. | 1521 // Number of pointers/values returned. |
| 1530 const int result_size_; | 1522 const int result_size_; |
| 1531 SaveFPRegsMode save_doubles_; | 1523 SaveFPRegsMode save_doubles_; |
| 1532 | 1524 |
| 1533 Major MajorKey() { return CEntry; } | 1525 Major MajorKey() { return CEntry; } |
| 1534 int MinorKey(); | 1526 int MinorKey(); |
| 1535 | 1527 |
| 1536 bool NeedsImmovableCode(); | 1528 bool NeedsImmovableCode(); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 Register destination, | 1904 Register destination, |
| 1913 int offset, | 1905 int offset, |
| 1914 bool is_truncating, | 1906 bool is_truncating, |
| 1915 bool skip_fastpath = false) | 1907 bool skip_fastpath = false) |
| 1916 : PlatformCodeStub(isolate), bit_field_(0) { | 1908 : PlatformCodeStub(isolate), bit_field_(0) { |
| 1917 bit_field_ = SourceRegisterBits::encode(source.code()) | | 1909 bit_field_ = SourceRegisterBits::encode(source.code()) | |
| 1918 DestinationRegisterBits::encode(destination.code()) | | 1910 DestinationRegisterBits::encode(destination.code()) | |
| 1919 OffsetBits::encode(offset) | | 1911 OffsetBits::encode(offset) | |
| 1920 IsTruncatingBits::encode(is_truncating) | | 1912 IsTruncatingBits::encode(is_truncating) | |
| 1921 SkipFastPathBits::encode(skip_fastpath) | | 1913 SkipFastPathBits::encode(skip_fastpath) | |
| 1922 SSEBits::encode( | 1914 SSE3Bits::encode(CpuFeatures::IsSafeForSnapshot(isolate, SSE3) ? 1 : 0); |
| 1923 CpuFeatures::IsSafeForSnapshot(isolate, SSE2) ? | |
| 1924 CpuFeatures::IsSafeForSnapshot(isolate, SSE3) ? 2 : 1 : 0); | |
| 1925 } | 1915 } |
| 1926 | 1916 |
| 1927 Register source() { | 1917 Register source() { |
| 1928 return Register::from_code(SourceRegisterBits::decode(bit_field_)); | 1918 return Register::from_code(SourceRegisterBits::decode(bit_field_)); |
| 1929 } | 1919 } |
| 1930 | 1920 |
| 1931 Register destination() { | 1921 Register destination() { |
| 1932 return Register::from_code(DestinationRegisterBits::decode(bit_field_)); | 1922 return Register::from_code(DestinationRegisterBits::decode(bit_field_)); |
| 1933 } | 1923 } |
| 1934 | 1924 |
| 1935 bool is_truncating() { | 1925 bool is_truncating() { |
| 1936 return IsTruncatingBits::decode(bit_field_); | 1926 return IsTruncatingBits::decode(bit_field_); |
| 1937 } | 1927 } |
| 1938 | 1928 |
| 1939 bool skip_fastpath() { | 1929 bool skip_fastpath() { |
| 1940 return SkipFastPathBits::decode(bit_field_); | 1930 return SkipFastPathBits::decode(bit_field_); |
| 1941 } | 1931 } |
| 1942 | 1932 |
| 1943 int offset() { | 1933 int offset() { |
| 1944 return OffsetBits::decode(bit_field_); | 1934 return OffsetBits::decode(bit_field_); |
| 1945 } | 1935 } |
| 1946 | 1936 |
| 1947 void Generate(MacroAssembler* masm); | 1937 void Generate(MacroAssembler* masm); |
| 1948 | 1938 |
| 1949 virtual bool SometimesSetsUpAFrame() { return false; } | 1939 virtual bool SometimesSetsUpAFrame() { return false; } |
| 1950 | 1940 |
| 1951 protected: | 1941 protected: |
| 1952 virtual void VerifyPlatformFeatures() V8_OVERRIDE { | 1942 virtual void VerifyPlatformFeatures() V8_OVERRIDE { } |
| 1953 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | |
| 1954 } | |
| 1955 | 1943 |
| 1956 private: | 1944 private: |
| 1957 static const int kBitsPerRegisterNumber = 6; | 1945 static const int kBitsPerRegisterNumber = 6; |
| 1958 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); | 1946 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); |
| 1959 class SourceRegisterBits: | 1947 class SourceRegisterBits: |
| 1960 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT | 1948 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT |
| 1961 class DestinationRegisterBits: | 1949 class DestinationRegisterBits: |
| 1962 public BitField<int, kBitsPerRegisterNumber, | 1950 public BitField<int, kBitsPerRegisterNumber, |
| 1963 kBitsPerRegisterNumber> {}; // NOLINT | 1951 kBitsPerRegisterNumber> {}; // NOLINT |
| 1964 class IsTruncatingBits: | 1952 class IsTruncatingBits: |
| 1965 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT | 1953 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT |
| 1966 class OffsetBits: | 1954 class OffsetBits: |
| 1967 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT | 1955 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT |
| 1968 class SkipFastPathBits: | 1956 class SkipFastPathBits: |
| 1969 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT | 1957 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT |
| 1970 class SSEBits: | 1958 class SSE3Bits: |
| 1971 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 2> {}; // NOLINT | 1959 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
| 1972 | 1960 |
| 1973 Major MajorKey() { return DoubleToI; } | 1961 Major MajorKey() { return DoubleToI; } |
| 1974 int MinorKey() { return bit_field_; } | 1962 int MinorKey() { return bit_field_; } |
| 1975 | 1963 |
| 1976 int bit_field_; | 1964 int bit_field_; |
| 1977 | 1965 |
| 1978 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); | 1966 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); |
| 1979 }; | 1967 }; |
| 1980 | 1968 |
| 1981 | 1969 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 | 2526 |
| 2539 | 2527 |
| 2540 class CallDescriptors { | 2528 class CallDescriptors { |
| 2541 public: | 2529 public: |
| 2542 static void InitializeForIsolate(Isolate* isolate); | 2530 static void InitializeForIsolate(Isolate* isolate); |
| 2543 }; | 2531 }; |
| 2544 | 2532 |
| 2545 } } // namespace v8::internal | 2533 } } // namespace v8::internal |
| 2546 | 2534 |
| 2547 #endif // V8_CODE_STUBS_H_ | 2535 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |