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_IA32_CODE_STUBS_IA32_H_ | 5 #ifndef V8_IA32_CODE_STUBS_IA32_H_ |
6 #define V8_IA32_CODE_STUBS_IA32_H_ | 6 #define V8_IA32_CODE_STUBS_IA32_H_ |
7 | 7 |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 | 13 |
14 void ArrayNativeCode(MacroAssembler* masm, | 14 void ArrayNativeCode(MacroAssembler* masm, |
15 bool construct_call, | 15 bool construct_call, |
16 Label* call_generic_code); | 16 Label* call_generic_code); |
17 | 17 |
18 | 18 |
19 class StoreBufferOverflowStub : public PlatformCodeStub { | |
20 public: | |
21 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) | |
22 : PlatformCodeStub(isolate), save_doubles_(save_fp) { } | |
23 | |
24 void Generate(MacroAssembler* masm); | |
25 | |
26 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | |
27 virtual bool SometimesSetsUpAFrame() { return false; } | |
28 | |
29 private: | |
30 SaveFPRegsMode save_doubles_; | |
31 | |
32 Major MajorKey() const { return StoreBufferOverflow; } | |
33 uint32_t MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } | |
34 }; | |
35 | |
36 | |
37 class StringHelper : public AllStatic { | 19 class StringHelper : public AllStatic { |
38 public: | 20 public: |
39 // Generate code for copying characters using the rep movs instruction. | 21 // Generate code for copying characters using the rep movs instruction. |
40 // Copies ecx characters from esi to edi. Copying of overlapping regions is | 22 // Copies ecx characters from esi to edi. Copying of overlapping regions is |
41 // not supported. | 23 // not supported. |
42 static void GenerateCopyCharacters(MacroAssembler* masm, | 24 static void GenerateCopyCharacters(MacroAssembler* masm, |
43 Register dest, | 25 Register dest, |
44 Register src, | 26 Register src, |
45 Register count, | 27 Register count, |
46 Register scratch, | 28 Register scratch, |
47 String::Encoding encoding); | 29 String::Encoding encoding); |
48 | 30 |
49 // Generate string hash. | 31 // Generate string hash. |
50 static void GenerateHashInit(MacroAssembler* masm, | 32 static void GenerateHashInit(MacroAssembler* masm, |
51 Register hash, | 33 Register hash, |
52 Register character, | 34 Register character, |
53 Register scratch); | 35 Register scratch); |
| 36 |
54 static void GenerateHashAddCharacter(MacroAssembler* masm, | 37 static void GenerateHashAddCharacter(MacroAssembler* masm, |
55 Register hash, | 38 Register hash, |
56 Register character, | 39 Register character, |
57 Register scratch); | 40 Register scratch); |
| 41 |
58 static void GenerateHashGetHash(MacroAssembler* masm, | 42 static void GenerateHashGetHash(MacroAssembler* masm, |
59 Register hash, | 43 Register hash, |
60 Register scratch); | 44 Register scratch); |
61 | 45 |
62 private: | |
63 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); | |
64 }; | |
65 | |
66 | |
67 class SubStringStub: public PlatformCodeStub { | |
68 public: | |
69 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | |
70 | |
71 private: | |
72 Major MajorKey() const { return SubString; } | |
73 uint32_t MinorKey() const { return 0; } | |
74 | |
75 void Generate(MacroAssembler* masm); | |
76 }; | |
77 | |
78 | |
79 class StringCompareStub: public PlatformCodeStub { | |
80 public: | |
81 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | |
82 | |
83 // Compares two flat ASCII strings and returns result in eax. | 46 // Compares two flat ASCII strings and returns result in eax. |
84 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, | 47 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, |
85 Register left, | 48 Register left, Register right, |
86 Register right, | |
87 Register scratch1, | 49 Register scratch1, |
88 Register scratch2, | 50 Register scratch2, |
89 Register scratch3); | 51 Register scratch3); |
90 | 52 |
91 // Compares two flat ASCII strings for equality and returns result | 53 // Compares two flat ASCII strings for equality and returns result in eax. |
92 // in eax. | |
93 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, | 54 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, |
94 Register left, | 55 Register left, |
95 Register right, | 56 Register right, |
96 Register scratch1, | 57 Register scratch1, |
97 Register scratch2); | 58 Register scratch2); |
98 | 59 |
99 private: | 60 private: |
100 virtual Major MajorKey() const { return StringCompare; } | |
101 virtual uint32_t MinorKey() const { return 0; } | |
102 virtual void Generate(MacroAssembler* masm); | |
103 | |
104 static void GenerateAsciiCharsCompareLoop( | 61 static void GenerateAsciiCharsCompareLoop( |
105 MacroAssembler* masm, | 62 MacroAssembler* masm, |
106 Register left, | 63 Register left, |
107 Register right, | 64 Register right, |
108 Register length, | 65 Register length, |
109 Register scratch, | 66 Register scratch, |
110 Label* chars_not_equal, | 67 Label* chars_not_equal, |
111 Label::Distance chars_not_equal_near = Label::kFar); | 68 Label::Distance chars_not_equal_near = Label::kFar); |
| 69 |
| 70 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper); |
112 }; | 71 }; |
113 | 72 |
114 | 73 |
115 class NameDictionaryLookupStub: public PlatformCodeStub { | 74 class NameDictionaryLookupStub: public PlatformCodeStub { |
116 public: | 75 public: |
117 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 76 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
118 | 77 |
119 NameDictionaryLookupStub(Isolate* isolate, | 78 NameDictionaryLookupStub(Isolate* isolate, |
120 Register dictionary, | 79 Register dictionary, |
121 Register result, | 80 Register result, |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 Register address_; | 388 Register address_; |
430 RememberedSetAction remembered_set_action_; | 389 RememberedSetAction remembered_set_action_; |
431 SaveFPRegsMode save_fp_regs_mode_; | 390 SaveFPRegsMode save_fp_regs_mode_; |
432 RegisterAllocation regs_; | 391 RegisterAllocation regs_; |
433 }; | 392 }; |
434 | 393 |
435 | 394 |
436 } } // namespace v8::internal | 395 } } // namespace v8::internal |
437 | 396 |
438 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 397 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |