| OLD | NEW |
| 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 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3334 SMI_ACCESSORS(String, length, kLengthOffset) | 3334 SMI_ACCESSORS(String, length, kLengthOffset) |
| 3335 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) | 3335 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) |
| 3336 | 3336 |
| 3337 | 3337 |
| 3338 uint32_t Name::hash_field() { | 3338 uint32_t Name::hash_field() { |
| 3339 return READ_UINT32_FIELD(this, kHashFieldOffset); | 3339 return READ_UINT32_FIELD(this, kHashFieldOffset); |
| 3340 } | 3340 } |
| 3341 | 3341 |
| 3342 | 3342 |
| 3343 void Name::set_hash_field(uint32_t value) { | 3343 void Name::set_hash_field(uint32_t value) { |
| 3344 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); | 3344 WRITE_INTPTR_FIELD(this, kHashFieldSlot, value); |
| 3345 #if V8_HOST_ARCH_64_BIT | |
| 3346 WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0); | |
| 3347 #endif | |
| 3348 } | 3345 } |
| 3349 | 3346 |
| 3350 | 3347 |
| 3351 bool Name::Equals(Name* other) { | 3348 bool Name::Equals(Name* other) { |
| 3352 if (other == this) return true; | 3349 if (other == this) return true; |
| 3353 if ((this->IsInternalizedString() && other->IsInternalizedString()) || | 3350 if ((this->IsInternalizedString() && other->IsInternalizedString()) || |
| 3354 this->IsSymbol() || other->IsSymbol()) { | 3351 this->IsSymbol() || other->IsSymbol()) { |
| 3355 return false; | 3352 return false; |
| 3356 } | 3353 } |
| 3357 return String::cast(this)->SlowEquals(String::cast(other)); | 3354 return String::cast(this)->SlowEquals(String::cast(other)); |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5505 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5502 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 5506 kCompilerHintsOffset) | 5503 kCompilerHintsOffset) |
| 5507 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, | 5504 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, |
| 5508 kOptCountAndBailoutReasonOffset) | 5505 kOptCountAndBailoutReasonOffset) |
| 5509 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) | 5506 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) |
| 5510 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) | 5507 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) |
| 5511 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) | 5508 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) |
| 5512 | 5509 |
| 5513 #else | 5510 #else |
| 5514 | 5511 |
| 5515 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ | 5512 #if V8_TARGET_LITTLE_ENDIAN |
| 5516 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ | 5513 #define PSEUDO_SMI_LO_ALIGN 0 |
| 5517 int holder::name() const { \ | 5514 #define PSEUDO_SMI_HI_ALIGN kIntSize |
| 5518 int value = READ_INT_FIELD(this, offset); \ | 5515 #else |
| 5516 #define PSEUDO_SMI_LO_ALIGN kIntSize |
| 5517 #define PSEUDO_SMI_HI_ALIGN 0 |
| 5518 #endif |
| 5519 |
| 5520 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ |
| 5521 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_LO_ALIGN); \ |
| 5522 int holder::name() const { \ |
| 5523 int value = READ_INT_FIELD(this, offset); \ |
| 5519 DCHECK(kHeapObjectTag == 1); \ | 5524 DCHECK(kHeapObjectTag == 1); \ |
| 5520 DCHECK((value & kHeapObjectTag) == 0); \ | 5525 DCHECK((value & kHeapObjectTag) == 0); \ |
| 5521 return value >> 1; \ | 5526 return value >> 1; \ |
| 5522 } \ | 5527 } \ |
| 5523 void holder::set_##name(int value) { \ | 5528 void holder::set_##name(int value) { \ |
| 5524 DCHECK(kHeapObjectTag == 1); \ | 5529 DCHECK(kHeapObjectTag == 1); \ |
| 5525 DCHECK((value & 0xC0000000) == 0xC0000000 || \ | 5530 DCHECK((value & 0xC0000000) == 0xC0000000 || \ |
| 5526 (value & 0xC0000000) == 0x0); \ | 5531 (value & 0xC0000000) == 0x0); \ |
| 5527 WRITE_INT_FIELD(this, \ | 5532 WRITE_INT_FIELD(this, \ |
| 5528 offset, \ | 5533 offset, \ |
| 5529 (value << 1) & ~kHeapObjectTag); \ | 5534 (value << 1) & ~kHeapObjectTag); \ |
| 5530 } | 5535 } |
| 5531 | 5536 |
| 5532 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ | 5537 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ |
| 5533 STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \ | 5538 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_HI_ALIGN); \ |
| 5534 INT_ACCESSORS(holder, name, offset) | 5539 INT_ACCESSORS(holder, name, offset) |
| 5535 | 5540 |
| 5536 | 5541 |
| 5537 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) | 5542 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) |
| 5538 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5543 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
| 5539 formal_parameter_count, | 5544 formal_parameter_count, |
| 5540 kFormalParameterCountOffset) | 5545 kFormalParameterCountOffset) |
| 5541 | 5546 |
| 5542 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 5547 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
| 5543 expected_nof_properties, | 5548 expected_nof_properties, |
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7283 #undef READ_SHORT_FIELD | 7288 #undef READ_SHORT_FIELD |
| 7284 #undef WRITE_SHORT_FIELD | 7289 #undef WRITE_SHORT_FIELD |
| 7285 #undef READ_BYTE_FIELD | 7290 #undef READ_BYTE_FIELD |
| 7286 #undef WRITE_BYTE_FIELD | 7291 #undef WRITE_BYTE_FIELD |
| 7287 #undef NOBARRIER_READ_BYTE_FIELD | 7292 #undef NOBARRIER_READ_BYTE_FIELD |
| 7288 #undef NOBARRIER_WRITE_BYTE_FIELD | 7293 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7289 | 7294 |
| 7290 } } // namespace v8::internal | 7295 } } // namespace v8::internal |
| 7291 | 7296 |
| 7292 #endif // V8_OBJECTS_INL_H_ | 7297 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |