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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 // Generates the fast case code. On the fallthrough path |result| | 1053 // Generates the fast case code. On the fallthrough path |result| |
1054 // register contains the result. | 1054 // register contains the result. |
1055 void GenerateFast(MacroAssembler* masm); | 1055 void GenerateFast(MacroAssembler* masm); |
1056 | 1056 |
1057 // Generates the slow case code. Must not be naturally | 1057 // Generates the slow case code. Must not be naturally |
1058 // reachable. Expected to be put after a ret instruction (e.g., in | 1058 // reachable. Expected to be put after a ret instruction (e.g., in |
1059 // deferred code). Always jumps back to the fast case. | 1059 // deferred code). Always jumps back to the fast case. |
1060 void GenerateSlow(MacroAssembler* masm, | 1060 void GenerateSlow(MacroAssembler* masm, |
1061 const RuntimeCallHelper& call_helper); | 1061 const RuntimeCallHelper& call_helper); |
1062 | 1062 |
| 1063 // Skip handling slow case and directly jump to bailout. |
| 1064 void SkipSlow(MacroAssembler* masm, Label* bailout) { |
| 1065 masm->bind(&index_not_smi_); |
| 1066 masm->bind(&call_runtime_); |
| 1067 masm->jmp(bailout); |
| 1068 } |
| 1069 |
1063 private: | 1070 private: |
1064 Register object_; | 1071 Register object_; |
1065 Register index_; | 1072 Register index_; |
1066 Register result_; | 1073 Register result_; |
1067 | 1074 |
1068 Label* receiver_not_string_; | 1075 Label* receiver_not_string_; |
1069 Label* index_not_number_; | 1076 Label* index_not_number_; |
1070 Label* index_out_of_range_; | 1077 Label* index_out_of_range_; |
1071 | 1078 |
1072 StringIndexFlags index_flags_; | 1079 StringIndexFlags index_flags_; |
(...skipping 20 matching lines...) Expand all Loading... |
1093 // Generates the fast case code. On the fallthrough path |result| | 1100 // Generates the fast case code. On the fallthrough path |result| |
1094 // register contains the result. | 1101 // register contains the result. |
1095 void GenerateFast(MacroAssembler* masm); | 1102 void GenerateFast(MacroAssembler* masm); |
1096 | 1103 |
1097 // Generates the slow case code. Must not be naturally | 1104 // Generates the slow case code. Must not be naturally |
1098 // reachable. Expected to be put after a ret instruction (e.g., in | 1105 // reachable. Expected to be put after a ret instruction (e.g., in |
1099 // deferred code). Always jumps back to the fast case. | 1106 // deferred code). Always jumps back to the fast case. |
1100 void GenerateSlow(MacroAssembler* masm, | 1107 void GenerateSlow(MacroAssembler* masm, |
1101 const RuntimeCallHelper& call_helper); | 1108 const RuntimeCallHelper& call_helper); |
1102 | 1109 |
| 1110 // Skip handling slow case and directly jump to bailout. |
| 1111 void SkipSlow(MacroAssembler* masm, Label* bailout) { |
| 1112 masm->bind(&slow_case_); |
| 1113 masm->jmp(bailout); |
| 1114 } |
| 1115 |
1103 private: | 1116 private: |
1104 Register code_; | 1117 Register code_; |
1105 Register result_; | 1118 Register result_; |
1106 | 1119 |
1107 Label slow_case_; | 1120 Label slow_case_; |
1108 Label exit_; | 1121 Label exit_; |
1109 | 1122 |
1110 DISALLOW_COPY_AND_ASSIGN(StringCharFromCodeGenerator); | 1123 DISALLOW_COPY_AND_ASSIGN(StringCharFromCodeGenerator); |
1111 }; | 1124 }; |
1112 | 1125 |
(...skipping 22 matching lines...) Expand all Loading... |
1135 index, | 1148 index, |
1136 scratch, | 1149 scratch, |
1137 receiver_not_string, | 1150 receiver_not_string, |
1138 index_not_number, | 1151 index_not_number, |
1139 index_out_of_range, | 1152 index_out_of_range, |
1140 index_flags), | 1153 index_flags), |
1141 char_from_code_generator_(scratch, result) {} | 1154 char_from_code_generator_(scratch, result) {} |
1142 | 1155 |
1143 // Generates the fast case code. On the fallthrough path |result| | 1156 // Generates the fast case code. On the fallthrough path |result| |
1144 // register contains the result. | 1157 // register contains the result. |
1145 void GenerateFast(MacroAssembler* masm); | 1158 void GenerateFast(MacroAssembler* masm) { |
| 1159 char_code_at_generator_.GenerateFast(masm); |
| 1160 char_from_code_generator_.GenerateFast(masm); |
| 1161 } |
1146 | 1162 |
1147 // Generates the slow case code. Must not be naturally | 1163 // Generates the slow case code. Must not be naturally |
1148 // reachable. Expected to be put after a ret instruction (e.g., in | 1164 // reachable. Expected to be put after a ret instruction (e.g., in |
1149 // deferred code). Always jumps back to the fast case. | 1165 // deferred code). Always jumps back to the fast case. |
1150 void GenerateSlow(MacroAssembler* masm, | 1166 void GenerateSlow(MacroAssembler* masm, |
1151 const RuntimeCallHelper& call_helper); | 1167 const RuntimeCallHelper& call_helper) { |
| 1168 char_code_at_generator_.GenerateSlow(masm, call_helper); |
| 1169 char_from_code_generator_.GenerateSlow(masm, call_helper); |
| 1170 } |
| 1171 |
| 1172 // Skip handling slow case and directly jump to bailout. |
| 1173 void SkipSlow(MacroAssembler* masm, Label* bailout) { |
| 1174 char_code_at_generator_.SkipSlow(masm, bailout); |
| 1175 char_from_code_generator_.SkipSlow(masm, bailout); |
| 1176 } |
1152 | 1177 |
1153 private: | 1178 private: |
1154 StringCharCodeAtGenerator char_code_at_generator_; | 1179 StringCharCodeAtGenerator char_code_at_generator_; |
1155 StringCharFromCodeGenerator char_from_code_generator_; | 1180 StringCharFromCodeGenerator char_from_code_generator_; |
1156 | 1181 |
1157 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1182 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
1158 }; | 1183 }; |
1159 | 1184 |
1160 | 1185 |
1161 class AllowStubCallsScope { | 1186 class AllowStubCallsScope { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 | 1498 |
1474 // The current function entry hook. | 1499 // The current function entry hook. |
1475 static FunctionEntryHook entry_hook_; | 1500 static FunctionEntryHook entry_hook_; |
1476 | 1501 |
1477 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1502 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1478 }; | 1503 }; |
1479 | 1504 |
1480 } } // namespace v8::internal | 1505 } } // namespace v8::internal |
1481 | 1506 |
1482 #endif // V8_CODE_STUBS_H_ | 1507 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |