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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5711 BOOL_ACCESSORS(SharedFunctionInfo, | 5711 BOOL_ACCESSORS(SharedFunctionInfo, |
5712 compiler_hints, | 5712 compiler_hints, |
5713 has_duplicate_parameters, | 5713 has_duplicate_parameters, |
5714 kHasDuplicateParameters) | 5714 kHasDuplicateParameters) |
5715 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction) | 5715 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction) |
5716 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, deserialized, kDeserialized) | 5716 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, deserialized, kDeserialized) |
5717 | 5717 |
5718 | 5718 |
5719 #if V8_HOST_ARCH_32_BIT | 5719 #if V8_HOST_ARCH_32_BIT |
5720 SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset) | 5720 SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset) |
5721 SMI_ACCESSORS(SharedFunctionInfo, formal_parameter_count, | 5721 SMI_ACCESSORS(SharedFunctionInfo, internal_formal_parameter_count, |
5722 kFormalParameterCountOffset) | 5722 kFormalParameterCountOffset) |
5723 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, | 5723 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, |
5724 kExpectedNofPropertiesOffset) | 5724 kExpectedNofPropertiesOffset) |
5725 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) | 5725 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) |
5726 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, | 5726 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, |
5727 kStartPositionAndTypeOffset) | 5727 kStartPositionAndTypeOffset) |
5728 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) | 5728 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) |
5729 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, | 5729 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, |
5730 kFunctionTokenPositionOffset) | 5730 kFunctionTokenPositionOffset) |
5731 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5731 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, |
(...skipping 27 matching lines...) Expand all Loading... |
5759 DCHECK((value & 0xC0000000) == 0xC0000000 || (value & 0xC0000000) == 0x0); \ | 5759 DCHECK((value & 0xC0000000) == 0xC0000000 || (value & 0xC0000000) == 0x0); \ |
5760 WRITE_INT_FIELD(this, offset, (value << 1) & ~kHeapObjectTag); \ | 5760 WRITE_INT_FIELD(this, offset, (value << 1) & ~kHeapObjectTag); \ |
5761 } | 5761 } |
5762 | 5762 |
5763 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ | 5763 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ |
5764 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_HI_ALIGN); \ | 5764 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_HI_ALIGN); \ |
5765 INT_ACCESSORS(holder, name, offset) | 5765 INT_ACCESSORS(holder, name, offset) |
5766 | 5766 |
5767 | 5767 |
5768 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) | 5768 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) |
5769 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5769 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, internal_formal_parameter_count, |
5770 formal_parameter_count, | |
5771 kFormalParameterCountOffset) | 5770 kFormalParameterCountOffset) |
5772 | 5771 |
5773 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 5772 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
5774 expected_nof_properties, | 5773 expected_nof_properties, |
5775 kExpectedNofPropertiesOffset) | 5774 kExpectedNofPropertiesOffset) |
5776 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, num_literals, kNumLiteralsOffset) | 5775 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, num_literals, kNumLiteralsOffset) |
5777 | 5776 |
5778 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, end_position, kEndPositionOffset) | 5777 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, end_position, kEndPositionOffset) |
5779 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5778 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
5780 start_position_and_type, | 5779 start_position_and_type, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5892 return ExternalOneByteString::cast(src)->resource() != NULL; | 5891 return ExternalOneByteString::cast(src)->resource() != NULL; |
5893 } else if (src_str->IsTwoByteRepresentation()) { | 5892 } else if (src_str->IsTwoByteRepresentation()) { |
5894 return ExternalTwoByteString::cast(src)->resource() != NULL; | 5893 return ExternalTwoByteString::cast(src)->resource() != NULL; |
5895 } | 5894 } |
5896 return true; | 5895 return true; |
5897 } | 5896 } |
5898 | 5897 |
5899 | 5898 |
5900 void SharedFunctionInfo::DontAdaptArguments() { | 5899 void SharedFunctionInfo::DontAdaptArguments() { |
5901 DCHECK(code()->kind() == Code::BUILTIN); | 5900 DCHECK(code()->kind() == Code::BUILTIN); |
5902 set_formal_parameter_count(kDontAdaptArgumentsSentinel); | 5901 set_internal_formal_parameter_count(kDontAdaptArgumentsSentinel); |
5903 } | 5902 } |
5904 | 5903 |
5905 | 5904 |
5906 int SharedFunctionInfo::start_position() const { | 5905 int SharedFunctionInfo::start_position() const { |
5907 return start_position_and_type() >> kStartPositionShift; | 5906 return start_position_and_type() >> kStartPositionShift; |
5908 } | 5907 } |
5909 | 5908 |
5910 | 5909 |
5911 void SharedFunctionInfo::set_start_position(int start_position) { | 5910 void SharedFunctionInfo::set_start_position(int start_position) { |
5912 set_start_position_and_type((start_position << kStartPositionShift) | 5911 set_start_position_and_type((start_position << kStartPositionShift) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6073 | 6072 |
6074 | 6073 |
6075 bool JSFunction::IsFromExtensionScript() { | 6074 bool JSFunction::IsFromExtensionScript() { |
6076 Object* script = shared()->script(); | 6075 Object* script = shared()->script(); |
6077 return script->IsScript() && | 6076 return script->IsScript() && |
6078 Script::cast(script)->type()->value() == Script::TYPE_EXTENSION; | 6077 Script::cast(script)->type()->value() == Script::TYPE_EXTENSION; |
6079 } | 6078 } |
6080 | 6079 |
6081 | 6080 |
6082 bool JSFunction::NeedsArgumentsAdaption() { | 6081 bool JSFunction::NeedsArgumentsAdaption() { |
6083 return shared()->formal_parameter_count() != | 6082 return shared()->internal_formal_parameter_count() != |
6084 SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 6083 SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
6085 } | 6084 } |
6086 | 6085 |
6087 | 6086 |
6088 bool JSFunction::IsOptimized() { | 6087 bool JSFunction::IsOptimized() { |
6089 return code()->kind() == Code::OPTIMIZED_FUNCTION; | 6088 return code()->kind() == Code::OPTIMIZED_FUNCTION; |
6090 } | 6089 } |
6091 | 6090 |
6092 | 6091 |
6093 bool JSFunction::IsOptimizable() { | 6092 bool JSFunction::IsOptimizable() { |
6094 return code()->kind() == Code::FUNCTION && code()->optimizable(); | 6093 return code()->kind() == Code::FUNCTION && code()->optimizable(); |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7623 #undef READ_SHORT_FIELD | 7622 #undef READ_SHORT_FIELD |
7624 #undef WRITE_SHORT_FIELD | 7623 #undef WRITE_SHORT_FIELD |
7625 #undef READ_BYTE_FIELD | 7624 #undef READ_BYTE_FIELD |
7626 #undef WRITE_BYTE_FIELD | 7625 #undef WRITE_BYTE_FIELD |
7627 #undef NOBARRIER_READ_BYTE_FIELD | 7626 #undef NOBARRIER_READ_BYTE_FIELD |
7628 #undef NOBARRIER_WRITE_BYTE_FIELD | 7627 #undef NOBARRIER_WRITE_BYTE_FIELD |
7629 | 7628 |
7630 } } // namespace v8::internal | 7629 } } // namespace v8::internal |
7631 | 7630 |
7632 #endif // V8_OBJECTS_INL_H_ | 7631 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |