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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 | 731 |
732 | 732 |
733 bool Object::IsTransitionArray() const { | 733 bool Object::IsTransitionArray() const { |
734 return IsFixedArray(); | 734 return IsFixedArray(); |
735 } | 735 } |
736 | 736 |
737 | 737 |
738 bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); } | 738 bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); } |
739 | 739 |
740 | 740 |
741 bool Object::IsLiteralsArray() const { return IsFixedArray(); } | |
742 | |
743 | |
741 bool Object::IsDeoptimizationInputData() const { | 744 bool Object::IsDeoptimizationInputData() const { |
742 // Must be a fixed array. | 745 // Must be a fixed array. |
743 if (!IsFixedArray()) return false; | 746 if (!IsFixedArray()) return false; |
744 | 747 |
745 // There's no sure way to detect the difference between a fixed array and | 748 // There's no sure way to detect the difference between a fixed array and |
746 // a deoptimization data array. Since this is used for asserts we can | 749 // a deoptimization data array. Since this is used for asserts we can |
747 // check that the length is zero or else the fixed size plus a multiple of | 750 // check that the length is zero or else the fixed size plus a multiple of |
748 // the entry size. | 751 // the entry size. |
749 int length = FixedArray::cast(this)->length(); | 752 int length = FixedArray::cast(this)->length(); |
750 if (length == 0) return true; | 753 if (length == 0) return true; |
(...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3462 Smi* DeoptimizationOutputData::PcAndState(int index) { | 3465 Smi* DeoptimizationOutputData::PcAndState(int index) { |
3463 return Smi::cast(get(1 + index * 2)); | 3466 return Smi::cast(get(1 + index * 2)); |
3464 } | 3467 } |
3465 | 3468 |
3466 | 3469 |
3467 void DeoptimizationOutputData::SetPcAndState(int index, Smi* offset) { | 3470 void DeoptimizationOutputData::SetPcAndState(int index, Smi* offset) { |
3468 set(1 + index * 2, offset); | 3471 set(1 + index * 2, offset); |
3469 } | 3472 } |
3470 | 3473 |
3471 | 3474 |
3475 LiteralsArray* LiteralsArray::cast(Object* object) { | |
3476 SLOW_DCHECK(object->IsLiteralsArray()); | |
3477 return reinterpret_cast<LiteralsArray*>(object); | |
3478 } | |
3479 | |
3480 | |
3481 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | |
3482 return TypeFeedbackVector::cast(get(kVectorIndex)); | |
3483 } | |
3484 | |
3485 | |
3486 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | |
3487 set(kVectorIndex, vector); | |
3488 } | |
3489 | |
3490 | |
3491 Object* LiteralsArray::literal(int literal_index) const { | |
3492 return get(kFirstLiteralIndex + literal_index); | |
3493 } | |
3494 | |
3495 | |
3496 void LiteralsArray::set_literal(int literal_index, Object* literal) { | |
3497 set(kFirstLiteralIndex + literal_index, literal); | |
3498 } | |
3499 | |
3500 | |
3501 int LiteralsArray::literals_count() const { return length() - 1; } | |
Igor Sheludko
2015/09/28 16:35:27
- kFirstLiteralIndex ?
mvstanton
2015/09/29 08:25:13
Done.
| |
3502 | |
3503 | |
3472 void HandlerTable::SetRangeStart(int index, int value) { | 3504 void HandlerTable::SetRangeStart(int index, int value) { |
3473 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 3505 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
3474 } | 3506 } |
3475 | 3507 |
3476 | 3508 |
3477 void HandlerTable::SetRangeEnd(int index, int value) { | 3509 void HandlerTable::SetRangeEnd(int index, int value) { |
3478 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); | 3510 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); |
3479 } | 3511 } |
3480 | 3512 |
3481 | 3513 |
(...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6266 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6298 code() != builtins->builtin(Builtins::kCompileOptimized) && |
6267 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6299 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
6268 } | 6300 } |
6269 | 6301 |
6270 | 6302 |
6271 bool JSFunction::has_simple_parameters() { | 6303 bool JSFunction::has_simple_parameters() { |
6272 return shared()->has_simple_parameters(); | 6304 return shared()->has_simple_parameters(); |
6273 } | 6305 } |
6274 | 6306 |
6275 | 6307 |
6276 FixedArray* JSFunction::literals() { | 6308 LiteralsArray* JSFunction::literals() { |
6277 DCHECK(!shared()->bound()); | 6309 DCHECK(!shared()->bound()); |
6278 return literals_or_bindings(); | 6310 return LiteralsArray::cast(literals_or_bindings()); |
6279 } | 6311 } |
6280 | 6312 |
6281 | 6313 |
6282 void JSFunction::set_literals(FixedArray* literals) { | 6314 void JSFunction::set_literals(LiteralsArray* literals) { |
6283 DCHECK(!shared()->bound()); | 6315 DCHECK(!shared()->bound()); |
6284 set_literals_or_bindings(literals); | 6316 set_literals_or_bindings(literals); |
6285 } | 6317 } |
6286 | 6318 |
6287 | 6319 |
6288 FixedArray* JSFunction::function_bindings() { | 6320 FixedArray* JSFunction::function_bindings() { |
6289 DCHECK(shared()->bound()); | 6321 DCHECK(shared()->bound()); |
6290 return literals_or_bindings(); | 6322 return literals_or_bindings(); |
6291 } | 6323 } |
6292 | 6324 |
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8006 #undef READ_INT64_FIELD | 8038 #undef READ_INT64_FIELD |
8007 #undef WRITE_INT64_FIELD | 8039 #undef WRITE_INT64_FIELD |
8008 #undef READ_BYTE_FIELD | 8040 #undef READ_BYTE_FIELD |
8009 #undef WRITE_BYTE_FIELD | 8041 #undef WRITE_BYTE_FIELD |
8010 #undef NOBARRIER_READ_BYTE_FIELD | 8042 #undef NOBARRIER_READ_BYTE_FIELD |
8011 #undef NOBARRIER_WRITE_BYTE_FIELD | 8043 #undef NOBARRIER_WRITE_BYTE_FIELD |
8012 | 8044 |
8013 } } // namespace v8::internal | 8045 } } // namespace v8::internal |
8014 | 8046 |
8015 #endif // V8_OBJECTS_INL_H_ | 8047 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |