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

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

Issue 10802034: Moved lastadded from DescriptorArray to Map. Renamed kLastAdded to kEnumCache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/transitions-inl.h » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 } 2947 }
2948 } 2948 }
2949 2949
2950 2950
2951 bool Map::has_non_instance_prototype() { 2951 bool Map::has_non_instance_prototype() {
2952 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0; 2952 return ((1 << kHasNonInstancePrototype) & bit_field()) != 0;
2953 } 2953 }
2954 2954
2955 2955
2956 void Map::set_function_with_prototype(bool value) { 2956 void Map::set_function_with_prototype(bool value) {
2957 if (value) { 2957 set_bit_field3(FunctionWithPrototype::update(bit_field3(), value));
2958 set_bit_field3(bit_field3() | (1 << kFunctionWithPrototype));
2959 } else {
2960 set_bit_field3(bit_field3() & ~(1 << kFunctionWithPrototype));
2961 }
2962 } 2958 }
2963 2959
2964 2960
2965 bool Map::function_with_prototype() { 2961 bool Map::function_with_prototype() {
2966 return ((1 << kFunctionWithPrototype) & bit_field3()) != 0; 2962 return FunctionWithPrototype::decode(bit_field3());
2967 } 2963 }
2968 2964
2969 2965
2970 void Map::set_is_access_check_needed(bool access_check_needed) { 2966 void Map::set_is_access_check_needed(bool access_check_needed) {
2971 if (access_check_needed) { 2967 if (access_check_needed) {
2972 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded)); 2968 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded));
2973 } else { 2969 } else {
2974 set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded)); 2970 set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded));
2975 } 2971 }
2976 } 2972 }
(...skipping 24 matching lines...) Expand all
3001 set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo)); 2997 set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo));
3002 } 2998 }
3003 } 2999 }
3004 3000
3005 bool Map::attached_to_shared_function_info() { 3001 bool Map::attached_to_shared_function_info() {
3006 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; 3002 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0;
3007 } 3003 }
3008 3004
3009 3005
3010 void Map::set_is_shared(bool value) { 3006 void Map::set_is_shared(bool value) {
3011 if (value) { 3007 set_bit_field3(IsShared::update(bit_field3(), value));
3012 set_bit_field3(bit_field3() | (1 << kIsShared));
3013 } else {
3014 set_bit_field3(bit_field3() & ~(1 << kIsShared));
3015 }
3016 } 3008 }
3017 3009
3018 bool Map::is_shared() { 3010 bool Map::is_shared() {
3019 return ((1 << kIsShared) & bit_field3()) != 0; 3011 return IsShared::decode(bit_field3());
3020 } 3012 }
3021 3013
3022 3014
3023 JSFunction* Map::unchecked_constructor() { 3015 JSFunction* Map::unchecked_constructor() {
3024 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset)); 3016 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset));
3025 } 3017 }
3026 3018
3027 3019
3028 Code::Flags Code::flags() { 3020 Code::Flags Code::flags() {
3029 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); 3021 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 // the descriptor array. 3507 // the descriptor array.
3516 for (int i = 0; i < len; ++i) { 3508 for (int i = 0; i < len; ++i) {
3517 int enum_index = descriptors->GetDetails(i).index() - 3509 int enum_index = descriptors->GetDetails(i).index() -
3518 PropertyDetails::kInitialIndex; 3510 PropertyDetails::kInitialIndex;
3519 ASSERT(0 <= enum_index && enum_index < len); 3511 ASSERT(0 <= enum_index && enum_index < len);
3520 ASSERT(!used_indices[enum_index]); 3512 ASSERT(!used_indices[enum_index]);
3521 used_indices[enum_index] = true; 3513 used_indices[enum_index] = true;
3522 } 3514 }
3523 #endif 3515 #endif
3524 3516
3517 set_instance_descriptors(descriptors);
3518
3525 for (int i = 0; i < len; ++i) { 3519 for (int i = 0; i < len; ++i) {
3526 if (descriptors->GetDetails(i).index() == len) { 3520 if (descriptors->GetDetails(i).index() == len) {
3527 descriptors->SetLastAdded(i); 3521 SetLastAdded(i);
3528 break; 3522 break;
3529 } 3523 }
3530 } 3524 }
3531 3525
3532 ASSERT(len == 0 || 3526 ASSERT(len == 0 ||
3533 len == descriptors->GetDetails(descriptors->LastAdded()).index()); 3527 len == descriptors->GetDetails(LastAdded()).index());
3534
3535 set_instance_descriptors(descriptors);
3536 } 3528 }
3537 3529
3538 3530
3539 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) 3531 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset)
3540 3532
3541 3533
3542 void Map::ClearDescriptorArray(Heap* heap, WriteBarrierMode mode) { 3534 void Map::ClearDescriptorArray(Heap* heap, WriteBarrierMode mode) {
3543 Object* back_pointer = GetBackPointer(); 3535 Object* back_pointer = GetBackPointer();
3544 #ifdef DEBUG 3536 #ifdef DEBUG
3545 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset); 3537 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset);
3546 if (object->IsDescriptorArray()) { 3538 if (object->IsDescriptorArray()) {
3547 ZapTransitions(); 3539 ZapTransitions();
3548 } else { 3540 } else {
3549 ASSERT(object->IsMap() || object->IsUndefined()); 3541 ASSERT(object->IsMap() || object->IsUndefined());
3550 } 3542 }
3551 #endif 3543 #endif
3552 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, back_pointer); 3544 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, back_pointer);
3553 CONDITIONAL_WRITE_BARRIER( 3545 CONDITIONAL_WRITE_BARRIER(
3554 heap, this, kInstanceDescriptorsOrBackPointerOffset, back_pointer, mode); 3546 heap, this, kInstanceDescriptorsOrBackPointerOffset, back_pointer, mode);
3555 } 3547 }
3556 3548
3557 3549
3558 void Map::AppendDescriptor(Descriptor* desc, 3550 void Map::AppendDescriptor(Descriptor* desc,
3559 const DescriptorArray::WhitenessWitness& witness) { 3551 const DescriptorArray::WhitenessWitness& witness) {
3560 DescriptorArray* descriptors = instance_descriptors(); 3552 DescriptorArray* descriptors = instance_descriptors();
3561 int set_descriptors = descriptors->NumberOfSetDescriptors(); 3553 int set_descriptors = NumberOfSetDescriptors();
3562 int new_last_added = descriptors->Append(desc, witness, set_descriptors); 3554 int new_last_added = descriptors->Append(desc, witness, set_descriptors);
3563 descriptors->SetLastAdded(new_last_added); 3555 SetLastAdded(new_last_added);
3564 } 3556 }
3565 3557
3566 3558
3567 Object* Map::GetBackPointer() { 3559 Object* Map::GetBackPointer() {
3568 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset); 3560 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset);
3569 if (object->IsDescriptorArray()) { 3561 if (object->IsDescriptorArray()) {
3570 return DescriptorArray::cast(object)->back_pointer_storage(); 3562 return DescriptorArray::cast(object)->back_pointer_storage();
3571 } else { 3563 } else {
3572 ASSERT(object->IsMap() || object->IsUndefined()); 3564 ASSERT(object->IsMap() || object->IsUndefined());
3573 return object; 3565 return object;
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
5378 #undef WRITE_UINT32_FIELD 5370 #undef WRITE_UINT32_FIELD
5379 #undef READ_SHORT_FIELD 5371 #undef READ_SHORT_FIELD
5380 #undef WRITE_SHORT_FIELD 5372 #undef WRITE_SHORT_FIELD
5381 #undef READ_BYTE_FIELD 5373 #undef READ_BYTE_FIELD
5382 #undef WRITE_BYTE_FIELD 5374 #undef WRITE_BYTE_FIELD
5383 5375
5384 5376
5385 } } // namespace v8::internal 5377 } } // namespace v8::internal
5386 5378
5387 #endif // V8_OBJECTS_INL_H_ 5379 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698