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 3297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3308 } | 3308 } |
3309 | 3309 |
3310 | 3310 |
3311 LiteralsArray* LiteralsArray::cast(Object* object) { | 3311 LiteralsArray* LiteralsArray::cast(Object* object) { |
3312 SLOW_DCHECK(object->IsLiteralsArray()); | 3312 SLOW_DCHECK(object->IsLiteralsArray()); |
3313 return reinterpret_cast<LiteralsArray*>(object); | 3313 return reinterpret_cast<LiteralsArray*>(object); |
3314 } | 3314 } |
3315 | 3315 |
3316 | 3316 |
3317 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | 3317 TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
| 3318 if (length() == 0) { |
| 3319 return TypeFeedbackVector::cast( |
| 3320 const_cast<FixedArray*>(FixedArray::cast(this))); |
| 3321 } |
3318 return TypeFeedbackVector::cast(get(kVectorIndex)); | 3322 return TypeFeedbackVector::cast(get(kVectorIndex)); |
3319 } | 3323 } |
3320 | 3324 |
3321 | 3325 |
3322 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | 3326 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { |
| 3327 if (length() <= kVectorIndex) { |
| 3328 DCHECK(vector->length() == 0); |
| 3329 return; |
| 3330 } |
3323 set(kVectorIndex, vector); | 3331 set(kVectorIndex, vector); |
3324 } | 3332 } |
3325 | 3333 |
3326 | 3334 |
3327 Object* LiteralsArray::literal(int literal_index) const { | 3335 Object* LiteralsArray::literal(int literal_index) const { |
3328 return get(kFirstLiteralIndex + literal_index); | 3336 return get(kFirstLiteralIndex + literal_index); |
3329 } | 3337 } |
3330 | 3338 |
3331 | 3339 |
3332 void LiteralsArray::set_literal(int literal_index, Object* literal) { | 3340 void LiteralsArray::set_literal(int literal_index, Object* literal) { |
3333 set(kFirstLiteralIndex + literal_index, literal); | 3341 set(kFirstLiteralIndex + literal_index, literal); |
3334 } | 3342 } |
3335 | 3343 |
| 3344 void LiteralsArray::set_literal_undefined(int literal_index) { |
| 3345 set_undefined(kFirstLiteralIndex + literal_index); |
| 3346 } |
3336 | 3347 |
3337 int LiteralsArray::literals_count() const { | 3348 int LiteralsArray::literals_count() const { |
3338 return length() - kFirstLiteralIndex; | 3349 return length() - kFirstLiteralIndex; |
3339 } | 3350 } |
3340 | 3351 |
3341 int HandlerTable::GetRangeStart(int index) const { | 3352 int HandlerTable::GetRangeStart(int index) const { |
3342 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); | 3353 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); |
3343 } | 3354 } |
3344 | 3355 |
3345 int HandlerTable::GetRangeEnd(int index) const { | 3356 int HandlerTable::GetRangeEnd(int index) const { |
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 | 5593 |
5583 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) | 5594 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) |
5584 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) | 5595 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) |
5585 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) | 5596 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) |
5586 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5597 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
5587 | 5598 |
5588 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5599 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
5589 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, | 5600 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
5590 kOptimizedCodeMapOffset) | 5601 kOptimizedCodeMapOffset) |
5591 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 5602 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
5592 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, | 5603 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata, |
5593 kFeedbackVectorOffset) | 5604 kFeedbackMetadataOffset) |
5594 #if TRACE_MAPS | 5605 #if TRACE_MAPS |
5595 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) | 5606 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) |
5596 #endif | 5607 #endif |
5597 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 5608 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
5598 kInstanceClassNameOffset) | 5609 kInstanceClassNameOffset) |
5599 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 5610 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
5600 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 5611 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
5601 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 5612 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
5602 ACCESSORS(SharedFunctionInfo, function_identifier, Object, | 5613 ACCESSORS(SharedFunctionInfo, function_identifier, Object, |
5603 kFunctionIdentifierOffset) | 5614 kFunctionIdentifierOffset) |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6251 | 6262 |
6252 | 6263 |
6253 bool JSFunction::is_compiled() { | 6264 bool JSFunction::is_compiled() { |
6254 Builtins* builtins = GetIsolate()->builtins(); | 6265 Builtins* builtins = GetIsolate()->builtins(); |
6255 return code() != builtins->builtin(Builtins::kCompileLazy) && | 6266 return code() != builtins->builtin(Builtins::kCompileLazy) && |
6256 code() != builtins->builtin(Builtins::kCompileBaseline) && | 6267 code() != builtins->builtin(Builtins::kCompileBaseline) && |
6257 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6268 code() != builtins->builtin(Builtins::kCompileOptimized) && |
6258 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6269 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
6259 } | 6270 } |
6260 | 6271 |
| 6272 TypeFeedbackVector* JSFunction::feedback_vector() { |
| 6273 LiteralsArray* array = literals(); |
| 6274 return array->feedback_vector(); |
| 6275 } |
6261 | 6276 |
6262 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) | 6277 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) |
6263 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 6278 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
6264 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 6279 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
6265 | 6280 |
6266 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } | 6281 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } |
6267 | 6282 |
6268 ACCESSORS(JSCollection, table, Object, kTableOffset) | 6283 ACCESSORS(JSCollection, table, Object, kTableOffset) |
6269 | 6284 |
6270 | 6285 |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7867 #undef WRITE_INT64_FIELD | 7882 #undef WRITE_INT64_FIELD |
7868 #undef READ_BYTE_FIELD | 7883 #undef READ_BYTE_FIELD |
7869 #undef WRITE_BYTE_FIELD | 7884 #undef WRITE_BYTE_FIELD |
7870 #undef NOBARRIER_READ_BYTE_FIELD | 7885 #undef NOBARRIER_READ_BYTE_FIELD |
7871 #undef NOBARRIER_WRITE_BYTE_FIELD | 7886 #undef NOBARRIER_WRITE_BYTE_FIELD |
7872 | 7887 |
7873 } // namespace internal | 7888 } // namespace internal |
7874 } // namespace v8 | 7889 } // namespace v8 |
7875 | 7890 |
7876 #endif // V8_OBJECTS_INL_H_ | 7891 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |