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

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

Issue 2642933003: Revert of Revert [TypeFeedbackVector] Root literal arrays in function literal 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 3435 matching lines...) Expand 10 before | Expand all | Expand 10 after
3446 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) { 3446 void LiteralsArray::set(int index, Object* value, WriteBarrierMode mode) {
3447 FixedArray::set(index, value, mode); 3447 FixedArray::set(index, value, mode);
3448 } 3448 }
3449 3449
3450 3450
3451 LiteralsArray* LiteralsArray::cast(Object* object) { 3451 LiteralsArray* LiteralsArray::cast(Object* object) {
3452 SLOW_DCHECK(object->IsLiteralsArray()); 3452 SLOW_DCHECK(object->IsLiteralsArray());
3453 return reinterpret_cast<LiteralsArray*>(object); 3453 return reinterpret_cast<LiteralsArray*>(object);
3454 } 3454 }
3455 3455
3456 bool LiteralsArray::has_feedback_vector() const {
3457 return !get(kVectorIndex)->IsUndefined(this->GetIsolate());
3458 }
3456 3459
3457 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3460 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3458 if (length() == 0) { 3461 if (length() == 0 || !has_feedback_vector()) {
3459 return TypeFeedbackVector::cast( 3462 return TypeFeedbackVector::cast(
3460 const_cast<FixedArray*>(FixedArray::cast(this))); 3463 this->GetIsolate()->heap()->empty_type_feedback_vector());
3461 } 3464 }
3465
3462 return TypeFeedbackVector::cast(get(kVectorIndex)); 3466 return TypeFeedbackVector::cast(get(kVectorIndex));
3463 } 3467 }
3464 3468
3465 3469
3466 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3470 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3467 if (length() <= kVectorIndex) { 3471 if (length() <= kVectorIndex) {
3468 DCHECK(vector->length() == 0); 3472 DCHECK(vector->length() == 0);
3469 return; 3473 return;
3470 } 3474 }
3471 set(kVectorIndex, vector); 3475 set(kVectorIndex, vector);
(...skipping 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after
6587 // context based on the state change. 6591 // context based on the state change.
6588 if (!was_optimized && is_optimized) { 6592 if (!was_optimized && is_optimized) {
6589 context()->native_context()->AddOptimizedFunction(this); 6593 context()->native_context()->AddOptimizedFunction(this);
6590 } 6594 }
6591 if (was_optimized && !is_optimized) { 6595 if (was_optimized && !is_optimized) {
6592 // TODO(titzer): linear in the number of optimized functions; fix! 6596 // TODO(titzer): linear in the number of optimized functions; fix!
6593 context()->native_context()->RemoveOptimizedFunction(this); 6597 context()->native_context()->RemoveOptimizedFunction(this);
6594 } 6598 }
6595 } 6599 }
6596 6600
6601 bool JSFunction::has_literals_array() const {
6602 SharedFunctionInfo* shared = this->shared();
6603
6604 return (literals() != shared->GetIsolate()->heap()->empty_literals_array() ||
6605 (shared->feedback_metadata()->slot_count() == 0 &&
6606 shared->num_literals() == 0));
6607 }
6597 6608
6598 Context* JSFunction::context() { 6609 Context* JSFunction::context() {
6599 return Context::cast(READ_FIELD(this, kContextOffset)); 6610 return Context::cast(READ_FIELD(this, kContextOffset));
6600 } 6611 }
6601 6612
6602 6613
6603 JSObject* JSFunction::global_proxy() { 6614 JSObject* JSFunction::global_proxy() {
6604 return context()->global_proxy(); 6615 return context()->global_proxy();
6605 } 6616 }
6606 6617
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
8390 #undef WRITE_INT64_FIELD 8401 #undef WRITE_INT64_FIELD
8391 #undef READ_BYTE_FIELD 8402 #undef READ_BYTE_FIELD
8392 #undef WRITE_BYTE_FIELD 8403 #undef WRITE_BYTE_FIELD
8393 #undef NOBARRIER_READ_BYTE_FIELD 8404 #undef NOBARRIER_READ_BYTE_FIELD
8394 #undef NOBARRIER_WRITE_BYTE_FIELD 8405 #undef NOBARRIER_WRITE_BYTE_FIELD
8395 8406
8396 } // namespace internal 8407 } // namespace internal
8397 } // namespace v8 8408 } // namespace v8
8398 8409
8399 #endif // V8_OBJECTS_INL_H_ 8410 #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