| 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> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 Code::Flags flags, const char* name); | 39 Code::Flags flags, const char* name); |
| 40 | 40 |
| 41 enum AllocationFlag : uint8_t { | 41 enum AllocationFlag : uint8_t { |
| 42 kNone = 0, | 42 kNone = 0, |
| 43 kDoubleAlignment = 1, | 43 kDoubleAlignment = 1, |
| 44 kPretenured = 1 << 1 | 44 kPretenured = 1 << 1 |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 typedef base::Flags<AllocationFlag> AllocationFlags; | 47 typedef base::Flags<AllocationFlag> AllocationFlags; |
| 48 | 48 |
| 49 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; | 49 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS, INTPTR_PARAMETERS }; |
| 50 | 50 |
| 51 compiler::Node* BooleanMapConstant(); | 51 compiler::Node* BooleanMapConstant(); |
| 52 compiler::Node* EmptyStringConstant(); | 52 compiler::Node* EmptyStringConstant(); |
| 53 compiler::Node* HeapNumberMapConstant(); | 53 compiler::Node* HeapNumberMapConstant(); |
| 54 compiler::Node* NoContextConstant(); | 54 compiler::Node* NoContextConstant(); |
| 55 compiler::Node* NanConstant(); | 55 compiler::Node* NanConstant(); |
| 56 compiler::Node* NullConstant(); | 56 compiler::Node* NullConstant(); |
| 57 compiler::Node* MinusZeroConstant(); | 57 compiler::Node* MinusZeroConstant(); |
| 58 compiler::Node* UndefinedConstant(); | 58 compiler::Node* UndefinedConstant(); |
| 59 compiler::Node* TheHoleConstant(); | 59 compiler::Node* TheHoleConstant(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 static const int kInlinedDictionaryProbes = 4; | 392 static const int kInlinedDictionaryProbes = 4; |
| 393 template <typename Dictionary> | 393 template <typename Dictionary> |
| 394 void NameDictionaryLookup(compiler::Node* dictionary, | 394 void NameDictionaryLookup(compiler::Node* dictionary, |
| 395 compiler::Node* unique_name, Label* if_found, | 395 compiler::Node* unique_name, Label* if_found, |
| 396 Variable* var_name_index, Label* if_not_found, | 396 Variable* var_name_index, Label* if_not_found, |
| 397 int inlined_probes = kInlinedDictionaryProbes); | 397 int inlined_probes = kInlinedDictionaryProbes); |
| 398 | 398 |
| 399 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); | 399 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); |
| 400 | 400 |
| 401 template <typename Dictionary> | 401 template <typename Dictionary> |
| 402 void NumberDictionaryLookup(compiler::Node* dictionary, compiler::Node* key, | 402 void NumberDictionaryLookup(compiler::Node* dictionary, |
| 403 Label* if_found, Variable* var_entry, | 403 compiler::Node* intptr_index, Label* if_found, |
| 404 Label* if_not_found); | 404 Variable* var_entry, Label* if_not_found); |
| 405 | 405 |
| 406 // Tries to check if {object} has own {unique_name} property. | 406 // Tries to check if {object} has own {unique_name} property. |
| 407 void TryHasOwnProperty(compiler::Node* object, compiler::Node* map, | 407 void TryHasOwnProperty(compiler::Node* object, compiler::Node* map, |
| 408 compiler::Node* instance_type, | 408 compiler::Node* instance_type, |
| 409 compiler::Node* unique_name, Label* if_found, | 409 compiler::Node* unique_name, Label* if_found, |
| 410 Label* if_not_found, Label* if_bailout); | 410 Label* if_not_found, Label* if_bailout); |
| 411 | 411 |
| 412 // Tries to get {object}'s own {unique_name} property value. If the property | 412 // Tries to get {object}'s own {unique_name} property value. If the property |
| 413 // is an accessor then it also calls a getter. If the property is a double | 413 // is an accessor then it also calls a getter. If the property is a double |
| 414 // field it re-wraps value in an immutable heap number. | 414 // field it re-wraps value in an immutable heap number. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 // Note: this code does not check if the global dictionary points to deleted | 447 // Note: this code does not check if the global dictionary points to deleted |
| 448 // entry! This has to be done by the caller. | 448 // entry! This has to be done by the caller. |
| 449 void TryLookupProperty(compiler::Node* object, compiler::Node* map, | 449 void TryLookupProperty(compiler::Node* object, compiler::Node* map, |
| 450 compiler::Node* instance_type, | 450 compiler::Node* instance_type, |
| 451 compiler::Node* unique_name, Label* if_found_fast, | 451 compiler::Node* unique_name, Label* if_found_fast, |
| 452 Label* if_found_dict, Label* if_found_global, | 452 Label* if_found_dict, Label* if_found_global, |
| 453 Variable* var_meta_storage, Variable* var_name_index, | 453 Variable* var_meta_storage, Variable* var_name_index, |
| 454 Label* if_not_found, Label* if_bailout); | 454 Label* if_not_found, Label* if_bailout); |
| 455 | 455 |
| 456 void TryLookupElement(compiler::Node* object, compiler::Node* map, | 456 void TryLookupElement(compiler::Node* object, compiler::Node* map, |
| 457 compiler::Node* instance_type, compiler::Node* index, | 457 compiler::Node* instance_type, |
| 458 Label* if_found, Label* if_not_found, | 458 compiler::Node* intptr_index, Label* if_found, |
| 459 Label* if_bailout); | 459 Label* if_not_found, Label* if_bailout); |
| 460 | 460 |
| 461 // This is a type of a lookup in holder generator function. In case of a | 461 // This is a type of a lookup in holder generator function. In case of a |
| 462 // property lookup the {key} is guaranteed to be a unique name and in case of | 462 // property lookup the {key} is guaranteed to be a unique name and in case of |
| 463 // element lookup the key is an Int32 index. | 463 // element lookup the key is an Int32 index. |
| 464 typedef std::function<void(compiler::Node* receiver, compiler::Node* holder, | 464 typedef std::function<void(compiler::Node* receiver, compiler::Node* holder, |
| 465 compiler::Node* map, compiler::Node* instance_type, | 465 compiler::Node* map, compiler::Node* instance_type, |
| 466 compiler::Node* key, Label* next_holder, | 466 compiler::Node* key, Label* next_holder, |
| 467 Label* if_bailout)> | 467 Label* if_bailout)> |
| 468 LookupInHolder; | 468 LookupInHolder; |
| 469 | 469 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 572 |
| 573 private: | 573 private: |
| 574 enum ElementSupport { kOnlyProperties, kSupportElements }; | 574 enum ElementSupport { kOnlyProperties, kSupportElements }; |
| 575 | 575 |
| 576 void HandleLoadICHandlerCase( | 576 void HandleLoadICHandlerCase( |
| 577 const LoadICParameters* p, compiler::Node* handler, Label* miss, | 577 const LoadICParameters* p, compiler::Node* handler, Label* miss, |
| 578 ElementSupport support_elements = kOnlyProperties); | 578 ElementSupport support_elements = kOnlyProperties); |
| 579 compiler::Node* TryToIntptr(compiler::Node* key, Label* miss); | 579 compiler::Node* TryToIntptr(compiler::Node* key, Label* miss); |
| 580 void EmitFastElementsBoundsCheck(compiler::Node* object, | 580 void EmitFastElementsBoundsCheck(compiler::Node* object, |
| 581 compiler::Node* elements, | 581 compiler::Node* elements, |
| 582 compiler::Node* intptr_key, | 582 compiler::Node* intptr_index, |
| 583 compiler::Node* is_jsarray_condition, | 583 compiler::Node* is_jsarray_condition, |
| 584 Label* miss); | 584 Label* miss); |
| 585 void EmitElementLoad(compiler::Node* object, compiler::Node* elements, | 585 void EmitElementLoad(compiler::Node* object, compiler::Node* elements, |
| 586 compiler::Node* elements_kind, compiler::Node* key, | 586 compiler::Node* elements_kind, compiler::Node* key, |
| 587 compiler::Node* is_jsarray_condition, Label* if_hole, | 587 compiler::Node* is_jsarray_condition, Label* if_hole, |
| 588 Label* rebox_double, Variable* var_double_value, | 588 Label* rebox_double, Variable* var_double_value, |
| 589 Label* unimplemented_elements_kind, Label* out_of_bounds, | 589 Label* unimplemented_elements_kind, Label* out_of_bounds, |
| 590 Label* miss); | 590 Label* miss); |
| 591 void BranchIfPrototypesHaveNoElements(compiler::Node* receiver_map, | 591 void BranchIfPrototypesHaveNoElements(compiler::Node* receiver_map, |
| 592 Label* definitely_no_elements, | 592 Label* definitely_no_elements, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 608 compiler::Node* SmiShiftBitsConstant(); | 608 compiler::Node* SmiShiftBitsConstant(); |
| 609 | 609 |
| 610 static const int kElementLoopUnrollThreshold = 8; | 610 static const int kElementLoopUnrollThreshold = 8; |
| 611 }; | 611 }; |
| 612 | 612 |
| 613 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 613 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 614 | 614 |
| 615 } // namespace internal | 615 } // namespace internal |
| 616 } // namespace v8 | 616 } // namespace v8 |
| 617 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 617 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |