| 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 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3383 } | 3383 } |
| 3384 | 3384 |
| 3385 | 3385 |
| 3386 LiteralsArray* LiteralsArray::cast(Object* object) { | 3386 LiteralsArray* LiteralsArray::cast(Object* object) { |
| 3387 SLOW_DCHECK(object->IsLiteralsArray()); | 3387 SLOW_DCHECK(object->IsLiteralsArray()); |
| 3388 return reinterpret_cast<LiteralsArray*>(object); | 3388 return reinterpret_cast<LiteralsArray*>(object); |
| 3389 } | 3389 } |
| 3390 | 3390 |
| 3391 | 3391 |
| 3392 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | 3392 TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
| 3393 if (length() == 0) { | |
| 3394 return TypeFeedbackVector::cast( | |
| 3395 const_cast<FixedArray*>(FixedArray::cast(this))); | |
| 3396 } | |
| 3397 return TypeFeedbackVector::cast(get(kVectorIndex)); | 3393 return TypeFeedbackVector::cast(get(kVectorIndex)); |
| 3398 } | 3394 } |
| 3399 | 3395 |
| 3400 | 3396 |
| 3401 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | 3397 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { |
| 3402 if (length() <= kVectorIndex) { | |
| 3403 DCHECK(vector->length() == 0); | |
| 3404 return; | |
| 3405 } | |
| 3406 set(kVectorIndex, vector); | 3398 set(kVectorIndex, vector); |
| 3407 } | 3399 } |
| 3408 | 3400 |
| 3409 | 3401 |
| 3410 Object* LiteralsArray::literal(int literal_index) const { | 3402 Object* LiteralsArray::literal(int literal_index) const { |
| 3411 return get(kFirstLiteralIndex + literal_index); | 3403 return get(kFirstLiteralIndex + literal_index); |
| 3412 } | 3404 } |
| 3413 | 3405 |
| 3414 | 3406 |
| 3415 void LiteralsArray::set_literal(int literal_index, Object* literal) { | 3407 void LiteralsArray::set_literal(int literal_index, Object* literal) { |
| 3416 set(kFirstLiteralIndex + literal_index, literal); | 3408 set(kFirstLiteralIndex + literal_index, literal); |
| 3417 } | 3409 } |
| 3418 | 3410 |
| 3419 void LiteralsArray::set_literal_undefined(int literal_index) { | |
| 3420 set_undefined(kFirstLiteralIndex + literal_index); | |
| 3421 } | |
| 3422 | 3411 |
| 3423 int LiteralsArray::literals_count() const { | 3412 int LiteralsArray::literals_count() const { |
| 3424 return length() - kFirstLiteralIndex; | 3413 return length() - kFirstLiteralIndex; |
| 3425 } | 3414 } |
| 3426 | 3415 |
| 3427 | 3416 |
| 3428 void HandlerTable::SetRangeStart(int index, int value) { | 3417 void HandlerTable::SetRangeStart(int index, int value) { |
| 3429 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 3418 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
| 3430 } | 3419 } |
| 3431 | 3420 |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5625 | 5614 |
| 5626 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) | 5615 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) |
| 5627 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) | 5616 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) |
| 5628 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) | 5617 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) |
| 5629 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5618 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
| 5630 | 5619 |
| 5631 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5620 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
| 5632 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, | 5621 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
| 5633 kOptimizedCodeMapOffset) | 5622 kOptimizedCodeMapOffset) |
| 5634 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 5623 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
| 5635 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata, | 5624 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, |
| 5636 kFeedbackMetadataOffset) | 5625 kFeedbackVectorOffset) |
| 5637 #if TRACE_MAPS | 5626 #if TRACE_MAPS |
| 5638 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) | 5627 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) |
| 5639 #endif | 5628 #endif |
| 5640 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 5629 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
| 5641 kInstanceClassNameOffset) | 5630 kInstanceClassNameOffset) |
| 5642 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 5631 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
| 5643 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 5632 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
| 5644 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 5633 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
| 5645 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 5634 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) |
| 5646 | 5635 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5808 } | 5797 } |
| 5809 | 5798 |
| 5810 | 5799 |
| 5811 void SharedFunctionInfo::set_kind(FunctionKind kind) { | 5800 void SharedFunctionInfo::set_kind(FunctionKind kind) { |
| 5812 DCHECK(IsValidFunctionKind(kind)); | 5801 DCHECK(IsValidFunctionKind(kind)); |
| 5813 int hints = compiler_hints(); | 5802 int hints = compiler_hints(); |
| 5814 hints = FunctionKindBits::update(hints, kind); | 5803 hints = FunctionKindBits::update(hints, kind); |
| 5815 set_compiler_hints(hints); | 5804 set_compiler_hints(hints); |
| 5816 } | 5805 } |
| 5817 | 5806 |
| 5818 // static | |
| 5819 int SharedFunctionInfo::OffsetToPreviousContext() { | |
| 5820 return FixedArray::kHeaderSize + | |
| 5821 kPointerSize * (kContextOffset - kEntryLength); | |
| 5822 } | |
| 5823 | |
| 5824 int SharedFunctionInfo::OffsetToPreviousCachedCode() { | |
| 5825 return FixedArray::kHeaderSize + | |
| 5826 kPointerSize * (kCachedCodeOffset - kEntryLength); | |
| 5827 } | |
| 5828 | |
| 5829 int SharedFunctionInfo::OffsetToPreviousLiterals() { | |
| 5830 return FixedArray::kHeaderSize + | |
| 5831 kPointerSize * (kLiteralsOffset - kEntryLength); | |
| 5832 } | |
| 5833 | |
| 5834 int SharedFunctionInfo::OffsetToPreviousOsrAstId() { | |
| 5835 return FixedArray::kHeaderSize + | |
| 5836 kPointerSize * (kOsrAstIdOffset - kEntryLength); | |
| 5837 } | |
| 5838 | 5807 |
| 5839 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, | 5808 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, |
| 5840 kNeedsHomeObject) | 5809 kNeedsHomeObject) |
| 5841 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 5810 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
| 5842 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) | 5811 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) |
| 5843 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5812 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 5844 name_should_print_as_anonymous, | 5813 name_should_print_as_anonymous, |
| 5845 kNameShouldPrintAsAnonymous) | 5814 kNameShouldPrintAsAnonymous) |
| 5846 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 5815 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
| 5847 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) | 5816 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6279 } | 6248 } |
| 6280 | 6249 |
| 6281 | 6250 |
| 6282 bool JSFunction::is_compiled() { | 6251 bool JSFunction::is_compiled() { |
| 6283 Builtins* builtins = GetIsolate()->builtins(); | 6252 Builtins* builtins = GetIsolate()->builtins(); |
| 6284 return code() != builtins->builtin(Builtins::kCompileLazy) && | 6253 return code() != builtins->builtin(Builtins::kCompileLazy) && |
| 6285 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6254 code() != builtins->builtin(Builtins::kCompileOptimized) && |
| 6286 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6255 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
| 6287 } | 6256 } |
| 6288 | 6257 |
| 6289 TypeFeedbackVector* JSFunction::feedback_vector() { | 6258 |
| 6290 LiteralsArray* array = literals(); | 6259 int JSFunction::NumberOfLiterals() { |
| 6291 return array->feedback_vector(); | 6260 return literals()->length(); |
| 6292 } | 6261 } |
| 6293 | 6262 |
| 6294 int JSFunction::NumberOfLiterals() { return literals()->literals_count(); } | |
| 6295 | 6263 |
| 6296 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) | 6264 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) |
| 6297 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 6265 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| 6298 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 6266 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
| 6299 | 6267 |
| 6300 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } | 6268 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } |
| 6301 | 6269 |
| 6302 ACCESSORS(JSCollection, table, Object, kTableOffset) | 6270 ACCESSORS(JSCollection, table, Object, kTableOffset) |
| 6303 | 6271 |
| 6304 | 6272 |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7850 #undef WRITE_INT64_FIELD | 7818 #undef WRITE_INT64_FIELD |
| 7851 #undef READ_BYTE_FIELD | 7819 #undef READ_BYTE_FIELD |
| 7852 #undef WRITE_BYTE_FIELD | 7820 #undef WRITE_BYTE_FIELD |
| 7853 #undef NOBARRIER_READ_BYTE_FIELD | 7821 #undef NOBARRIER_READ_BYTE_FIELD |
| 7854 #undef NOBARRIER_WRITE_BYTE_FIELD | 7822 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7855 | 7823 |
| 7856 } // namespace internal | 7824 } // namespace internal |
| 7857 } // namespace v8 | 7825 } // namespace v8 |
| 7858 | 7826 |
| 7859 #endif // V8_OBJECTS_INL_H_ | 7827 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |