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 4770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 4790 |
4791 bool Code::IsJavaScriptCode() { | 4791 bool Code::IsJavaScriptCode() { |
Michael Starzinger
2016/05/11 13:04:27
This predicate is no longer used in the codebase.
rmcilroy
2016/05/12 13:11:47
Done.
| |
4792 return kind() == FUNCTION || kind() == OPTIMIZED_FUNCTION || | 4792 return kind() == FUNCTION || kind() == OPTIMIZED_FUNCTION || |
4793 is_interpreter_entry_trampoline(); | 4793 is_interpreter_trampoline_builtin(); |
4794 } | 4794 } |
4795 | 4795 |
4796 | 4796 |
4797 InlineCacheState Code::ic_state() { | 4797 InlineCacheState Code::ic_state() { |
4798 InlineCacheState result = ExtractICStateFromFlags(flags()); | 4798 InlineCacheState result = ExtractICStateFromFlags(flags()); |
4799 // Only allow uninitialized or debugger states for non-IC code | 4799 // Only allow uninitialized or debugger states for non-IC code |
4800 // objects. This is used in the debugger to determine whether or not | 4800 // 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. | 4801 // a call to code object has been replaced with a debug break call. |
4802 DCHECK(is_inline_cache_stub() || | 4802 DCHECK(is_inline_cache_stub() || |
4803 result == UNINITIALIZED || | 4803 result == UNINITIALIZED || |
(...skipping 22 matching lines...) Expand all Loading... | |
4826 inline bool Code::is_crankshafted() { | 4826 inline bool Code::is_crankshafted() { |
4827 return IsCrankshaftedField::decode( | 4827 return IsCrankshaftedField::decode( |
4828 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4828 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
4829 } | 4829 } |
4830 | 4830 |
4831 | 4831 |
4832 inline bool Code::is_hydrogen_stub() { | 4832 inline bool Code::is_hydrogen_stub() { |
4833 return is_crankshafted() && kind() != OPTIMIZED_FUNCTION; | 4833 return is_crankshafted() && kind() != OPTIMIZED_FUNCTION; |
4834 } | 4834 } |
4835 | 4835 |
4836 | 4836 inline bool Code::is_interpreter_trampoline_builtin() { |
4837 inline bool Code::is_interpreter_entry_trampoline() { | 4837 Builtins* builtins = GetIsolate()->builtins(); |
4838 Handle<Code> interpreter_entry = | 4838 return this == *builtins->InterpreterEntryTrampoline() || |
4839 GetIsolate()->builtins()->InterpreterEntryTrampoline(); | 4839 this == *builtins->InterpreterEnterBytecodeDispatch() || |
4840 return interpreter_entry.location() != nullptr && *interpreter_entry == this; | 4840 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 } | 4841 } |
4849 | 4842 |
4850 inline void Code::set_is_crankshafted(bool value) { | 4843 inline void Code::set_is_crankshafted(bool value) { |
4851 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4844 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
4852 int updated = IsCrankshaftedField::update(previous, value); | 4845 int updated = IsCrankshaftedField::update(previous, value); |
4853 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4846 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
4854 } | 4847 } |
4855 | 4848 |
4856 | 4849 |
4857 inline bool Code::is_turbofanned() { | 4850 inline bool Code::is_turbofanned() { |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6111 if (!IsInobjectSlackTrackingInProgress()) return; | 6104 if (!IsInobjectSlackTrackingInProgress()) return; |
6112 int counter = construction_counter(); | 6105 int counter = construction_counter(); |
6113 set_construction_counter(counter - 1); | 6106 set_construction_counter(counter - 1); |
6114 if (counter == kSlackTrackingCounterEnd) { | 6107 if (counter == kSlackTrackingCounterEnd) { |
6115 CompleteInobjectSlackTracking(); | 6108 CompleteInobjectSlackTracking(); |
6116 } | 6109 } |
6117 } | 6110 } |
6118 | 6111 |
6119 AbstractCode* JSFunction::abstract_code() { | 6112 AbstractCode* JSFunction::abstract_code() { |
6120 Code* code = this->code(); | 6113 Code* code = this->code(); |
6121 if (code->is_interpreter_entry_trampoline()) { | 6114 if (code->is_interpreter_trampoline_builtin()) { |
6122 return AbstractCode::cast(shared()->bytecode_array()); | 6115 return AbstractCode::cast(shared()->bytecode_array()); |
6123 } else { | 6116 } else { |
6124 return AbstractCode::cast(code); | 6117 return AbstractCode::cast(code); |
6125 } | 6118 } |
6126 } | 6119 } |
6127 | 6120 |
6128 Code* JSFunction::code() { | 6121 Code* JSFunction::code() { |
6129 return Code::cast( | 6122 return Code::cast( |
6130 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); | 6123 Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset))); |
6131 } | 6124 } |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7851 #undef WRITE_INT64_FIELD | 7844 #undef WRITE_INT64_FIELD |
7852 #undef READ_BYTE_FIELD | 7845 #undef READ_BYTE_FIELD |
7853 #undef WRITE_BYTE_FIELD | 7846 #undef WRITE_BYTE_FIELD |
7854 #undef NOBARRIER_READ_BYTE_FIELD | 7847 #undef NOBARRIER_READ_BYTE_FIELD |
7855 #undef NOBARRIER_WRITE_BYTE_FIELD | 7848 #undef NOBARRIER_WRITE_BYTE_FIELD |
7856 | 7849 |
7857 } // namespace internal | 7850 } // namespace internal |
7858 } // namespace v8 | 7851 } // namespace v8 |
7859 | 7852 |
7860 #endif // V8_OBJECTS_INL_H_ | 7853 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |