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

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

Issue 980523004: Retain maps embedded in optimized code for several garbage collections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Check constructor. Created 5 years, 9 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') | test/cctest/cctest.gyp » ('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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 bool Object::IsJSWeakCollection() const { 712 bool Object::IsJSWeakCollection() const {
713 return IsJSWeakMap() || IsJSWeakSet(); 713 return IsJSWeakMap() || IsJSWeakSet();
714 } 714 }
715 715
716 716
717 bool Object::IsDescriptorArray() const { 717 bool Object::IsDescriptorArray() const {
718 return IsFixedArray(); 718 return IsFixedArray();
719 } 719 }
720 720
721 721
722 bool Object::IsArrayList() const { return IsFixedArray(); }
723
724
722 bool Object::IsLayoutDescriptor() const { 725 bool Object::IsLayoutDescriptor() const {
723 return IsSmi() || IsFixedTypedArrayBase(); 726 return IsSmi() || IsFixedTypedArrayBase();
724 } 727 }
725 728
726 729
727 bool Object::IsTransitionArray() const { 730 bool Object::IsTransitionArray() const {
728 return IsFixedArray(); 731 return IsFixedArray();
729 } 732 }
730 733
731 734
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 int WeakFixedArray::last_used_index() const { 2422 int WeakFixedArray::last_used_index() const {
2420 return Smi::cast(FixedArray::cast(this)->get(kLastUsedIndexIndex))->value(); 2423 return Smi::cast(FixedArray::cast(this)->get(kLastUsedIndexIndex))->value();
2421 } 2424 }
2422 2425
2423 2426
2424 void WeakFixedArray::set_last_used_index(int index) { 2427 void WeakFixedArray::set_last_used_index(int index) {
2425 FixedArray::cast(this)->set(kLastUsedIndexIndex, Smi::FromInt(index)); 2428 FixedArray::cast(this)->set(kLastUsedIndexIndex, Smi::FromInt(index));
2426 } 2429 }
2427 2430
2428 2431
2432 int ArrayList::Length() {
2433 if (FixedArray::cast(this)->length() == 0) return 0;
2434 return Smi::cast(FixedArray::cast(this)->get(kLengthIndex))->value();
2435 }
2436
2437
2438 void ArrayList::SetLength(int length) {
2439 return FixedArray::cast(this)->set(kLengthIndex, Smi::FromInt(length));
2440 }
2441
2442
2443 Object* ArrayList::Get(int index) {
2444 return FixedArray::cast(this)->get(kFirstIndex + index);
2445 }
2446
2447
2448 Object** ArrayList::Slot(int index) {
2449 return data_start() + kFirstIndex + index;
2450 }
2451
2452
2453 void ArrayList::Set(int index, Object* obj) {
2454 FixedArray::cast(this)->set(kFirstIndex + index, obj);
2455 }
2456
2457
2458 void ArrayList::Clear(int index, Object* undefined) {
2459 DCHECK(undefined->IsUndefined());
2460 FixedArray::cast(this)
2461 ->set(kFirstIndex + index, undefined, SKIP_WRITE_BARRIER);
2462 }
2463
2464
2429 void ConstantPoolArray::NumberOfEntries::increment(Type type) { 2465 void ConstantPoolArray::NumberOfEntries::increment(Type type) {
2430 DCHECK(type < NUMBER_OF_TYPES); 2466 DCHECK(type < NUMBER_OF_TYPES);
2431 element_counts_[type]++; 2467 element_counts_[type]++;
2432 } 2468 }
2433 2469
2434 2470
2435 int ConstantPoolArray::NumberOfEntries::equals( 2471 int ConstantPoolArray::NumberOfEntries::equals(
2436 const ConstantPoolArray::NumberOfEntries& other) const { 2472 const ConstantPoolArray::NumberOfEntries& other) const {
2437 for (int i = 0; i < NUMBER_OF_TYPES; i++) { 2473 for (int i = 0; i < NUMBER_OF_TYPES; i++) {
2438 if (element_counts_[i] != other.element_counts_[i]) return false; 2474 if (element_counts_[i] != other.element_counts_[i]) return false;
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 void SeededNumberDictionary::set_requires_slow_elements() { 3353 void SeededNumberDictionary::set_requires_slow_elements() {
3318 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask)); 3354 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
3319 } 3355 }
3320 3356
3321 3357
3322 // ------------------------------------ 3358 // ------------------------------------
3323 // Cast operations 3359 // Cast operations
3324 3360
3325 3361
3326 CAST_ACCESSOR(AccessorInfo) 3362 CAST_ACCESSOR(AccessorInfo)
3363 CAST_ACCESSOR(ArrayList)
3327 CAST_ACCESSOR(ByteArray) 3364 CAST_ACCESSOR(ByteArray)
3328 CAST_ACCESSOR(Cell) 3365 CAST_ACCESSOR(Cell)
3329 CAST_ACCESSOR(Code) 3366 CAST_ACCESSOR(Code)
3330 CAST_ACCESSOR(CodeCacheHashTable) 3367 CAST_ACCESSOR(CodeCacheHashTable)
3331 CAST_ACCESSOR(CompilationCacheTable) 3368 CAST_ACCESSOR(CompilationCacheTable)
3332 CAST_ACCESSOR(ConsString) 3369 CAST_ACCESSOR(ConsString)
3333 CAST_ACCESSOR(ConstantPoolArray) 3370 CAST_ACCESSOR(ConstantPoolArray)
3334 CAST_ACCESSOR(DeoptimizationInputData) 3371 CAST_ACCESSOR(DeoptimizationInputData)
3335 CAST_ACCESSOR(DeoptimizationOutputData) 3372 CAST_ACCESSOR(DeoptimizationOutputData)
3336 CAST_ACCESSOR(DependentCode) 3373 CAST_ACCESSOR(DependentCode)
(...skipping 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after
7655 #undef READ_SHORT_FIELD 7692 #undef READ_SHORT_FIELD
7656 #undef WRITE_SHORT_FIELD 7693 #undef WRITE_SHORT_FIELD
7657 #undef READ_BYTE_FIELD 7694 #undef READ_BYTE_FIELD
7658 #undef WRITE_BYTE_FIELD 7695 #undef WRITE_BYTE_FIELD
7659 #undef NOBARRIER_READ_BYTE_FIELD 7696 #undef NOBARRIER_READ_BYTE_FIELD
7660 #undef NOBARRIER_WRITE_BYTE_FIELD 7697 #undef NOBARRIER_WRITE_BYTE_FIELD
7661 7698
7662 } } // namespace v8::internal 7699 } } // namespace v8::internal
7663 7700
7664 #endif // V8_OBJECTS_INL_H_ 7701 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698