| 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 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3372 } | 3372 } |
| 3373 | 3373 |
| 3374 | 3374 |
| 3375 LiteralsArray* LiteralsArray::cast(Object* object) { | 3375 LiteralsArray* LiteralsArray::cast(Object* object) { |
| 3376 SLOW_DCHECK(object->IsLiteralsArray()); | 3376 SLOW_DCHECK(object->IsLiteralsArray()); |
| 3377 return reinterpret_cast<LiteralsArray*>(object); | 3377 return reinterpret_cast<LiteralsArray*>(object); |
| 3378 } | 3378 } |
| 3379 | 3379 |
| 3380 | 3380 |
| 3381 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | 3381 TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
| 3382 if (length() == 0) { | |
| 3383 return TypeFeedbackVector::cast( | |
| 3384 const_cast<FixedArray*>(FixedArray::cast(this))); | |
| 3385 } | |
| 3386 return TypeFeedbackVector::cast(get(kVectorIndex)); | 3382 return TypeFeedbackVector::cast(get(kVectorIndex)); |
| 3387 } | 3383 } |
| 3388 | 3384 |
| 3389 | 3385 |
| 3390 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | 3386 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { |
| 3391 if (length() <= kVectorIndex) { | |
| 3392 DCHECK(vector->length() == 0); | |
| 3393 return; | |
| 3394 } | |
| 3395 set(kVectorIndex, vector); | 3387 set(kVectorIndex, vector); |
| 3396 } | 3388 } |
| 3397 | 3389 |
| 3398 | 3390 |
| 3399 Object* LiteralsArray::literal(int literal_index) const { | 3391 Object* LiteralsArray::literal(int literal_index) const { |
| 3400 return get(kFirstLiteralIndex + literal_index); | 3392 return get(kFirstLiteralIndex + literal_index); |
| 3401 } | 3393 } |
| 3402 | 3394 |
| 3403 | 3395 |
| 3404 void LiteralsArray::set_literal(int literal_index, Object* literal) { | 3396 void LiteralsArray::set_literal(int literal_index, Object* literal) { |
| 3405 set(kFirstLiteralIndex + literal_index, literal); | 3397 set(kFirstLiteralIndex + literal_index, literal); |
| 3406 } | 3398 } |
| 3407 | 3399 |
| 3408 void LiteralsArray::set_literal_undefined(int literal_index) { | |
| 3409 set_undefined(kFirstLiteralIndex + literal_index); | |
| 3410 } | |
| 3411 | 3400 |
| 3412 int LiteralsArray::literals_count() const { | 3401 int LiteralsArray::literals_count() const { |
| 3413 return length() - kFirstLiteralIndex; | 3402 return length() - kFirstLiteralIndex; |
| 3414 } | 3403 } |
| 3415 | 3404 |
| 3416 int HandlerTable::GetRangeStart(int index) const { | 3405 int HandlerTable::GetRangeStart(int index) const { |
| 3417 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); | 3406 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); |
| 3418 } | 3407 } |
| 3419 | 3408 |
| 3420 int HandlerTable::GetRangeEnd(int index) const { | 3409 int HandlerTable::GetRangeEnd(int index) const { |
| (...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5639 | 5628 |
| 5640 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) | 5629 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) |
| 5641 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) | 5630 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) |
| 5642 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) | 5631 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) |
| 5643 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5632 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
| 5644 | 5633 |
| 5645 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5634 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
| 5646 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, | 5635 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
| 5647 kOptimizedCodeMapOffset) | 5636 kOptimizedCodeMapOffset) |
| 5648 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 5637 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
| 5649 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata, | 5638 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, |
| 5650 kFeedbackMetadataOffset) | 5639 kFeedbackVectorOffset) |
| 5651 #if TRACE_MAPS | 5640 #if TRACE_MAPS |
| 5652 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) | 5641 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) |
| 5653 #endif | 5642 #endif |
| 5654 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 5643 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
| 5655 kInstanceClassNameOffset) | 5644 kInstanceClassNameOffset) |
| 5656 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 5645 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
| 5657 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 5646 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
| 5658 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 5647 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
| 5659 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 5648 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) |
| 5660 | 5649 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5822 } | 5811 } |
| 5823 | 5812 |
| 5824 | 5813 |
| 5825 void SharedFunctionInfo::set_kind(FunctionKind kind) { | 5814 void SharedFunctionInfo::set_kind(FunctionKind kind) { |
| 5826 DCHECK(IsValidFunctionKind(kind)); | 5815 DCHECK(IsValidFunctionKind(kind)); |
| 5827 int hints = compiler_hints(); | 5816 int hints = compiler_hints(); |
| 5828 hints = FunctionKindBits::update(hints, kind); | 5817 hints = FunctionKindBits::update(hints, kind); |
| 5829 set_compiler_hints(hints); | 5818 set_compiler_hints(hints); |
| 5830 } | 5819 } |
| 5831 | 5820 |
| 5832 // static | |
| 5833 int SharedFunctionInfo::OffsetToPreviousContext() { | |
| 5834 return FixedArray::kHeaderSize + | |
| 5835 kPointerSize * (kContextOffset - kEntryLength); | |
| 5836 } | |
| 5837 | |
| 5838 int SharedFunctionInfo::OffsetToPreviousCachedCode() { | |
| 5839 return FixedArray::kHeaderSize + | |
| 5840 kPointerSize * (kCachedCodeOffset - kEntryLength); | |
| 5841 } | |
| 5842 | |
| 5843 int SharedFunctionInfo::OffsetToPreviousLiterals() { | |
| 5844 return FixedArray::kHeaderSize + | |
| 5845 kPointerSize * (kLiteralsOffset - kEntryLength); | |
| 5846 } | |
| 5847 | |
| 5848 int SharedFunctionInfo::OffsetToPreviousOsrAstId() { | |
| 5849 return FixedArray::kHeaderSize + | |
| 5850 kPointerSize * (kOsrAstIdOffset - kEntryLength); | |
| 5851 } | |
| 5852 | 5821 |
| 5853 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, | 5822 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, |
| 5854 kNeedsHomeObject) | 5823 kNeedsHomeObject) |
| 5855 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 5824 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
| 5856 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) | 5825 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) |
| 5857 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5826 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 5858 name_should_print_as_anonymous, | 5827 name_should_print_as_anonymous, |
| 5859 kNameShouldPrintAsAnonymous) | 5828 kNameShouldPrintAsAnonymous) |
| 5860 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 5829 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
| 5861 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) | 5830 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6293 } | 6262 } |
| 6294 | 6263 |
| 6295 | 6264 |
| 6296 bool JSFunction::is_compiled() { | 6265 bool JSFunction::is_compiled() { |
| 6297 Builtins* builtins = GetIsolate()->builtins(); | 6266 Builtins* builtins = GetIsolate()->builtins(); |
| 6298 return code() != builtins->builtin(Builtins::kCompileLazy) && | 6267 return code() != builtins->builtin(Builtins::kCompileLazy) && |
| 6299 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6268 code() != builtins->builtin(Builtins::kCompileOptimized) && |
| 6300 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6269 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
| 6301 } | 6270 } |
| 6302 | 6271 |
| 6303 TypeFeedbackVector* JSFunction::feedback_vector() { | 6272 |
| 6304 LiteralsArray* array = literals(); | 6273 int JSFunction::NumberOfLiterals() { |
| 6305 return array->feedback_vector(); | 6274 return literals()->length(); |
| 6306 } | 6275 } |
| 6307 | 6276 |
| 6308 int JSFunction::NumberOfLiterals() { return literals()->literals_count(); } | |
| 6309 | 6277 |
| 6310 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) | 6278 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) |
| 6311 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 6279 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| 6312 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 6280 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
| 6313 | 6281 |
| 6314 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } | 6282 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } |
| 6315 | 6283 |
| 6316 ACCESSORS(JSCollection, table, Object, kTableOffset) | 6284 ACCESSORS(JSCollection, table, Object, kTableOffset) |
| 6317 | 6285 |
| 6318 | 6286 |
| (...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7875 #undef WRITE_INT64_FIELD | 7843 #undef WRITE_INT64_FIELD |
| 7876 #undef READ_BYTE_FIELD | 7844 #undef READ_BYTE_FIELD |
| 7877 #undef WRITE_BYTE_FIELD | 7845 #undef WRITE_BYTE_FIELD |
| 7878 #undef NOBARRIER_READ_BYTE_FIELD | 7846 #undef NOBARRIER_READ_BYTE_FIELD |
| 7879 #undef NOBARRIER_WRITE_BYTE_FIELD | 7847 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7880 | 7848 |
| 7881 } // namespace internal | 7849 } // namespace internal |
| 7882 } // namespace v8 | 7850 } // namespace v8 |
| 7883 | 7851 |
| 7884 #endif // V8_OBJECTS_INL_H_ | 7852 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |