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

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

Issue 2657573002: Merged: 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 }
3459 3456
3460 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3457 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3461 if (length() == 0 || !has_feedback_vector()) { 3458 if (length() == 0) {
3462 return TypeFeedbackVector::cast( 3459 return TypeFeedbackVector::cast(
3463 this->GetIsolate()->heap()->empty_type_feedback_vector()); 3460 const_cast<FixedArray*>(FixedArray::cast(this)));
3464 } 3461 }
3465
3466 return TypeFeedbackVector::cast(get(kVectorIndex)); 3462 return TypeFeedbackVector::cast(get(kVectorIndex));
3467 } 3463 }
3468 3464
3469 3465
3470 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3466 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3471 if (length() <= kVectorIndex) { 3467 if (length() <= kVectorIndex) {
3472 DCHECK(vector->length() == 0); 3468 DCHECK(vector->length() == 0);
3473 return; 3469 return;
3474 } 3470 }
3475 set(kVectorIndex, vector); 3471 set(kVectorIndex, vector);
(...skipping 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after
6591 // context based on the state change. 6587 // context based on the state change.
6592 if (!was_optimized && is_optimized) { 6588 if (!was_optimized && is_optimized) {
6593 context()->native_context()->AddOptimizedFunction(this); 6589 context()->native_context()->AddOptimizedFunction(this);
6594 } 6590 }
6595 if (was_optimized && !is_optimized) { 6591 if (was_optimized && !is_optimized) {
6596 // TODO(titzer): linear in the number of optimized functions; fix! 6592 // TODO(titzer): linear in the number of optimized functions; fix!
6597 context()->native_context()->RemoveOptimizedFunction(this); 6593 context()->native_context()->RemoveOptimizedFunction(this);
6598 } 6594 }
6599 } 6595 }
6600 6596
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 }
6608 6597
6609 Context* JSFunction::context() { 6598 Context* JSFunction::context() {
6610 return Context::cast(READ_FIELD(this, kContextOffset)); 6599 return Context::cast(READ_FIELD(this, kContextOffset));
6611 } 6600 }
6612 6601
6613 6602
6614 JSObject* JSFunction::global_proxy() { 6603 JSObject* JSFunction::global_proxy() {
6615 return context()->global_proxy(); 6604 return context()->global_proxy();
6616 } 6605 }
6617 6606
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
8401 #undef WRITE_INT64_FIELD 8390 #undef WRITE_INT64_FIELD
8402 #undef READ_BYTE_FIELD 8391 #undef READ_BYTE_FIELD
8403 #undef WRITE_BYTE_FIELD 8392 #undef WRITE_BYTE_FIELD
8404 #undef NOBARRIER_READ_BYTE_FIELD 8393 #undef NOBARRIER_READ_BYTE_FIELD
8405 #undef NOBARRIER_WRITE_BYTE_FIELD 8394 #undef NOBARRIER_WRITE_BYTE_FIELD
8406 8395
8407 } // namespace internal 8396 } // namespace internal
8408 } // namespace v8 8397 } // namespace v8
8409 8398
8410 #endif // V8_OBJECTS_INL_H_ 8399 #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