Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/code-stubs.h

Issue 275433004: Require SSE2 support for the ia32 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 virtual void PrintName(StringStream* stream); 185 virtual void PrintName(StringStream* stream);
186 186
187 // Returns a name for logging/debugging purposes. 187 // Returns a name for logging/debugging purposes.
188 SmartArrayPointer<const char> GetName(); 188 SmartArrayPointer<const char> GetName();
189 189
190 Isolate* isolate() const { return isolate_; } 190 Isolate* isolate() const { return isolate_; }
191 191
192 protected: 192 protected:
193 static bool CanUseFPRegisters();
194
195 // Generates the assembler code for the stub. 193 // Generates the assembler code for the stub.
196 virtual Handle<Code> GenerateCode() = 0; 194 virtual Handle<Code> GenerateCode() = 0;
197 195
198 virtual void VerifyPlatformFeatures(); 196 virtual void VerifyPlatformFeatures();
199 197
200 // Returns whether the code generated for this stub needs to be allocated as 198 // Returns whether the code generated for this stub needs to be allocated as
201 // a fixed (non-moveable) code object. 199 // a fixed (non-moveable) code object.
202 virtual bool NeedsImmovableCode() { return false; } 200 virtual bool NeedsImmovableCode() { return false; }
203 201
204 virtual void PrintBaseName(StringStream* stream); 202 virtual void PrintBaseName(StringStream* stream);
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 } 1158 }
1161 1159
1162 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { 1160 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE {
1163 return state_.GetICState(); 1161 return state_.GetICState();
1164 } 1162 }
1165 1163
1166 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { 1164 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE {
1167 return state_.GetExtraICState(); 1165 return state_.GetExtraICState();
1168 } 1166 }
1169 1167
1170 virtual void VerifyPlatformFeatures() V8_FINAL V8_OVERRIDE { 1168 virtual void VerifyPlatformFeatures() V8_FINAL V8_OVERRIDE { }
1171 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1172 }
1173 1169
1174 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 1170 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
1175 1171
1176 const BinaryOpIC::State& state() const { return state_; } 1172 const BinaryOpIC::State& state() const { return state_; }
1177 1173
1178 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; 1174 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE;
1179 1175
1180 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } 1176 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; }
1181 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { 1177 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE {
1182 return GetExtraICState(); 1178 return GetExtraICState();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 } 1213 }
1218 1214
1219 virtual InlineCacheState GetICState() V8_OVERRIDE { 1215 virtual InlineCacheState GetICState() V8_OVERRIDE {
1220 return state_.GetICState(); 1216 return state_.GetICState();
1221 } 1217 }
1222 1218
1223 virtual ExtraICState GetExtraICState() V8_OVERRIDE { 1219 virtual ExtraICState GetExtraICState() V8_OVERRIDE {
1224 return state_.GetExtraICState(); 1220 return state_.GetExtraICState();
1225 } 1221 }
1226 1222
1227 virtual void VerifyPlatformFeatures() V8_OVERRIDE { 1223 virtual void VerifyPlatformFeatures() V8_OVERRIDE { }
1228 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1229 }
1230 1224
1231 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1225 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1232 1226
1233 virtual void PrintState(StringStream* stream) V8_OVERRIDE; 1227 virtual void PrintState(StringStream* stream) V8_OVERRIDE;
1234 1228
1235 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } 1229 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; }
1236 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } 1230 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); }
1237 1231
1238 private: 1232 private:
1239 static void GenerateAheadOfTime(Isolate* isolate, 1233 static void GenerateAheadOfTime(Isolate* isolate,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 PretenureFlagBits::encode(pretenure_flag)) {} 1294 PretenureFlagBits::encode(pretenure_flag)) {}
1301 1295
1302 StringAddFlags flags() const { 1296 StringAddFlags flags() const {
1303 return StringAddFlagsBits::decode(bit_field_); 1297 return StringAddFlagsBits::decode(bit_field_);
1304 } 1298 }
1305 1299
1306 PretenureFlag pretenure_flag() const { 1300 PretenureFlag pretenure_flag() const {
1307 return PretenureFlagBits::decode(bit_field_); 1301 return PretenureFlagBits::decode(bit_field_);
1308 } 1302 }
1309 1303
1310 virtual void VerifyPlatformFeatures() V8_OVERRIDE { 1304 virtual void VerifyPlatformFeatures() V8_OVERRIDE { }
1311 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1312 }
1313 1305
1314 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 1306 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
1315 1307
1316 virtual void InitializeInterfaceDescriptor( 1308 virtual void InitializeInterfaceDescriptor(
1317 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1309 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1318 1310
1319 static void InstallDescriptors(Isolate* isolate); 1311 static void InstallDescriptors(Isolate* isolate);
1320 1312
1321 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1313 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1322 static const int kLeft = 0; 1314 static const int kLeft = 0;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 1506
1515 void Generate(MacroAssembler* masm); 1507 void Generate(MacroAssembler* masm);
1516 1508
1517 // The version of this stub that doesn't save doubles is generated ahead of 1509 // 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 1510 // 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 1511 // their code generation. On machines that always have gp registers (x64) we
1520 // can generate both variants ahead of time. 1512 // can generate both variants ahead of time.
1521 static void GenerateAheadOfTime(Isolate* isolate); 1513 static void GenerateAheadOfTime(Isolate* isolate);
1522 1514
1523 protected: 1515 protected:
1524 virtual void VerifyPlatformFeatures() V8_OVERRIDE { 1516 virtual void VerifyPlatformFeatures() V8_OVERRIDE { }
1525 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1526 };
1527 1517
1528 private: 1518 private:
1529 // Number of pointers/values returned. 1519 // Number of pointers/values returned.
1530 const int result_size_; 1520 const int result_size_;
1531 SaveFPRegsMode save_doubles_; 1521 SaveFPRegsMode save_doubles_;
1532 1522
1533 Major MajorKey() { return CEntry; } 1523 Major MajorKey() { return CEntry; }
1534 int MinorKey(); 1524 int MinorKey();
1535 1525
1536 bool NeedsImmovableCode(); 1526 bool NeedsImmovableCode();
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 Register destination, 1902 Register destination,
1913 int offset, 1903 int offset,
1914 bool is_truncating, 1904 bool is_truncating,
1915 bool skip_fastpath = false) 1905 bool skip_fastpath = false)
1916 : PlatformCodeStub(isolate), bit_field_(0) { 1906 : PlatformCodeStub(isolate), bit_field_(0) {
1917 bit_field_ = SourceRegisterBits::encode(source.code()) | 1907 bit_field_ = SourceRegisterBits::encode(source.code()) |
1918 DestinationRegisterBits::encode(destination.code()) | 1908 DestinationRegisterBits::encode(destination.code()) |
1919 OffsetBits::encode(offset) | 1909 OffsetBits::encode(offset) |
1920 IsTruncatingBits::encode(is_truncating) | 1910 IsTruncatingBits::encode(is_truncating) |
1921 SkipFastPathBits::encode(skip_fastpath) | 1911 SkipFastPathBits::encode(skip_fastpath) |
1922 SSEBits::encode( 1912 SSE3Bits::encode(CpuFeatures::IsSafeForSnapshot(isolate, SSE3) ? 1 : 0);
1923 CpuFeatures::IsSafeForSnapshot(isolate, SSE2) ?
1924 CpuFeatures::IsSafeForSnapshot(isolate, SSE3) ? 2 : 1 : 0);
1925 } 1913 }
1926 1914
1927 Register source() { 1915 Register source() {
1928 return Register::from_code(SourceRegisterBits::decode(bit_field_)); 1916 return Register::from_code(SourceRegisterBits::decode(bit_field_));
1929 } 1917 }
1930 1918
1931 Register destination() { 1919 Register destination() {
1932 return Register::from_code(DestinationRegisterBits::decode(bit_field_)); 1920 return Register::from_code(DestinationRegisterBits::decode(bit_field_));
1933 } 1921 }
1934 1922
1935 bool is_truncating() { 1923 bool is_truncating() {
1936 return IsTruncatingBits::decode(bit_field_); 1924 return IsTruncatingBits::decode(bit_field_);
1937 } 1925 }
1938 1926
1939 bool skip_fastpath() { 1927 bool skip_fastpath() {
1940 return SkipFastPathBits::decode(bit_field_); 1928 return SkipFastPathBits::decode(bit_field_);
1941 } 1929 }
1942 1930
1943 int offset() { 1931 int offset() {
1944 return OffsetBits::decode(bit_field_); 1932 return OffsetBits::decode(bit_field_);
1945 } 1933 }
1946 1934
1947 void Generate(MacroAssembler* masm); 1935 void Generate(MacroAssembler* masm);
1948 1936
1949 virtual bool SometimesSetsUpAFrame() { return false; } 1937 virtual bool SometimesSetsUpAFrame() { return false; }
1950 1938
1951 protected: 1939 protected:
1952 virtual void VerifyPlatformFeatures() V8_OVERRIDE { 1940 virtual void VerifyPlatformFeatures() V8_OVERRIDE { }
1953 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1954 }
1955 1941
1956 private: 1942 private:
1957 static const int kBitsPerRegisterNumber = 6; 1943 static const int kBitsPerRegisterNumber = 6;
1958 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); 1944 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters);
1959 class SourceRegisterBits: 1945 class SourceRegisterBits:
1960 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT 1946 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT
1961 class DestinationRegisterBits: 1947 class DestinationRegisterBits:
1962 public BitField<int, kBitsPerRegisterNumber, 1948 public BitField<int, kBitsPerRegisterNumber,
1963 kBitsPerRegisterNumber> {}; // NOLINT 1949 kBitsPerRegisterNumber> {}; // NOLINT
1964 class IsTruncatingBits: 1950 class IsTruncatingBits:
1965 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT 1951 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT
1966 class OffsetBits: 1952 class OffsetBits:
1967 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT 1953 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT
1968 class SkipFastPathBits: 1954 class SkipFastPathBits:
1969 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT 1955 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT
1970 class SSEBits: 1956 class SSE3Bits:
1971 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 2> {}; // NOLINT 1957 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT
1972 1958
1973 Major MajorKey() { return DoubleToI; } 1959 Major MajorKey() { return DoubleToI; }
1974 int MinorKey() { return bit_field_; } 1960 int MinorKey() { return bit_field_; }
1975 1961
1976 int bit_field_; 1962 int bit_field_;
1977 1963
1978 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); 1964 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub);
1979 }; 1965 };
1980 1966
1981 1967
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 2288
2303 class KeyedStoreElementStub : public PlatformCodeStub { 2289 class KeyedStoreElementStub : public PlatformCodeStub {
2304 public: 2290 public:
2305 KeyedStoreElementStub(Isolate* isolate, 2291 KeyedStoreElementStub(Isolate* isolate,
2306 bool is_js_array, 2292 bool is_js_array,
2307 ElementsKind elements_kind, 2293 ElementsKind elements_kind,
2308 KeyedAccessStoreMode store_mode) 2294 KeyedAccessStoreMode store_mode)
2309 : PlatformCodeStub(isolate), 2295 : PlatformCodeStub(isolate),
2310 is_js_array_(is_js_array), 2296 is_js_array_(is_js_array),
2311 elements_kind_(elements_kind), 2297 elements_kind_(elements_kind),
2312 store_mode_(store_mode), 2298 store_mode_(store_mode) { }
2313 fp_registers_(CanUseFPRegisters()) { }
2314 2299
2315 Major MajorKey() { return KeyedStoreElement; } 2300 Major MajorKey() { return KeyedStoreElement; }
2316 int MinorKey() { 2301 int MinorKey() {
2317 return ElementsKindBits::encode(elements_kind_) | 2302 return ElementsKindBits::encode(elements_kind_) |
2318 IsJSArrayBits::encode(is_js_array_) | 2303 IsJSArrayBits::encode(is_js_array_) |
2319 StoreModeBits::encode(store_mode_) | 2304 StoreModeBits::encode(store_mode_);
2320 FPRegisters::encode(fp_registers_);
2321 } 2305 }
2322 2306
2323 void Generate(MacroAssembler* masm); 2307 void Generate(MacroAssembler* masm);
2324 2308
2325 private: 2309 private:
2326 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; 2310 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
2327 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; 2311 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {};
2328 class IsJSArrayBits: public BitField<bool, 12, 1> {}; 2312 class IsJSArrayBits: public BitField<bool, 12, 1> {};
2329 class FPRegisters: public BitField<bool, 13, 1> {};
2330 2313
2331 bool is_js_array_; 2314 bool is_js_array_;
2332 ElementsKind elements_kind_; 2315 ElementsKind elements_kind_;
2333 KeyedAccessStoreMode store_mode_; 2316 KeyedAccessStoreMode store_mode_;
2334 bool fp_registers_;
2335 2317
2336 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); 2318 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub);
2337 }; 2319 };
2338 2320
2339 2321
2340 class ToBooleanStub: public HydrogenCodeStub { 2322 class ToBooleanStub: public HydrogenCodeStub {
2341 public: 2323 public:
2342 enum Type { 2324 enum Type {
2343 UNDEFINED, 2325 UNDEFINED,
2344 BOOLEAN, 2326 BOOLEAN,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 bool is_jsarray_; 2444 bool is_jsarray_;
2463 KeyedAccessStoreMode store_mode_; 2445 KeyedAccessStoreMode store_mode_;
2464 2446
2465 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); 2447 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub);
2466 }; 2448 };
2467 2449
2468 2450
2469 class StoreArrayLiteralElementStub : public PlatformCodeStub { 2451 class StoreArrayLiteralElementStub : public PlatformCodeStub {
2470 public: 2452 public:
2471 explicit StoreArrayLiteralElementStub(Isolate* isolate) 2453 explicit StoreArrayLiteralElementStub(Isolate* isolate)
2472 : PlatformCodeStub(isolate), fp_registers_(CanUseFPRegisters()) { } 2454 : PlatformCodeStub(isolate) { }
2473 2455
2474 private: 2456 private:
2475 class FPRegisters: public BitField<bool, 0, 1> {};
2476
2477 Major MajorKey() { return StoreArrayLiteralElement; } 2457 Major MajorKey() { return StoreArrayLiteralElement; }
2478 int MinorKey() { return FPRegisters::encode(fp_registers_); } 2458 int MinorKey() { return 0; }
2479 2459
2480 void Generate(MacroAssembler* masm); 2460 void Generate(MacroAssembler* masm);
2481 2461
2482 bool fp_registers_;
2483
2484 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 2462 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
2485 }; 2463 };
2486 2464
2487 2465
2488 class StubFailureTrampolineStub : public PlatformCodeStub { 2466 class StubFailureTrampolineStub : public PlatformCodeStub {
2489 public: 2467 public:
2490 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) 2468 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode)
2491 : PlatformCodeStub(isolate), 2469 : PlatformCodeStub(isolate),
2492 fp_registers_(CanUseFPRegisters()),
2493 function_mode_(function_mode) {} 2470 function_mode_(function_mode) {}
2494 2471
2495 static void GenerateAheadOfTime(Isolate* isolate); 2472 static void GenerateAheadOfTime(Isolate* isolate);
2496 2473
2497 private: 2474 private:
2498 class FPRegisters: public BitField<bool, 0, 1> {}; 2475 class FunctionModeField: public BitField<StubFunctionMode, 0, 1> {};
2499 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {};
2500 2476
2501 Major MajorKey() { return StubFailureTrampoline; } 2477 Major MajorKey() { return StubFailureTrampoline; }
2502 int MinorKey() { 2478 int MinorKey() {
2503 return FPRegisters::encode(fp_registers_) | 2479 return FunctionModeField::encode(function_mode_);
2504 FunctionModeField::encode(function_mode_);
2505 } 2480 }
2506 2481
2507 void Generate(MacroAssembler* masm); 2482 void Generate(MacroAssembler* masm);
2508 2483
2509 bool fp_registers_;
2510 StubFunctionMode function_mode_; 2484 StubFunctionMode function_mode_;
2511 2485
2512 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); 2486 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub);
2513 }; 2487 };
2514 2488
2515 2489
2516 class ProfileEntryHookStub : public PlatformCodeStub { 2490 class ProfileEntryHookStub : public PlatformCodeStub {
2517 public: 2491 public:
2518 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2492 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2519 2493
(...skipping 18 matching lines...) Expand all
2538 2512
2539 2513
2540 class CallDescriptors { 2514 class CallDescriptors {
2541 public: 2515 public:
2542 static void InitializeForIsolate(Isolate* isolate); 2516 static void InitializeForIsolate(Isolate* isolate);
2543 }; 2517 };
2544 2518
2545 } } // namespace v8::internal 2519 } } // namespace v8::internal
2546 2520
2547 #endif // V8_CODE_STUBS_H_ 2521 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/deoptimizer-arm64.cc ('k') | src/deoptimizer.h » ('j') | src/ia32/assembler-ia32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698