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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 723 |
724 | 724 |
725 bool Object::IsTransitionArray() const { | 725 bool Object::IsTransitionArray() const { |
726 return IsFixedArray(); | 726 return IsFixedArray(); |
727 } | 727 } |
728 | 728 |
729 | 729 |
730 bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); } | 730 bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); } |
731 | 731 |
732 | 732 |
| 733 bool Object::IsLiteralsArray() const { return IsFixedArray(); } |
| 734 |
| 735 |
733 bool Object::IsDeoptimizationInputData() const { | 736 bool Object::IsDeoptimizationInputData() const { |
734 // Must be a fixed array. | 737 // Must be a fixed array. |
735 if (!IsFixedArray()) return false; | 738 if (!IsFixedArray()) return false; |
736 | 739 |
737 // There's no sure way to detect the difference between a fixed array and | 740 // There's no sure way to detect the difference between a fixed array and |
738 // a deoptimization data array. Since this is used for asserts we can | 741 // a deoptimization data array. Since this is used for asserts we can |
739 // check that the length is zero or else the fixed size plus a multiple of | 742 // check that the length is zero or else the fixed size plus a multiple of |
740 // the entry size. | 743 // the entry size. |
741 int length = FixedArray::cast(this)->length(); | 744 int length = FixedArray::cast(this)->length(); |
742 if (length == 0) return true; | 745 if (length == 0) return true; |
(...skipping 2704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3447 Smi* DeoptimizationOutputData::PcAndState(int index) { | 3450 Smi* DeoptimizationOutputData::PcAndState(int index) { |
3448 return Smi::cast(get(1 + index * 2)); | 3451 return Smi::cast(get(1 + index * 2)); |
3449 } | 3452 } |
3450 | 3453 |
3451 | 3454 |
3452 void DeoptimizationOutputData::SetPcAndState(int index, Smi* offset) { | 3455 void DeoptimizationOutputData::SetPcAndState(int index, Smi* offset) { |
3453 set(1 + index * 2, offset); | 3456 set(1 + index * 2, offset); |
3454 } | 3457 } |
3455 | 3458 |
3456 | 3459 |
| 3460 Object* LiteralsArray::get(int index) const { return FixedArray::get(index); } |
| 3461 |
| 3462 |
| 3463 void LiteralsArray::set(int index, Object* value) { |
| 3464 FixedArray::set(index, value); |
| 3465 } |
| 3466 |
| 3467 |
| 3468 void LiteralsArray::set(int index, Smi* value) { |
| 3469 FixedArray::set(index, value); |
| 3470 } |
| 3471 |
| 3472 |
| 3473 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { |
| 3474 FixedArray::set(index, value, mode); |
| 3475 } |
| 3476 |
| 3477 |
| 3478 LiteralsArray* LiteralsArray::cast(Object* object) { |
| 3479 SLOW_DCHECK(object->IsLiteralsArray()); |
| 3480 return reinterpret_cast<LiteralsArray*>(object); |
| 3481 } |
| 3482 |
| 3483 |
| 3484 TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
| 3485 return TypeFeedbackVector::cast(get(kVectorIndex)); |
| 3486 } |
| 3487 |
| 3488 |
| 3489 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { |
| 3490 set(kVectorIndex, vector); |
| 3491 } |
| 3492 |
| 3493 |
| 3494 Object* LiteralsArray::literal(int literal_index) const { |
| 3495 return get(kFirstLiteralIndex + literal_index); |
| 3496 } |
| 3497 |
| 3498 |
| 3499 void LiteralsArray::set_literal(int literal_index, Object* literal) { |
| 3500 set(kFirstLiteralIndex + literal_index, literal); |
| 3501 } |
| 3502 |
| 3503 |
| 3504 int LiteralsArray::literals_count() const { |
| 3505 return length() - kFirstLiteralIndex; |
| 3506 } |
| 3507 |
| 3508 |
3457 void HandlerTable::SetRangeStart(int index, int value) { | 3509 void HandlerTable::SetRangeStart(int index, int value) { |
3458 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 3510 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
3459 } | 3511 } |
3460 | 3512 |
3461 | 3513 |
3462 void HandlerTable::SetRangeEnd(int index, int value) { | 3514 void HandlerTable::SetRangeEnd(int index, int value) { |
3463 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); | 3515 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); |
3464 } | 3516 } |
3465 | 3517 |
3466 | 3518 |
(...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6251 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6303 code() != builtins->builtin(Builtins::kCompileOptimized) && |
6252 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6304 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
6253 } | 6305 } |
6254 | 6306 |
6255 | 6307 |
6256 bool JSFunction::has_simple_parameters() { | 6308 bool JSFunction::has_simple_parameters() { |
6257 return shared()->has_simple_parameters(); | 6309 return shared()->has_simple_parameters(); |
6258 } | 6310 } |
6259 | 6311 |
6260 | 6312 |
6261 FixedArray* JSFunction::literals() { | 6313 LiteralsArray* JSFunction::literals() { |
6262 DCHECK(!shared()->bound()); | 6314 DCHECK(!shared()->bound()); |
6263 return literals_or_bindings(); | 6315 return LiteralsArray::cast(literals_or_bindings()); |
6264 } | 6316 } |
6265 | 6317 |
6266 | 6318 |
6267 void JSFunction::set_literals(FixedArray* literals) { | 6319 void JSFunction::set_literals(LiteralsArray* literals) { |
6268 DCHECK(!shared()->bound()); | 6320 DCHECK(!shared()->bound()); |
6269 set_literals_or_bindings(literals); | 6321 set_literals_or_bindings(literals); |
6270 } | 6322 } |
6271 | 6323 |
6272 | 6324 |
6273 FixedArray* JSFunction::function_bindings() { | 6325 FixedArray* JSFunction::function_bindings() { |
6274 DCHECK(shared()->bound()); | 6326 DCHECK(shared()->bound()); |
6275 return literals_or_bindings(); | 6327 return literals_or_bindings(); |
6276 } | 6328 } |
6277 | 6329 |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7990 #undef READ_INT64_FIELD | 8042 #undef READ_INT64_FIELD |
7991 #undef WRITE_INT64_FIELD | 8043 #undef WRITE_INT64_FIELD |
7992 #undef READ_BYTE_FIELD | 8044 #undef READ_BYTE_FIELD |
7993 #undef WRITE_BYTE_FIELD | 8045 #undef WRITE_BYTE_FIELD |
7994 #undef NOBARRIER_READ_BYTE_FIELD | 8046 #undef NOBARRIER_READ_BYTE_FIELD |
7995 #undef NOBARRIER_WRITE_BYTE_FIELD | 8047 #undef NOBARRIER_WRITE_BYTE_FIELD |
7996 | 8048 |
7997 } } // namespace v8::internal | 8049 } } // namespace v8::internal |
7998 | 8050 |
7999 #endif // V8_OBJECTS_INL_H_ | 8051 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |