OLD | NEW |
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 3390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 if (object->IsSmi()) { | 3401 if (object->IsSmi()) { |
3402 WRITE_FIELD(this, | 3402 WRITE_FIELD(this, |
3403 kInstanceDescriptorsOrBitField3Offset, | 3403 kInstanceDescriptorsOrBitField3Offset, |
3404 Smi::FromInt(value)); | 3404 Smi::FromInt(value)); |
3405 } else { | 3405 } else { |
3406 DescriptorArray::cast(object)->set_bit_field3_storage(value); | 3406 DescriptorArray::cast(object)->set_bit_field3_storage(value); |
3407 } | 3407 } |
3408 } | 3408 } |
3409 | 3409 |
3410 | 3410 |
3411 FixedArray* Map::unchecked_prototype_transitions() { | 3411 Object* Map::back_pointer() { |
3412 return reinterpret_cast<FixedArray*>( | 3412 Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
3413 READ_FIELD(this, kPrototypeTransitionsOffset)); | 3413 if (object->IsFixedArray()) { |
| 3414 return FixedArray::cast(object)->get(kProtoTransitionBackPointerOffset); |
| 3415 } else { |
| 3416 return object; |
| 3417 } |
| 3418 } |
| 3419 |
| 3420 |
| 3421 void Map::set_back_pointer(Object* value, WriteBarrierMode mode) { |
| 3422 ASSERT(value->IsUndefined() || |
| 3423 (value->IsMap() && back_pointer()->IsUndefined() && |
| 3424 instance_type() >= FIRST_JS_RECEIVER_TYPE)); |
| 3425 Heap* heap = GetHeap(); |
| 3426 Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
| 3427 if (object->IsFixedArray()) { |
| 3428 FixedArray::cast(object)->set( |
| 3429 kProtoTransitionBackPointerOffset, value, mode); |
| 3430 } else { |
| 3431 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value); |
| 3432 CONDITIONAL_WRITE_BARRIER( |
| 3433 heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode); |
| 3434 } |
| 3435 } |
| 3436 |
| 3437 |
| 3438 FixedArray* Map::prototype_transitions() { |
| 3439 Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
| 3440 if (object->IsFixedArray()) { |
| 3441 return FixedArray::cast(object); |
| 3442 } else { |
| 3443 return GetHeap()->empty_fixed_array(); |
| 3444 } |
| 3445 } |
| 3446 |
| 3447 |
| 3448 void Map::set_prototype_transitions(FixedArray* value, WriteBarrierMode mode) { |
| 3449 Heap* heap = GetHeap(); |
| 3450 ASSERT(value != heap->empty_fixed_array()); |
| 3451 value->set(kProtoTransitionBackPointerOffset, back_pointer()); |
| 3452 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, value); |
| 3453 CONDITIONAL_WRITE_BARRIER( |
| 3454 heap, this, kPrototypeTransitionsOrBackPointerOffset, value, mode); |
| 3455 |
| 3456 } |
| 3457 |
| 3458 |
| 3459 void Map::init_prototype_transitions(Object* undefined) { |
| 3460 ASSERT(undefined->IsUndefined()); |
| 3461 WRITE_FIELD(this, kPrototypeTransitionsOrBackPointerOffset, undefined); |
| 3462 } |
| 3463 |
| 3464 |
| 3465 HeapObject* Map::unchecked_prototype_transitions() { |
| 3466 Object* object = READ_FIELD(this, kPrototypeTransitionsOrBackPointerOffset); |
| 3467 return reinterpret_cast<HeapObject*>(object); |
3414 } | 3468 } |
3415 | 3469 |
3416 | 3470 |
3417 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 3471 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
3418 ACCESSORS(Map, prototype_transitions, FixedArray, kPrototypeTransitionsOffset) | |
3419 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 3472 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
3420 | 3473 |
3421 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 3474 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
3422 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) | 3475 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) |
3423 ACCESSORS(JSFunction, | 3476 ACCESSORS(JSFunction, |
3424 next_function_link, | 3477 next_function_link, |
3425 Object, | 3478 Object, |
3426 kNextFunctionLinkOffset) | 3479 kNextFunctionLinkOffset) |
3427 | 3480 |
3428 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 3481 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4957 #undef WRITE_UINT32_FIELD | 5010 #undef WRITE_UINT32_FIELD |
4958 #undef READ_SHORT_FIELD | 5011 #undef READ_SHORT_FIELD |
4959 #undef WRITE_SHORT_FIELD | 5012 #undef WRITE_SHORT_FIELD |
4960 #undef READ_BYTE_FIELD | 5013 #undef READ_BYTE_FIELD |
4961 #undef WRITE_BYTE_FIELD | 5014 #undef WRITE_BYTE_FIELD |
4962 | 5015 |
4963 | 5016 |
4964 } } // namespace v8::internal | 5017 } } // namespace v8::internal |
4965 | 5018 |
4966 #endif // V8_OBJECTS_INL_H_ | 5019 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |