| 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 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3456 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { | 3456 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { |
| 3457 FixedArray::set(index, value, mode); | 3457 FixedArray::set(index, value, mode); |
| 3458 } | 3458 } |
| 3459 | 3459 |
| 3460 | 3460 |
| 3461 LiteralsArray* LiteralsArray::cast(Object* object) { | 3461 LiteralsArray* LiteralsArray::cast(Object* object) { |
| 3462 SLOW_DCHECK(object->IsLiteralsArray()); | 3462 SLOW_DCHECK(object->IsLiteralsArray()); |
| 3463 return reinterpret_cast<LiteralsArray*>(object); | 3463 return reinterpret_cast<LiteralsArray*>(object); |
| 3464 } | 3464 } |
| 3465 | 3465 |
| 3466 bool LiteralsArray::has_feedback_vector() const { | |
| 3467 return !get(kVectorIndex)->IsUndefined(this->GetIsolate()); | |
| 3468 } | |
| 3469 | 3466 |
| 3470 TypeFeedbackVector* LiteralsArray::feedback_vector() const { | 3467 TypeFeedbackVector* LiteralsArray::feedback_vector() const { |
| 3471 if (length() == 0 || !has_feedback_vector()) { | 3468 if (length() == 0) { |
| 3472 return TypeFeedbackVector::cast( | 3469 return TypeFeedbackVector::cast( |
| 3473 this->GetIsolate()->heap()->empty_type_feedback_vector()); | 3470 const_cast<FixedArray*>(FixedArray::cast(this))); |
| 3474 } | 3471 } |
| 3475 | |
| 3476 return TypeFeedbackVector::cast(get(kVectorIndex)); | 3472 return TypeFeedbackVector::cast(get(kVectorIndex)); |
| 3477 } | 3473 } |
| 3478 | 3474 |
| 3479 | 3475 |
| 3480 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { | 3476 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { |
| 3481 if (length() <= kVectorIndex) { | 3477 if (length() <= kVectorIndex) { |
| 3482 DCHECK(vector->length() == 0); | 3478 DCHECK(vector->length() == 0); |
| 3483 return; | 3479 return; |
| 3484 } | 3480 } |
| 3485 set(kVectorIndex, vector); | 3481 set(kVectorIndex, vector); |
| (...skipping 3134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6620 // context based on the state change. | 6616 // context based on the state change. |
| 6621 if (!was_optimized && is_optimized) { | 6617 if (!was_optimized && is_optimized) { |
| 6622 context()->native_context()->AddOptimizedFunction(this); | 6618 context()->native_context()->AddOptimizedFunction(this); |
| 6623 } | 6619 } |
| 6624 if (was_optimized && !is_optimized) { | 6620 if (was_optimized && !is_optimized) { |
| 6625 // TODO(titzer): linear in the number of optimized functions; fix! | 6621 // TODO(titzer): linear in the number of optimized functions; fix! |
| 6626 context()->native_context()->RemoveOptimizedFunction(this); | 6622 context()->native_context()->RemoveOptimizedFunction(this); |
| 6627 } | 6623 } |
| 6628 } | 6624 } |
| 6629 | 6625 |
| 6630 bool JSFunction::has_literals_array() const { | |
| 6631 SharedFunctionInfo* shared = this->shared(); | |
| 6632 | |
| 6633 return (literals() != shared->GetIsolate()->heap()->empty_literals_array() || | |
| 6634 (shared->feedback_metadata()->slot_count() == 0 && | |
| 6635 shared->num_literals() == 0)); | |
| 6636 } | |
| 6637 | 6626 |
| 6638 Context* JSFunction::context() { | 6627 Context* JSFunction::context() { |
| 6639 return Context::cast(READ_FIELD(this, kContextOffset)); | 6628 return Context::cast(READ_FIELD(this, kContextOffset)); |
| 6640 } | 6629 } |
| 6641 | 6630 |
| 6642 | 6631 |
| 6643 JSObject* JSFunction::global_proxy() { | 6632 JSObject* JSFunction::global_proxy() { |
| 6644 return context()->global_proxy(); | 6633 return context()->global_proxy(); |
| 6645 } | 6634 } |
| 6646 | 6635 |
| (...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8430 #undef WRITE_INT64_FIELD | 8419 #undef WRITE_INT64_FIELD |
| 8431 #undef READ_BYTE_FIELD | 8420 #undef READ_BYTE_FIELD |
| 8432 #undef WRITE_BYTE_FIELD | 8421 #undef WRITE_BYTE_FIELD |
| 8433 #undef NOBARRIER_READ_BYTE_FIELD | 8422 #undef NOBARRIER_READ_BYTE_FIELD |
| 8434 #undef NOBARRIER_WRITE_BYTE_FIELD | 8423 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 8435 | 8424 |
| 8436 } // namespace internal | 8425 } // namespace internal |
| 8437 } // namespace v8 | 8426 } // namespace v8 |
| 8438 | 8427 |
| 8439 #endif // V8_OBJECTS_INL_H_ | 8428 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |