| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_X64_CODE_STUBS_X64_H_ | 5 #ifndef V8_X64_CODE_STUBS_X64_H_ |
| 6 #define V8_X64_CODE_STUBS_X64_H_ | 6 #define V8_X64_CODE_STUBS_X64_H_ |
| 7 | 7 |
| 8 #include "src/ic-inl.h" | 8 #include "src/ic-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 | 13 |
| 14 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); | 14 void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code); |
| 15 | 15 |
| 16 class StoreBufferOverflowStub: public PlatformCodeStub { | 16 class StoreBufferOverflowStub: public PlatformCodeStub { |
| 17 public: | 17 public: |
| 18 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) | 18 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) |
| 19 : PlatformCodeStub(isolate), save_doubles_(save_fp) { } | 19 : PlatformCodeStub(isolate), save_doubles_(save_fp) { } |
| 20 | 20 |
| 21 void Generate(MacroAssembler* masm); | 21 void Generate(MacroAssembler* masm); |
| 22 | 22 |
| 23 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | 23 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); |
| 24 virtual bool SometimesSetsUpAFrame() { return false; } | 24 virtual bool SometimesSetsUpAFrame() { return false; } |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 SaveFPRegsMode save_doubles_; | 27 SaveFPRegsMode save_doubles_; |
| 28 | 28 |
| 29 Major MajorKey() { return StoreBufferOverflow; } | 29 Major MajorKey() const { return StoreBufferOverflow; } |
| 30 int MinorKey() { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | 30 int MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 | 33 |
| 34 class StringHelper : public AllStatic { | 34 class StringHelper : public AllStatic { |
| 35 public: | 35 public: |
| 36 // Generate code for copying characters using the rep movs instruction. | 36 // Generate code for copying characters using the rep movs instruction. |
| 37 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is | 37 // Copies rcx characters from rsi to rdi. Copying of overlapping regions is |
| 38 // not supported. | 38 // not supported. |
| 39 static void GenerateCopyCharacters(MacroAssembler* masm, | 39 static void GenerateCopyCharacters(MacroAssembler* masm, |
| 40 Register dest, | 40 Register dest, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 59 private: | 59 private: |
| 60 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | 60 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 | 63 |
| 64 class SubStringStub: public PlatformCodeStub { | 64 class SubStringStub: public PlatformCodeStub { |
| 65 public: | 65 public: |
| 66 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 66 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 Major MajorKey() { return SubString; } | 69 Major MajorKey() const { return SubString; } |
| 70 int MinorKey() { return 0; } | 70 int MinorKey() const { return 0; } |
| 71 | 71 |
| 72 void Generate(MacroAssembler* masm); | 72 void Generate(MacroAssembler* masm); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 | 75 |
| 76 class StringCompareStub: public PlatformCodeStub { | 76 class StringCompareStub: public PlatformCodeStub { |
| 77 public: | 77 public: |
| 78 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 78 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 79 | 79 |
| 80 // Compares two flat ASCII strings and returns result in rax. | 80 // Compares two flat ASCII strings and returns result in rax. |
| 81 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, | 81 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, |
| 82 Register left, | 82 Register left, |
| 83 Register right, | 83 Register right, |
| 84 Register scratch1, | 84 Register scratch1, |
| 85 Register scratch2, | 85 Register scratch2, |
| 86 Register scratch3, | 86 Register scratch3, |
| 87 Register scratch4); | 87 Register scratch4); |
| 88 | 88 |
| 89 // Compares two flat ASCII strings for equality and returns result | 89 // Compares two flat ASCII strings for equality and returns result |
| 90 // in rax. | 90 // in rax. |
| 91 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, | 91 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, |
| 92 Register left, | 92 Register left, |
| 93 Register right, | 93 Register right, |
| 94 Register scratch1, | 94 Register scratch1, |
| 95 Register scratch2); | 95 Register scratch2); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 virtual Major MajorKey() { return StringCompare; } | 98 virtual Major MajorKey() const { return StringCompare; } |
| 99 virtual int MinorKey() { return 0; } | 99 virtual int MinorKey() const { return 0; } |
| 100 virtual void Generate(MacroAssembler* masm); | 100 virtual void Generate(MacroAssembler* masm); |
| 101 | 101 |
| 102 static void GenerateAsciiCharsCompareLoop( | 102 static void GenerateAsciiCharsCompareLoop( |
| 103 MacroAssembler* masm, | 103 MacroAssembler* masm, |
| 104 Register left, | 104 Register left, |
| 105 Register right, | 105 Register right, |
| 106 Register length, | 106 Register length, |
| 107 Register scratch, | 107 Register scratch, |
| 108 Label* chars_not_equal, | 108 Label* chars_not_equal, |
| 109 Label::Distance near_jump = Label::kFar); | 109 Label::Distance near_jump = Label::kFar); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 static const int kTotalProbes = 20; | 149 static const int kTotalProbes = 20; |
| 150 | 150 |
| 151 static const int kCapacityOffset = | 151 static const int kCapacityOffset = |
| 152 NameDictionary::kHeaderSize + | 152 NameDictionary::kHeaderSize + |
| 153 NameDictionary::kCapacityIndex * kPointerSize; | 153 NameDictionary::kCapacityIndex * kPointerSize; |
| 154 | 154 |
| 155 static const int kElementsStartOffset = | 155 static const int kElementsStartOffset = |
| 156 NameDictionary::kHeaderSize + | 156 NameDictionary::kHeaderSize + |
| 157 NameDictionary::kElementsStartIndex * kPointerSize; | 157 NameDictionary::kElementsStartIndex * kPointerSize; |
| 158 | 158 |
| 159 Major MajorKey() { return NameDictionaryLookup; } | 159 Major MajorKey() const { return NameDictionaryLookup; } |
| 160 | 160 |
| 161 int MinorKey() { | 161 int MinorKey() const { |
| 162 return DictionaryBits::encode(dictionary_.code()) | | 162 return DictionaryBits::encode(dictionary_.code()) | |
| 163 ResultBits::encode(result_.code()) | | 163 ResultBits::encode(result_.code()) | |
| 164 IndexBits::encode(index_.code()) | | 164 IndexBits::encode(index_.code()) | |
| 165 LookupModeBits::encode(mode_); | 165 LookupModeBits::encode(mode_); |
| 166 } | 166 } |
| 167 | 167 |
| 168 class DictionaryBits: public BitField<int, 0, 4> {}; | 168 class DictionaryBits: public BitField<int, 0, 4> {}; |
| 169 class ResultBits: public BitField<int, 4, 4> {}; | 169 class ResultBits: public BitField<int, 4, 4> {}; |
| 170 class IndexBits: public BitField<int, 8, 4> {}; | 170 class IndexBits: public BitField<int, 8, 4> {}; |
| 171 class LookupModeBits: public BitField<LookupMode, 12, 1> {}; | 171 class LookupModeBits: public BitField<LookupMode, 12, 1> {}; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 }; | 380 }; |
| 381 | 381 |
| 382 void Generate(MacroAssembler* masm); | 382 void Generate(MacroAssembler* masm); |
| 383 void GenerateIncremental(MacroAssembler* masm, Mode mode); | 383 void GenerateIncremental(MacroAssembler* masm, Mode mode); |
| 384 void CheckNeedsToInformIncrementalMarker( | 384 void CheckNeedsToInformIncrementalMarker( |
| 385 MacroAssembler* masm, | 385 MacroAssembler* masm, |
| 386 OnNoNeedToInformIncrementalMarker on_no_need, | 386 OnNoNeedToInformIncrementalMarker on_no_need, |
| 387 Mode mode); | 387 Mode mode); |
| 388 void InformIncrementalMarker(MacroAssembler* masm); | 388 void InformIncrementalMarker(MacroAssembler* masm); |
| 389 | 389 |
| 390 Major MajorKey() { return RecordWrite; } | 390 Major MajorKey() const { return RecordWrite; } |
| 391 | 391 |
| 392 int MinorKey() { | 392 int MinorKey() const { |
| 393 return ObjectBits::encode(object_.code()) | | 393 return ObjectBits::encode(object_.code()) | |
| 394 ValueBits::encode(value_.code()) | | 394 ValueBits::encode(value_.code()) | |
| 395 AddressBits::encode(address_.code()) | | 395 AddressBits::encode(address_.code()) | |
| 396 RememberedSetActionBits::encode(remembered_set_action_) | | 396 RememberedSetActionBits::encode(remembered_set_action_) | |
| 397 SaveFPRegsModeBits::encode(save_fp_regs_mode_); | 397 SaveFPRegsModeBits::encode(save_fp_regs_mode_); |
| 398 } | 398 } |
| 399 | 399 |
| 400 void Activate(Code* code) { | 400 void Activate(Code* code) { |
| 401 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); | 401 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code); |
| 402 } | 402 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 413 RememberedSetAction remembered_set_action_; | 413 RememberedSetAction remembered_set_action_; |
| 414 SaveFPRegsMode save_fp_regs_mode_; | 414 SaveFPRegsMode save_fp_regs_mode_; |
| 415 Label slow_; | 415 Label slow_; |
| 416 RegisterAllocation regs_; | 416 RegisterAllocation regs_; |
| 417 }; | 417 }; |
| 418 | 418 |
| 419 | 419 |
| 420 } } // namespace v8::internal | 420 } } // namespace v8::internal |
| 421 | 421 |
| 422 #endif // V8_X64_CODE_STUBS_X64_H_ | 422 #endif // V8_X64_CODE_STUBS_X64_H_ |
| OLD | NEW |