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

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

Issue 2620753003: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: GCSTRESS fix. Created 3 years, 11 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/runtime/runtime-interpreter.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 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3498 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { 3498 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) {
3499 FixedArray::set(index, value, mode); 3499 FixedArray::set(index, value, mode);
3500 } 3500 }
3501 3501
3502 3502
3503 LiteralsArray* LiteralsArray::cast(Object* object) { 3503 LiteralsArray* LiteralsArray::cast(Object* object) {
3504 SLOW_DCHECK(object->IsLiteralsArray()); 3504 SLOW_DCHECK(object->IsLiteralsArray());
3505 return reinterpret_cast<LiteralsArray*>(object); 3505 return reinterpret_cast<LiteralsArray*>(object);
3506 } 3506 }
3507 3507
3508 bool LiteralsArray::has_feedback_vector() const {
3509 return !get(kVectorIndex)->IsUndefined(this->GetIsolate());
3510 }
3508 3511
3509 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3512 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3510 if (length() == 0) { 3513 if (length() == 0 || !has_feedback_vector()) {
3511 return TypeFeedbackVector::cast( 3514 return TypeFeedbackVector::cast(
3512 const_cast<FixedArray*>(FixedArray::cast(this))); 3515 this->GetIsolate()->heap()->empty_type_feedback_vector());
3513 } 3516 }
3517
3514 return TypeFeedbackVector::cast(get(kVectorIndex)); 3518 return TypeFeedbackVector::cast(get(kVectorIndex));
3515 } 3519 }
3516 3520
3517 3521
3518 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3522 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3519 if (length() <= kVectorIndex) { 3523 if (length() <= kVectorIndex) {
3520 DCHECK(vector->length() == 0); 3524 DCHECK(vector->length() == 0);
3521 return; 3525 return;
3522 } 3526 }
3523 set(kVectorIndex, vector); 3527 set(kVectorIndex, vector);
(...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6650 // context based on the state change. 6654 // context based on the state change.
6651 if (!was_optimized && is_optimized) { 6655 if (!was_optimized && is_optimized) {
6652 context()->native_context()->AddOptimizedFunction(this); 6656 context()->native_context()->AddOptimizedFunction(this);
6653 } 6657 }
6654 if (was_optimized && !is_optimized) { 6658 if (was_optimized && !is_optimized) {
6655 // TODO(titzer): linear in the number of optimized functions; fix! 6659 // TODO(titzer): linear in the number of optimized functions; fix!
6656 context()->native_context()->RemoveOptimizedFunction(this); 6660 context()->native_context()->RemoveOptimizedFunction(this);
6657 } 6661 }
6658 } 6662 }
6659 6663
6664 bool JSFunction::has_literals_array() const {
6665 SharedFunctionInfo* shared = this->shared();
6666
6667 return (literals() != shared->GetIsolate()->heap()->empty_literals_array() ||
6668 (shared->feedback_metadata()->slot_count() == 0 &&
6669 shared->num_literals() == 0));
6670 }
6660 6671
6661 Context* JSFunction::context() { 6672 Context* JSFunction::context() {
6662 return Context::cast(READ_FIELD(this, kContextOffset)); 6673 return Context::cast(READ_FIELD(this, kContextOffset));
6663 } 6674 }
6664 6675
6665 6676
6666 JSObject* JSFunction::global_proxy() { 6677 JSObject* JSFunction::global_proxy() {
6667 return context()->global_proxy(); 6678 return context()->global_proxy();
6668 } 6679 }
6669 6680
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
8453 #undef WRITE_INT64_FIELD 8464 #undef WRITE_INT64_FIELD
8454 #undef READ_BYTE_FIELD 8465 #undef READ_BYTE_FIELD
8455 #undef WRITE_BYTE_FIELD 8466 #undef WRITE_BYTE_FIELD
8456 #undef NOBARRIER_READ_BYTE_FIELD 8467 #undef NOBARRIER_READ_BYTE_FIELD
8457 #undef NOBARRIER_WRITE_BYTE_FIELD 8468 #undef NOBARRIER_WRITE_BYTE_FIELD
8458 8469
8459 } // namespace internal 8470 } // namespace internal
8460 } // namespace v8 8471 } // namespace v8
8461 8472
8462 #endif // V8_OBJECTS_INL_H_ 8473 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698