| 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 4769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4780 } | 4780 } |
| 4781 | 4781 |
| 4782 | 4782 |
| 4783 bool Code::IsCodeStubOrIC() { | 4783 bool Code::IsCodeStubOrIC() { |
| 4784 return kind() == STUB || kind() == HANDLER || kind() == LOAD_IC || | 4784 return kind() == STUB || kind() == HANDLER || kind() == LOAD_IC || |
| 4785 kind() == KEYED_LOAD_IC || kind() == CALL_IC || kind() == STORE_IC || | 4785 kind() == KEYED_LOAD_IC || kind() == CALL_IC || kind() == STORE_IC || |
| 4786 kind() == KEYED_STORE_IC || kind() == BINARY_OP_IC || | 4786 kind() == KEYED_STORE_IC || kind() == BINARY_OP_IC || |
| 4787 kind() == COMPARE_IC || kind() == TO_BOOLEAN_IC; | 4787 kind() == COMPARE_IC || kind() == TO_BOOLEAN_IC; |
| 4788 } | 4788 } |
| 4789 | 4789 |
| 4790 | |
| 4791 bool Code::IsJavaScriptCode() { | |
| 4792 return kind() == FUNCTION || kind() == OPTIMIZED_FUNCTION || | |
| 4793 is_interpreter_entry_trampoline(); | |
| 4794 } | |
| 4795 | |
| 4796 | |
| 4797 InlineCacheState Code::ic_state() { | 4790 InlineCacheState Code::ic_state() { |
| 4798 InlineCacheState result = ExtractICStateFromFlags(flags()); | 4791 InlineCacheState result = ExtractICStateFromFlags(flags()); |
| 4799 // Only allow uninitialized or debugger states for non-IC code | 4792 // Only allow uninitialized or debugger states for non-IC code |
| 4800 // objects. This is used in the debugger to determine whether or not | 4793 // objects. This is used in the debugger to determine whether or not |
| 4801 // a call to code object has been replaced with a debug break call. | 4794 // a call to code object has been replaced with a debug break call. |
| 4802 DCHECK(is_inline_cache_stub() || | 4795 DCHECK(is_inline_cache_stub() || |
| 4803 result == UNINITIALIZED || | 4796 result == UNINITIALIZED || |
| 4804 result == DEBUG_STUB); | 4797 result == DEBUG_STUB); |
| 4805 return result; | 4798 return result; |
| 4806 } | 4799 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4826 inline bool Code::is_crankshafted() { | 4819 inline bool Code::is_crankshafted() { |
| 4827 return IsCrankshaftedField::decode( | 4820 return IsCrankshaftedField::decode( |
| 4828 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4821 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
| 4829 } | 4822 } |
| 4830 | 4823 |
| 4831 | 4824 |
| 4832 inline bool Code::is_hydrogen_stub() { | 4825 inline bool Code::is_hydrogen_stub() { |
| 4833 return is_crankshafted() && kind() != OPTIMIZED_FUNCTION; | 4826 return is_crankshafted() && kind() != OPTIMIZED_FUNCTION; |
| 4834 } | 4827 } |
| 4835 | 4828 |
| 4836 | 4829 inline bool Code::is_interpreter_trampoline_builtin() { |
| 4837 inline bool Code::is_interpreter_entry_trampoline() { | 4830 Builtins* builtins = GetIsolate()->builtins(); |
| 4838 Handle<Code> interpreter_entry = | 4831 return this == *builtins->InterpreterEntryTrampoline() || |
| 4839 GetIsolate()->builtins()->InterpreterEntryTrampoline(); | 4832 this == *builtins->InterpreterEnterBytecodeDispatch() || |
| 4840 return interpreter_entry.location() != nullptr && *interpreter_entry == this; | 4833 this == *builtins->InterpreterMarkBaselineOnReturn(); |
| 4841 } | |
| 4842 | |
| 4843 inline bool Code::is_interpreter_enter_bytecode_dispatch() { | |
| 4844 Handle<Code> interpreter_handler = | |
| 4845 GetIsolate()->builtins()->InterpreterEnterBytecodeDispatch(); | |
| 4846 return interpreter_handler.location() != nullptr && | |
| 4847 *interpreter_handler == this; | |
| 4848 } | 4834 } |
| 4849 | 4835 |
| 4850 inline void Code::set_is_crankshafted(bool value) { | 4836 inline void Code::set_is_crankshafted(bool value) { |
| 4851 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4837 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 4852 int updated = IsCrankshaftedField::update(previous, value); | 4838 int updated = IsCrankshaftedField::update(previous, value); |
| 4853 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4839 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
| 4854 } | 4840 } |
| 4855 | 4841 |
| 4856 | 4842 |
| 4857 inline bool Code::is_turbofanned() { | 4843 inline bool Code::is_turbofanned() { |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6116 if (!IsInobjectSlackTrackingInProgress()) return; | 6102 if (!IsInobjectSlackTrackingInProgress()) return; |
| 6117 int counter = construction_counter(); | 6103 int counter = construction_counter(); |
| 6118 set_construction_counter(counter - 1); | 6104 set_construction_counter(counter - 1); |
| 6119 if (counter == kSlackTrackingCounterEnd) { | 6105 if (counter == kSlackTrackingCounterEnd) { |
| 6120 CompleteInobjectSlackTracking(); | 6106 CompleteInobjectSlackTracking(); |
| 6121 } | 6107 } |
| 6122 } | 6108 } |
| 6123 | 6109 |
| 6124 AbstractCode* JSFunction::abstract_code() { | 6110 AbstractCode* JSFunction::abstract_code() { |
| 6125 Code* code = this->code(); | 6111 Code* code = this->code(); |
| 6126 if (code->is_interpreter_entry_trampoline()) { | 6112 if (code->is_interpreter_trampoline_builtin()) { |
| 6127 return AbstractCode::cast(shared()->bytecode_array()); | 6113 return AbstractCode::cast(shared()->bytecode_array()); |
| 6128 } else { | 6114 } else { |
| 6129 return AbstractCode::cast(code); | 6115 return AbstractCode::cast(code); |
| 6130 } | 6116 } |
| 6131 } | 6117 } |
| 6132 | 6118 |
| 6133 Code* JSFunction::code() { | 6119 Code* JSFunction::code() { |
| 6134 return Code::cast( | 6120 return Code::cast( |
| 6135 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 6121 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); |
| 6136 } | 6122 } |
| (...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7856 #undef WRITE_INT64_FIELD | 7842 #undef WRITE_INT64_FIELD |
| 7857 #undef READ_BYTE_FIELD | 7843 #undef READ_BYTE_FIELD |
| 7858 #undef WRITE_BYTE_FIELD | 7844 #undef WRITE_BYTE_FIELD |
| 7859 #undef NOBARRIER_READ_BYTE_FIELD | 7845 #undef NOBARRIER_READ_BYTE_FIELD |
| 7860 #undef NOBARRIER_WRITE_BYTE_FIELD | 7846 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7861 | 7847 |
| 7862 } // namespace internal | 7848 } // namespace internal |
| 7863 } // namespace v8 | 7849 } // namespace v8 |
| 7864 | 7850 |
| 7865 #endif // V8_OBJECTS_INL_H_ | 7851 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |