| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
| 6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include <functional> |
| 9 |
| 8 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
| 9 #include "src/objects.h" | 11 #include "src/objects.h" |
| 10 | 12 |
| 11 namespace v8 { | 13 namespace v8 { |
| 12 namespace internal { | 14 namespace internal { |
| 13 | 15 |
| 14 class CallInterfaceDescriptor; | 16 class CallInterfaceDescriptor; |
| 15 class StatsCounter; | 17 class StatsCounter; |
| 16 class StubCache; | 18 class StubCache; |
| 17 | 19 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 return BitFieldDecode(word32, T::kShift, T::kMask); | 265 return BitFieldDecode(word32, T::kShift, T::kMask); |
| 264 } | 266 } |
| 265 | 267 |
| 266 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, | 268 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, |
| 267 uint32_t mask); | 269 uint32_t mask); |
| 268 | 270 |
| 269 void SetCounter(StatsCounter* counter, int value); | 271 void SetCounter(StatsCounter* counter, int value); |
| 270 void IncrementCounter(StatsCounter* counter, int delta); | 272 void IncrementCounter(StatsCounter* counter, int delta); |
| 271 void DecrementCounter(StatsCounter* counter, int delta); | 273 void DecrementCounter(StatsCounter* counter, int delta); |
| 272 | 274 |
| 275 // Generates "if (false) goto label" code. Useful for marking a label as |
| 276 // "live" to avoid assertion failures during graph building. In the resulting |
| 277 // code this check will be eliminated. |
| 278 void Use(Label* label); |
| 279 |
| 273 // Various building blocks for stubs doing property lookups. | 280 // Various building blocks for stubs doing property lookups. |
| 274 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, | 281 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, |
| 275 Label* if_keyisunique, Label* if_bailout); | 282 Label* if_keyisunique, Label* if_bailout); |
| 276 | 283 |
| 277 // Calculates array index for given dictionary entry and entry field. | 284 // Calculates array index for given dictionary entry and entry field. |
| 278 // See Dictionary::EntryToIndex(). | 285 // See Dictionary::EntryToIndex(). |
| 279 template <typename Dictionary> | 286 template <typename Dictionary> |
| 280 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); | 287 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); |
| 281 template <typename Dictionary> | 288 template <typename Dictionary> |
| 282 compiler::Node* EntryToIndex(compiler::Node* entry) { | 289 compiler::Node* EntryToIndex(compiler::Node* entry) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 compiler::Node* unique_name, Label* if_found_fast, | 353 compiler::Node* unique_name, Label* if_found_fast, |
| 347 Label* if_found_dict, Label* if_found_global, | 354 Label* if_found_dict, Label* if_found_global, |
| 348 Variable* var_meta_storage, Variable* var_name_index, | 355 Variable* var_meta_storage, Variable* var_name_index, |
| 349 Label* if_not_found, Label* if_bailout); | 356 Label* if_not_found, Label* if_bailout); |
| 350 | 357 |
| 351 void TryLookupElement(compiler::Node* object, compiler::Node* map, | 358 void TryLookupElement(compiler::Node* object, compiler::Node* map, |
| 352 compiler::Node* instance_type, compiler::Node* index, | 359 compiler::Node* instance_type, compiler::Node* index, |
| 353 Label* if_found, Label* if_not_found, | 360 Label* if_found, Label* if_not_found, |
| 354 Label* if_bailout); | 361 Label* if_bailout); |
| 355 | 362 |
| 363 // This is a type of a lookup in holder generator function. In case of a |
| 364 // property lookup the {key} is guaranteed to be a unique name and in case of |
| 365 // element lookup the key is an Int32 index. |
| 366 typedef std::function<void(compiler::Node* receiver, compiler::Node* holder, |
| 367 compiler::Node* map, compiler::Node* instance_type, |
| 368 compiler::Node* key, Label* next_holder, |
| 369 Label* if_bailout)> |
| 370 LookupInHolder; |
| 371 |
| 372 // Generic property prototype chain lookup generator. |
| 373 // For properties it generates lookup using given {lookup_property_in_holder} |
| 374 // and for elements it uses {lookup_element_in_holder}. |
| 375 // Upon reaching the end of prototype chain the control goes to {if_end}. |
| 376 // If it can't handle the case {receiver}/{key} case then the control goes |
| 377 // to {if_bailout}. |
| 378 void TryPrototypeChainLookup(compiler::Node* receiver, compiler::Node* key, |
| 379 LookupInHolder& lookup_property_in_holder, |
| 380 LookupInHolder& lookup_element_in_holder, |
| 381 Label* if_end, Label* if_bailout); |
| 382 |
| 356 // Instanceof helpers. | 383 // Instanceof helpers. |
| 357 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 384 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
| 358 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 385 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
| 359 compiler::Node* callable, | 386 compiler::Node* callable, |
| 360 compiler::Node* object); | 387 compiler::Node* object); |
| 361 | 388 |
| 362 // LoadIC helpers. | 389 // LoadIC helpers. |
| 363 struct LoadICParameters { | 390 struct LoadICParameters { |
| 364 LoadICParameters(compiler::Node* context, compiler::Node* receiver, | 391 LoadICParameters(compiler::Node* context, compiler::Node* receiver, |
| 365 compiler::Node* name, compiler::Node* slot, | 392 compiler::Node* name, compiler::Node* slot, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 AllocationFlags flags, | 459 AllocationFlags flags, |
| 433 compiler::Node* top_adddress, | 460 compiler::Node* top_adddress, |
| 434 compiler::Node* limit_address); | 461 compiler::Node* limit_address); |
| 435 | 462 |
| 436 static const int kElementLoopUnrollThreshold = 8; | 463 static const int kElementLoopUnrollThreshold = 8; |
| 437 }; | 464 }; |
| 438 | 465 |
| 439 } // namespace internal | 466 } // namespace internal |
| 440 } // namespace v8 | 467 } // namespace v8 |
| 441 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 468 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |