Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: src/objects-inl.h

Issue 2597163002: Revert of [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after
3487 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { 3487 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) {
3488 FixedArray::set(index, value, mode); 3488 FixedArray::set(index, value, mode);
3489 } 3489 }
3490 3490
3491 3491
3492 LiteralsArray* LiteralsArray::cast(Object* object) { 3492 LiteralsArray* LiteralsArray::cast(Object* object) {
3493 SLOW_DCHECK(object->IsLiteralsArray()); 3493 SLOW_DCHECK(object->IsLiteralsArray());
3494 return reinterpret_cast<LiteralsArray*>(object); 3494 return reinterpret_cast<LiteralsArray*>(object);
3495 } 3495 }
3496 3496
3497 bool LiteralsArray::needs_feedback_vector() const {
3498 return get(kVectorIndex)->IsUndefined(this->GetIsolate());
3499 }
3500 3497
3501 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3498 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3502 if (length() == 0 || needs_feedback_vector()) { 3499 if (length() == 0) {
3503 return TypeFeedbackVector::cast( 3500 return TypeFeedbackVector::cast(
3504 this->GetIsolate()->heap()->empty_type_feedback_vector()); 3501 const_cast<FixedArray*>(FixedArray::cast(this)));
3505 } 3502 }
3506
3507 return TypeFeedbackVector::cast(get(kVectorIndex)); 3503 return TypeFeedbackVector::cast(get(kVectorIndex));
3508 } 3504 }
3509 3505
3510 3506
3511 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3507 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3512 if (length() <= kVectorIndex) { 3508 if (length() <= kVectorIndex) {
3513 DCHECK(vector->length() == 0); 3509 DCHECK(vector->length() == 0);
3514 return; 3510 return;
3515 } 3511 }
3516 set(kVectorIndex, vector); 3512 set(kVectorIndex, vector);
(...skipping 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after
6623 // context based on the state change. 6619 // context based on the state change.
6624 if (!was_optimized && is_optimized) { 6620 if (!was_optimized && is_optimized) {
6625 context()->native_context()->AddOptimizedFunction(this); 6621 context()->native_context()->AddOptimizedFunction(this);
6626 } 6622 }
6627 if (was_optimized && !is_optimized) { 6623 if (was_optimized && !is_optimized) {
6628 // TODO(titzer): linear in the number of optimized functions; fix! 6624 // TODO(titzer): linear in the number of optimized functions; fix!
6629 context()->native_context()->RemoveOptimizedFunction(this); 6625 context()->native_context()->RemoveOptimizedFunction(this);
6630 } 6626 }
6631 } 6627 }
6632 6628
6633 bool JSFunction::needs_literals_array() const {
6634 SharedFunctionInfo* shared = this->shared();
6635
6636 return literals() == shared->GetIsolate()->heap()->empty_literals_array() &&
6637 (shared->feedback_metadata()->slot_count() > 0 ||
6638 shared->num_literals() > 0);
6639 }
6640 6629
6641 Context* JSFunction::context() { 6630 Context* JSFunction::context() {
6642 return Context::cast(READ_FIELD(this, kContextOffset)); 6631 return Context::cast(READ_FIELD(this, kContextOffset));
6643 } 6632 }
6644 6633
6645 6634
6646 JSObject* JSFunction::global_proxy() { 6635 JSObject* JSFunction::global_proxy() {
6647 return context()->global_proxy(); 6636 return context()->global_proxy();
6648 } 6637 }
6649 6638
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
8447 #undef WRITE_INT64_FIELD 8436 #undef WRITE_INT64_FIELD
8448 #undef READ_BYTE_FIELD 8437 #undef READ_BYTE_FIELD
8449 #undef WRITE_BYTE_FIELD 8438 #undef WRITE_BYTE_FIELD
8450 #undef NOBARRIER_READ_BYTE_FIELD 8439 #undef NOBARRIER_READ_BYTE_FIELD
8451 #undef NOBARRIER_WRITE_BYTE_FIELD 8440 #undef NOBARRIER_WRITE_BYTE_FIELD
8452 8441
8453 } // namespace internal 8442 } // namespace internal
8454 } // namespace v8 8443 } // namespace v8
8455 8444
8456 #endif // V8_OBJECTS_INL_H_ 8445 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698