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

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

Issue 2626863004: Revert of [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: 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 }
3511 3508
3512 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3509 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3513 if (length() == 0 || !has_feedback_vector()) { 3510 if (length() == 0) {
3514 return TypeFeedbackVector::cast( 3511 return TypeFeedbackVector::cast(
3515 this->GetIsolate()->heap()->empty_type_feedback_vector()); 3512 const_cast<FixedArray*>(FixedArray::cast(this)));
3516 } 3513 }
3517
3518 return TypeFeedbackVector::cast(get(kVectorIndex)); 3514 return TypeFeedbackVector::cast(get(kVectorIndex));
3519 } 3515 }
3520 3516
3521 3517
3522 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3518 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3523 if (length() <= kVectorIndex) { 3519 if (length() <= kVectorIndex) {
3524 DCHECK(vector->length() == 0); 3520 DCHECK(vector->length() == 0);
3525 return; 3521 return;
3526 } 3522 }
3527 set(kVectorIndex, vector); 3523 set(kVectorIndex, vector);
(...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6654 // context based on the state change. 6650 // context based on the state change.
6655 if (!was_optimized && is_optimized) { 6651 if (!was_optimized && is_optimized) {
6656 context()->native_context()->AddOptimizedFunction(this); 6652 context()->native_context()->AddOptimizedFunction(this);
6657 } 6653 }
6658 if (was_optimized && !is_optimized) { 6654 if (was_optimized && !is_optimized) {
6659 // TODO(titzer): linear in the number of optimized functions; fix! 6655 // TODO(titzer): linear in the number of optimized functions; fix!
6660 context()->native_context()->RemoveOptimizedFunction(this); 6656 context()->native_context()->RemoveOptimizedFunction(this);
6661 } 6657 }
6662 } 6658 }
6663 6659
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 }
6671 6660
6672 Context* JSFunction::context() { 6661 Context* JSFunction::context() {
6673 return Context::cast(READ_FIELD(this, kContextOffset)); 6662 return Context::cast(READ_FIELD(this, kContextOffset));
6674 } 6663 }
6675 6664
6676 6665
6677 JSObject* JSFunction::global_proxy() { 6666 JSObject* JSFunction::global_proxy() {
6678 return context()->global_proxy(); 6667 return context()->global_proxy();
6679 } 6668 }
6680 6669
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
8464 #undef WRITE_INT64_FIELD 8453 #undef WRITE_INT64_FIELD
8465 #undef READ_BYTE_FIELD 8454 #undef READ_BYTE_FIELD
8466 #undef WRITE_BYTE_FIELD 8455 #undef WRITE_BYTE_FIELD
8467 #undef NOBARRIER_READ_BYTE_FIELD 8456 #undef NOBARRIER_READ_BYTE_FIELD
8468 #undef NOBARRIER_WRITE_BYTE_FIELD 8457 #undef NOBARRIER_WRITE_BYTE_FIELD
8469 8458
8470 } // namespace internal 8459 } // namespace internal
8471 } // namespace v8 8460 } // namespace v8
8472 8461
8473 #endif // V8_OBJECTS_INL_H_ 8462 #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