| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4557 | 4557 |
| 4558 // Position of this function in the script source. | 4558 // Position of this function in the script source. |
| 4559 inline int start_position(); | 4559 inline int start_position(); |
| 4560 inline void set_start_position(int start_position); | 4560 inline void set_start_position(int start_position); |
| 4561 | 4561 |
| 4562 // End position of this function in the script source. | 4562 // End position of this function in the script source. |
| 4563 inline int end_position(); | 4563 inline int end_position(); |
| 4564 inline void set_end_position(int end_position); | 4564 inline void set_end_position(int end_position); |
| 4565 | 4565 |
| 4566 // Is this function a function expression in the source code. | 4566 // Is this function a function expression in the source code. |
| 4567 inline bool is_expression(); | 4567 DECL_BOOLEAN_ACCESSORS(is_expression) |
| 4568 inline void set_is_expression(bool value); | |
| 4569 | 4568 |
| 4570 // Is this function a top-level function (scripts, evals). | 4569 // Is this function a top-level function (scripts, evals). |
| 4571 inline bool is_toplevel(); | 4570 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
| 4572 inline void set_is_toplevel(bool value); | |
| 4573 | 4571 |
| 4574 // Bit field containing various information collected by the compiler to | 4572 // Bit field containing various information collected by the compiler to |
| 4575 // drive optimization. | 4573 // drive optimization. |
| 4576 inline int compiler_hints(); | 4574 inline int compiler_hints(); |
| 4577 inline void set_compiler_hints(int value); | 4575 inline void set_compiler_hints(int value); |
| 4578 | 4576 |
| 4579 // A counter used to determine when to stress the deoptimizer with a | 4577 // A counter used to determine when to stress the deoptimizer with a |
| 4580 // deopt. | 4578 // deopt. |
| 4581 inline Smi* deopt_counter(); | 4579 inline Smi* deopt_counter(); |
| 4582 inline void set_deopt_counter(Smi* counter); | 4580 inline void set_deopt_counter(Smi* counter); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4618 // False if the function definitely does not allocate an arguments object. | 4616 // False if the function definitely does not allocate an arguments object. |
| 4619 DECL_BOOLEAN_ACCESSORS(uses_arguments) | 4617 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 4620 | 4618 |
| 4621 // True if the function has any duplicated parameter names. | 4619 // True if the function has any duplicated parameter names. |
| 4622 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) | 4620 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
| 4623 | 4621 |
| 4624 // Indicates whether the function is a native function. | 4622 // Indicates whether the function is a native function. |
| 4625 // These needs special threatment in .call and .apply since | 4623 // These needs special threatment in .call and .apply since |
| 4626 // null passed as the receiver should not be translated to the | 4624 // null passed as the receiver should not be translated to the |
| 4627 // global object. | 4625 // global object. |
| 4628 inline bool native(); | 4626 DECL_BOOLEAN_ACCESSORS(native) |
| 4629 inline void set_native(bool value); | 4627 |
| 4628 // Indicates that the function was created by the Function function. |
| 4629 // Though it's anonymous, toString should treat it as if it had the name |
| 4630 // "anonymous". We don't set the name itself so that the system does not |
| 4631 // see a binding for it. |
| 4632 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |
| 4630 | 4633 |
| 4631 // Indicates whether the function is a bound function created using | 4634 // Indicates whether the function is a bound function created using |
| 4632 // the bind function. | 4635 // the bind function. |
| 4633 inline bool bound(); | 4636 DECL_BOOLEAN_ACCESSORS(bound) |
| 4634 inline void set_bound(bool value); | 4637 |
| 4638 // Indicates that the function is anonymous (the name field can be set |
| 4639 // through the API, which does not change this flag). |
| 4640 DECL_BOOLEAN_ACCESSORS(is_anonymous) |
| 4635 | 4641 |
| 4636 // Indicates whether or not the code in the shared function support | 4642 // Indicates whether or not the code in the shared function support |
| 4637 // deoptimization. | 4643 // deoptimization. |
| 4638 inline bool has_deoptimization_support(); | 4644 inline bool has_deoptimization_support(); |
| 4639 | 4645 |
| 4640 // Enable deoptimization support through recompiled code. | 4646 // Enable deoptimization support through recompiled code. |
| 4641 void EnableDeoptimizationSupport(Code* recompiled); | 4647 void EnableDeoptimizationSupport(Code* recompiled); |
| 4642 | 4648 |
| 4643 // Disable (further) attempted optimization of all functions sharing this | 4649 // Disable (further) attempted optimization of all functions sharing this |
| 4644 // shared function info. The function is the one we actually tried to | 4650 // shared function info. The function is the one we actually tried to |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4806 // The source code start position is in the 30 most significant bits of | 4812 // The source code start position is in the 30 most significant bits of |
| 4807 // the start_position_and_type field. | 4813 // the start_position_and_type field. |
| 4808 static const int kIsExpressionBit = 0; | 4814 static const int kIsExpressionBit = 0; |
| 4809 static const int kIsTopLevelBit = 1; | 4815 static const int kIsTopLevelBit = 1; |
| 4810 static const int kStartPositionShift = 2; | 4816 static const int kStartPositionShift = 2; |
| 4811 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 4817 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 4812 | 4818 |
| 4813 // Bit positions in compiler_hints. | 4819 // Bit positions in compiler_hints. |
| 4814 static const int kCodeAgeSize = 3; | 4820 static const int kCodeAgeSize = 3; |
| 4815 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; | 4821 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; |
| 4816 static const int kBoundFunction = 9; | |
| 4817 | 4822 |
| 4818 enum CompilerHints { | 4823 enum CompilerHints { |
| 4819 kHasOnlySimpleThisPropertyAssignments, | 4824 kHasOnlySimpleThisPropertyAssignments, |
| 4820 kAllowLazyCompilation, | 4825 kAllowLazyCompilation, |
| 4821 kLiveObjectsMayExist, | 4826 kLiveObjectsMayExist, |
| 4822 kCodeAgeShift, | 4827 kCodeAgeShift, |
| 4823 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, | 4828 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
| 4824 kStrictModeFunction, | 4829 kStrictModeFunction, |
| 4825 kUsesArguments, | 4830 kUsesArguments, |
| 4826 kHasDuplicateParameters, | 4831 kHasDuplicateParameters, |
| 4827 kNative | 4832 kNative, |
| 4833 kBoundFunction, |
| 4834 kIsAnonymous, |
| 4835 kNameShouldPrintAsAnonymous, |
| 4836 kCompilerHintsCount // Pseudo entry |
| 4828 }; | 4837 }; |
| 4829 | 4838 |
| 4830 private: | 4839 private: |
| 4831 #if V8_HOST_ARCH_32_BIT | 4840 #if V8_HOST_ARCH_32_BIT |
| 4832 // On 32 bit platforms, compiler hints is a smi. | 4841 // On 32 bit platforms, compiler hints is a smi. |
| 4833 static const int kCompilerHintsSmiTagSize = kSmiTagSize; | 4842 static const int kCompilerHintsSmiTagSize = kSmiTagSize; |
| 4834 static const int kCompilerHintsSize = kPointerSize; | 4843 static const int kCompilerHintsSize = kPointerSize; |
| 4835 #else | 4844 #else |
| 4836 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 4845 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
| 4837 static const int kCompilerHintsSmiTagSize = 0; | 4846 static const int kCompilerHintsSmiTagSize = 0; |
| 4838 static const int kCompilerHintsSize = kIntSize; | 4847 static const int kCompilerHintsSize = kIntSize; |
| 4839 #endif | 4848 #endif |
| 4840 | 4849 |
| 4850 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= |
| 4851 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
| 4852 |
| 4841 public: | 4853 public: |
| 4842 // Constants for optimizing codegen for strict mode function and | 4854 // Constants for optimizing codegen for strict mode function and |
| 4843 // native tests. | 4855 // native tests. |
| 4844 // Allows to use byte-widgh instructions. | 4856 // Allows to use byte-widgh instructions. |
| 4845 static const int kStrictModeBitWithinByte = | 4857 static const int kStrictModeBitWithinByte = |
| 4846 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 4858 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 4847 | 4859 |
| 4848 static const int kNativeBitWithinByte = | 4860 static const int kNativeBitWithinByte = |
| 4849 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; | 4861 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 4850 | 4862 |
| (...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7174 } else { | 7186 } else { |
| 7175 value &= ~(1 << bit_position); | 7187 value &= ~(1 << bit_position); |
| 7176 } | 7188 } |
| 7177 return value; | 7189 return value; |
| 7178 } | 7190 } |
| 7179 }; | 7191 }; |
| 7180 | 7192 |
| 7181 } } // namespace v8::internal | 7193 } } // namespace v8::internal |
| 7182 | 7194 |
| 7183 #endif // V8_OBJECTS_H_ | 7195 #endif // V8_OBJECTS_H_ |
| OLD | NEW |