Chromium Code Reviews| 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 Object* LiteralsArray::get(int index) const { return FixedArray::get(index); } | |
|
Igor Sheludko
2015/09/29 08:40:41
I think you can even leave these methods unimpleme
| |
| 3476 | |
| 3477 | |
| 3478 void LiteralsArray::set(int index, Object* value) { | |
| 3479 FixedArray::set(index, value); | |
| 3480 } | |
| 3481 | |
| 3482 | |
| 3483 void LiteralsArray::set(int index, Smi* value) { | |
| 3484 FixedArray::set(index, value); | |
| 3485 } | |
| 3486 | |
| 3487 | |
| 3488 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { | |
| 3489 FixedArray::set(index, value, mode); | |
| 3490 } | |
| 3491 | |
| 3492 | |
| 3493 LiteralsArray* LiteralsArray::cast(Object* object) { | |
| 3494 SLOW_DCHECK(object->IsLiteralsArray()); | |
| 3495 return reinterpret_cast<LiteralsArray*>(object); | |
| 3496 } | |
| 3497 | |
| 3498 | |
| 3499 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | |
| 3500 return TypeFeedbackVector::cast(get(kVectorIndex)); | |
|
Igor Sheludko
2015/09/29 08:40:41
... if you use FixedArray::get/FixedArray::set met
| |
| 3501 } | |
| 3502 | |
| 3503 | |
| 3504 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | |
| 3505 set(kVectorIndex, vector); | |
| 3506 } | |
| 3507 | |
| 3508 | |
| 3509 Object* LiteralsArray::literal(int literal_index) const { | |
| 3510 return get(kFirstLiteralIndex + literal_index); | |
| 3511 } | |
| 3512 | |
| 3513 | |
| 3514 void LiteralsArray::set_literal(int literal_index, Object* literal) { | |
| 3515 set(kFirstLiteralIndex + literal_index, literal); | |
| 3516 } | |
| 3517 | |
| 3518 | |
| 3519 int LiteralsArray::literals_count() const { | |
| 3520 return length() - kFirstLiteralIndex; | |
| 3521 } | |
| 3522 | |
| 3523 | |
| 3472 void HandlerTable::SetRangeStart(int index, int value) { | 3524 void HandlerTable::SetRangeStart(int index, int value) { |
| 3473 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 3525 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
| 3474 } | 3526 } |
| 3475 | 3527 |
| 3476 | 3528 |
| 3477 void HandlerTable::SetRangeEnd(int index, int value) { | 3529 void HandlerTable::SetRangeEnd(int index, int value) { |
| 3478 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); | 3530 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); |
| 3479 } | 3531 } |
| 3480 | 3532 |
| 3481 | 3533 |
| (...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6266 code() != builtins->builtin(Builtins::kCompileOptimized) && | 6318 code() != builtins->builtin(Builtins::kCompileOptimized) && |
| 6267 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); | 6319 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); |
| 6268 } | 6320 } |
| 6269 | 6321 |
| 6270 | 6322 |
| 6271 bool JSFunction::has_simple_parameters() { | 6323 bool JSFunction::has_simple_parameters() { |
| 6272 return shared()->has_simple_parameters(); | 6324 return shared()->has_simple_parameters(); |
| 6273 } | 6325 } |
| 6274 | 6326 |
| 6275 | 6327 |
| 6276 FixedArray* JSFunction::literals() { | 6328 LiteralsArray* JSFunction::literals() { |
| 6277 DCHECK(!shared()->bound()); | 6329 DCHECK(!shared()->bound()); |
| 6278 return literals_or_bindings(); | 6330 return LiteralsArray::cast(literals_or_bindings()); |
| 6279 } | 6331 } |
| 6280 | 6332 |
| 6281 | 6333 |
| 6282 void JSFunction::set_literals(FixedArray* literals) { | 6334 void JSFunction::set_literals(LiteralsArray* literals) { |
| 6283 DCHECK(!shared()->bound()); | 6335 DCHECK(!shared()->bound()); |
| 6284 set_literals_or_bindings(literals); | 6336 set_literals_or_bindings(literals); |
| 6285 } | 6337 } |
| 6286 | 6338 |
| 6287 | 6339 |
| 6288 FixedArray* JSFunction::function_bindings() { | 6340 FixedArray* JSFunction::function_bindings() { |
| 6289 DCHECK(shared()->bound()); | 6341 DCHECK(shared()->bound()); |
| 6290 return literals_or_bindings(); | 6342 return literals_or_bindings(); |
| 6291 } | 6343 } |
| 6292 | 6344 |
| (...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8006 #undef READ_INT64_FIELD | 8058 #undef READ_INT64_FIELD |
| 8007 #undef WRITE_INT64_FIELD | 8059 #undef WRITE_INT64_FIELD |
| 8008 #undef READ_BYTE_FIELD | 8060 #undef READ_BYTE_FIELD |
| 8009 #undef WRITE_BYTE_FIELD | 8061 #undef WRITE_BYTE_FIELD |
| 8010 #undef NOBARRIER_READ_BYTE_FIELD | 8062 #undef NOBARRIER_READ_BYTE_FIELD |
| 8011 #undef NOBARRIER_WRITE_BYTE_FIELD | 8063 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 8012 | 8064 |
| 8013 } } // namespace v8::internal | 8065 } } // namespace v8::internal |
| 8014 | 8066 |
| 8015 #endif // V8_OBJECTS_INL_H_ | 8067 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |