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

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

Issue 2642743002: Revert [TypeFeedbackVector] Root literal arrays in function literal slots (Closed)
Patch Set: Altered test for wasm. 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 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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_
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