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 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 } | 3301 } |
3302 | 3302 |
3303 | 3303 |
3304 LiteralsArray* LiteralsArray::cast(Object* object) { | 3304 LiteralsArray* LiteralsArray::cast(Object* object) { |
3305 SLOW_DCHECK(object->IsLiteralsArray()); | 3305 SLOW_DCHECK(object->IsLiteralsArray()); |
3306 return reinterpret_cast<LiteralsArray*>(object); | 3306 return reinterpret_cast<LiteralsArray*>(object); |
3307 } | 3307 } |
3308 | 3308 |
3309 | 3309 |
3310 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | 3310 TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
| 3311 if (length() == 0) { |
| 3312 return TypeFeedbackVector::cast( |
| 3313 const_cast<FixedArray*>(FixedArray::cast(this))); |
| 3314 } |
3311 return TypeFeedbackVector::cast(get(kVectorIndex)); | 3315 return TypeFeedbackVector::cast(get(kVectorIndex)); |
3312 } | 3316 } |
3313 | 3317 |
3314 | 3318 |
3315 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | 3319 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { |
| 3320 if (length() <= kVectorIndex) { |
| 3321 DCHECK(vector->length() == 0); |
| 3322 return; |
| 3323 } |
3316 set(kVectorIndex, vector); | 3324 set(kVectorIndex, vector); |
3317 } | 3325 } |
3318 | 3326 |
3319 | 3327 |
3320 Object* LiteralsArray::literal(int literal_index) const { | 3328 Object* LiteralsArray::literal(int literal_index) const { |
3321 return get(kFirstLiteralIndex + literal_index); | 3329 return get(kFirstLiteralIndex + literal_index); |
3322 } | 3330 } |
3323 | 3331 |
3324 | 3332 |
3325 void LiteralsArray::set_literal(int literal_index, Object* literal) { | 3333 void LiteralsArray::set_literal(int literal_index, Object* literal) { |
3326 set(kFirstLiteralIndex + literal_index, literal); | 3334 set(kFirstLiteralIndex + literal_index, literal); |
3327 } | 3335 } |
3328 | 3336 |
| 3337 void LiteralsArray::set_literal_undefined(int literal_index) { |
| 3338 set_undefined(kFirstLiteralIndex + literal_index); |
| 3339 } |
3329 | 3340 |
3330 int LiteralsArray::literals_count() const { | 3341 int LiteralsArray::literals_count() const { |
3331 return length() - kFirstLiteralIndex; | 3342 return length() - kFirstLiteralIndex; |
3332 } | 3343 } |
3333 | 3344 |
3334 int HandlerTable::GetRangeStart(int index) const { | 3345 int HandlerTable::GetRangeStart(int index) const { |
3335 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); | 3346 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); |
3336 } | 3347 } |
3337 | 3348 |
3338 int HandlerTable::GetRangeEnd(int index) const { | 3349 int HandlerTable::GetRangeEnd(int index) const { |
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5561 | 5572 |
5562 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) | 5573 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex) |
5563 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) | 5574 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) |
5564 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) | 5575 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) |
5565 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 5576 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
5566 | 5577 |
5567 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 5578 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
5568 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, | 5579 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
5569 kOptimizedCodeMapOffset) | 5580 kOptimizedCodeMapOffset) |
5570 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 5581 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
5571 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, | 5582 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata, |
5572 kFeedbackVectorOffset) | 5583 kFeedbackMetadataOffset) |
5573 #if TRACE_MAPS | 5584 #if TRACE_MAPS |
5574 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) | 5585 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) |
5575 #endif | 5586 #endif |
5576 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 5587 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
5577 kInstanceClassNameOffset) | 5588 kInstanceClassNameOffset) |
5578 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 5589 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
5579 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 5590 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
5580 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 5591 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
5581 ACCESSORS(SharedFunctionInfo, function_identifier, Object, | 5592 ACCESSORS(SharedFunctionInfo, function_identifier, Object, |
5582 kFunctionIdentifierOffset) | 5593 kFunctionIdentifierOffset) |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6230 | 6241 |
6231 | 6242 |
6232 bool JSFunction::is_compiled() { | 6243 bool JSFunction::is_compiled() { |
6233 Builtins* builtins = GetIsolate()->builtins(); | 6244 Builtins* builtins = GetIsolate()->builtins(); |
6234 return code() != builtins->builtin(Builtins::kCompileLazy) && | 6245 return code() != builtins->builtin(Builtins::kCompileLazy) && |
6235 code() != builtins->builtin(Builtins::kCompileBaseline) && | 6246 code() != builtins->builtin(Builtins::kCompileBaseline) && |
6236 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6247 code() != builtins->builtin(Builtins::kCompileOptimized) && |
6237 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6248 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
6238 } | 6249 } |
6239 | 6250 |
| 6251 TypeFeedbackVector* JSFunction::feedback_vector() { |
| 6252 LiteralsArray* array = literals(); |
| 6253 return array->feedback_vector(); |
| 6254 } |
6240 | 6255 |
6241 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) | 6256 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) |
6242 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 6257 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
6243 ACCESSORS(JSProxy, hash, Object, kHashOffset) | 6258 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
6244 | 6259 |
6245 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } | 6260 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } |
6246 | 6261 |
6247 ACCESSORS(JSCollection, table, Object, kTableOffset) | 6262 ACCESSORS(JSCollection, table, Object, kTableOffset) |
6248 | 6263 |
6249 | 6264 |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7837 #undef WRITE_INT64_FIELD | 7852 #undef WRITE_INT64_FIELD |
7838 #undef READ_BYTE_FIELD | 7853 #undef READ_BYTE_FIELD |
7839 #undef WRITE_BYTE_FIELD | 7854 #undef WRITE_BYTE_FIELD |
7840 #undef NOBARRIER_READ_BYTE_FIELD | 7855 #undef NOBARRIER_READ_BYTE_FIELD |
7841 #undef NOBARRIER_WRITE_BYTE_FIELD | 7856 #undef NOBARRIER_WRITE_BYTE_FIELD |
7842 | 7857 |
7843 } // namespace internal | 7858 } // namespace internal |
7844 } // namespace v8 | 7859 } // namespace v8 |
7845 | 7860 |
7846 #endif // V8_OBJECTS_INL_H_ | 7861 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |