| 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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6111 if (!IsInobjectSlackTrackingInProgress()) return; | 6097 if (!IsInobjectSlackTrackingInProgress()) return; |
| 6112 int counter = construction_counter(); | 6098 int counter = construction_counter(); |
| 6113 set_construction_counter(counter - 1); | 6099 set_construction_counter(counter - 1); |
| 6114 if (counter == kSlackTrackingCounterEnd) { | 6100 if (counter == kSlackTrackingCounterEnd) { |
| 6115 CompleteInobjectSlackTracking(); | 6101 CompleteInobjectSlackTracking(); |
| 6116 } | 6102 } |
| 6117 } | 6103 } |
| 6118 | 6104 |
| 6119 AbstractCode* JSFunction::abstract_code() { | 6105 AbstractCode* JSFunction::abstract_code() { |
| 6120 Code* code = this->code(); | 6106 Code* code = this->code(); |
| 6121 if (code->is_interpreter_entry_trampoline()) { | 6107 if (code->is_interpreter_trampoline_builtin()) { |
| 6122 return AbstractCode::cast(shared()->bytecode_array()); | 6108 return AbstractCode::cast(shared()->bytecode_array()); |
| 6123 } else { | 6109 } else { |
| 6124 return AbstractCode::cast(code); | 6110 return AbstractCode::cast(code); |
| 6125 } | 6111 } |
| 6126 } | 6112 } |
| 6127 | 6113 |
| 6128 Code* JSFunction::code() { | 6114 Code* JSFunction::code() { |
| 6129 return Code::cast( | 6115 return Code::cast( |
| 6130 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 6116 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); |
| 6131 } | 6117 } |
| (...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7851 #undef WRITE_INT64_FIELD | 7837 #undef WRITE_INT64_FIELD |
| 7852 #undef READ_BYTE_FIELD | 7838 #undef READ_BYTE_FIELD |
| 7853 #undef WRITE_BYTE_FIELD | 7839 #undef WRITE_BYTE_FIELD |
| 7854 #undef NOBARRIER_READ_BYTE_FIELD | 7840 #undef NOBARRIER_READ_BYTE_FIELD |
| 7855 #undef NOBARRIER_WRITE_BYTE_FIELD | 7841 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7856 | 7842 |
| 7857 } // namespace internal | 7843 } // namespace internal |
| 7858 } // namespace v8 | 7844 } // namespace v8 |
| 7859 | 7845 |
| 7860 #endif // V8_OBJECTS_INL_H_ | 7846 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |