| 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
| (...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 // TODO(bmeurer/mvstanton): Turn CallConstructStub into ConstructICStub. | 2152 // TODO(bmeurer/mvstanton): Turn CallConstructStub into ConstructICStub. |
| 2153 class CallConstructStub final : public PlatformCodeStub { | 2153 class CallConstructStub final : public PlatformCodeStub { |
| 2154 public: | 2154 public: |
| 2155 explicit CallConstructStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2155 explicit CallConstructStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 2156 | 2156 |
| 2157 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); | 2157 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); |
| 2158 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); | 2158 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); |
| 2159 }; | 2159 }; |
| 2160 | 2160 |
| 2161 | 2161 |
| 2162 enum StringIndexFlags { | |
| 2163 // Accepts smis or heap numbers. | |
| 2164 STRING_INDEX_IS_NUMBER, | |
| 2165 | |
| 2166 // Accepts smis or heap numbers that are valid array indices | |
| 2167 // (ECMA-262 15.4). Invalid indices are reported as being out of | |
| 2168 // range. | |
| 2169 STRING_INDEX_IS_ARRAY_INDEX | |
| 2170 }; | |
| 2171 | |
| 2172 | |
| 2173 enum ReceiverCheckMode { | 2162 enum ReceiverCheckMode { |
| 2174 // We don't know anything about the receiver. | 2163 // We don't know anything about the receiver. |
| 2175 RECEIVER_IS_UNKNOWN, | 2164 RECEIVER_IS_UNKNOWN, |
| 2176 | 2165 |
| 2177 // We know the receiver is a string. | 2166 // We know the receiver is a string. |
| 2178 RECEIVER_IS_STRING | 2167 RECEIVER_IS_STRING |
| 2179 }; | 2168 }; |
| 2180 | 2169 |
| 2181 | 2170 |
| 2182 enum EmbedMode { | 2171 enum EmbedMode { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2196 // flags. Otherwise, bails out to the provided labels. | 2185 // flags. Otherwise, bails out to the provided labels. |
| 2197 // | 2186 // |
| 2198 // Register usage: |object| may be changed to another string in a way | 2187 // Register usage: |object| may be changed to another string in a way |
| 2199 // that doesn't affect charCodeAt/charAt semantics, |index| is | 2188 // that doesn't affect charCodeAt/charAt semantics, |index| is |
| 2200 // preserved, |scratch| and |result| are clobbered. | 2189 // preserved, |scratch| and |result| are clobbered. |
| 2201 class StringCharCodeAtGenerator { | 2190 class StringCharCodeAtGenerator { |
| 2202 public: | 2191 public: |
| 2203 StringCharCodeAtGenerator(Register object, Register index, Register result, | 2192 StringCharCodeAtGenerator(Register object, Register index, Register result, |
| 2204 Label* receiver_not_string, Label* index_not_number, | 2193 Label* receiver_not_string, Label* index_not_number, |
| 2205 Label* index_out_of_range, | 2194 Label* index_out_of_range, |
| 2206 StringIndexFlags index_flags, | |
| 2207 ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN) | 2195 ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN) |
| 2208 : object_(object), | 2196 : object_(object), |
| 2209 index_(index), | 2197 index_(index), |
| 2210 result_(result), | 2198 result_(result), |
| 2211 receiver_not_string_(receiver_not_string), | 2199 receiver_not_string_(receiver_not_string), |
| 2212 index_not_number_(index_not_number), | 2200 index_not_number_(index_not_number), |
| 2213 index_out_of_range_(index_out_of_range), | 2201 index_out_of_range_(index_out_of_range), |
| 2214 index_flags_(index_flags), | |
| 2215 check_mode_(check_mode) { | 2202 check_mode_(check_mode) { |
| 2216 DCHECK(!result_.is(object_)); | 2203 DCHECK(!result_.is(object_)); |
| 2217 DCHECK(!result_.is(index_)); | 2204 DCHECK(!result_.is(index_)); |
| 2218 } | 2205 } |
| 2219 | 2206 |
| 2220 // Generates the fast case code. On the fallthrough path |result| | 2207 // Generates the fast case code. On the fallthrough path |result| |
| 2221 // register contains the result. | 2208 // register contains the result. |
| 2222 void GenerateFast(MacroAssembler* masm); | 2209 void GenerateFast(MacroAssembler* masm); |
| 2223 | 2210 |
| 2224 // Generates the slow case code. Must not be naturally | 2211 // Generates the slow case code. Must not be naturally |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2236 | 2223 |
| 2237 private: | 2224 private: |
| 2238 Register object_; | 2225 Register object_; |
| 2239 Register index_; | 2226 Register index_; |
| 2240 Register result_; | 2227 Register result_; |
| 2241 | 2228 |
| 2242 Label* receiver_not_string_; | 2229 Label* receiver_not_string_; |
| 2243 Label* index_not_number_; | 2230 Label* index_not_number_; |
| 2244 Label* index_out_of_range_; | 2231 Label* index_out_of_range_; |
| 2245 | 2232 |
| 2246 StringIndexFlags index_flags_; | |
| 2247 ReceiverCheckMode check_mode_; | 2233 ReceiverCheckMode check_mode_; |
| 2248 | 2234 |
| 2249 Label call_runtime_; | 2235 Label call_runtime_; |
| 2250 Label index_not_smi_; | 2236 Label index_not_smi_; |
| 2251 Label got_smi_index_; | 2237 Label got_smi_index_; |
| 2252 Label exit_; | 2238 Label exit_; |
| 2253 | 2239 |
| 2254 DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtGenerator); | 2240 DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtGenerator); |
| 2255 }; | 2241 }; |
| 2256 | 2242 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 // flags. Otherwise, bails out to the provided labels. | 2286 // flags. Otherwise, bails out to the provided labels. |
| 2301 // | 2287 // |
| 2302 // Register usage: |object| may be changed to another string in a way | 2288 // Register usage: |object| may be changed to another string in a way |
| 2303 // that doesn't affect charCodeAt/charAt semantics, |index| is | 2289 // that doesn't affect charCodeAt/charAt semantics, |index| is |
| 2304 // preserved, |scratch1|, |scratch2|, and |result| are clobbered. | 2290 // preserved, |scratch1|, |scratch2|, and |result| are clobbered. |
| 2305 class StringCharAtGenerator { | 2291 class StringCharAtGenerator { |
| 2306 public: | 2292 public: |
| 2307 StringCharAtGenerator(Register object, Register index, Register scratch, | 2293 StringCharAtGenerator(Register object, Register index, Register scratch, |
| 2308 Register result, Label* receiver_not_string, | 2294 Register result, Label* receiver_not_string, |
| 2309 Label* index_not_number, Label* index_out_of_range, | 2295 Label* index_not_number, Label* index_out_of_range, |
| 2310 StringIndexFlags index_flags, | |
| 2311 ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN) | 2296 ReceiverCheckMode check_mode = RECEIVER_IS_UNKNOWN) |
| 2312 : char_code_at_generator_(object, index, scratch, receiver_not_string, | 2297 : char_code_at_generator_(object, index, scratch, receiver_not_string, |
| 2313 index_not_number, index_out_of_range, | 2298 index_not_number, index_out_of_range, |
| 2314 index_flags, check_mode), | 2299 check_mode), |
| 2315 char_from_code_generator_(scratch, result) {} | 2300 char_from_code_generator_(scratch, result) {} |
| 2316 | 2301 |
| 2317 // Generates the fast case code. On the fallthrough path |result| | 2302 // Generates the fast case code. On the fallthrough path |result| |
| 2318 // register contains the result. | 2303 // register contains the result. |
| 2319 void GenerateFast(MacroAssembler* masm) { | 2304 void GenerateFast(MacroAssembler* masm) { |
| 2320 char_code_at_generator_.GenerateFast(masm); | 2305 char_code_at_generator_.GenerateFast(masm); |
| 2321 char_from_code_generator_.GenerateFast(masm); | 2306 char_from_code_generator_.GenerateFast(masm); |
| 2322 } | 2307 } |
| 2323 | 2308 |
| 2324 // Generates the slow case code. Must not be naturally | 2309 // Generates the slow case code. Must not be naturally |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3261 #undef DEFINE_HYDROGEN_CODE_STUB | 3246 #undef DEFINE_HYDROGEN_CODE_STUB |
| 3262 #undef DEFINE_CODE_STUB | 3247 #undef DEFINE_CODE_STUB |
| 3263 #undef DEFINE_CODE_STUB_BASE | 3248 #undef DEFINE_CODE_STUB_BASE |
| 3264 | 3249 |
| 3265 extern Representation RepresentationFromType(Type* type); | 3250 extern Representation RepresentationFromType(Type* type); |
| 3266 | 3251 |
| 3267 } // namespace internal | 3252 } // namespace internal |
| 3268 } // namespace v8 | 3253 } // namespace v8 |
| 3269 | 3254 |
| 3270 #endif // V8_CODE_STUBS_H_ | 3255 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |