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 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 SMI_ACCESSORS(String, length, kLengthOffset) | 3320 SMI_ACCESSORS(String, length, kLengthOffset) |
3321 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) | 3321 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) |
3322 | 3322 |
3323 | 3323 |
3324 uint32_t Name::hash_field() { | 3324 uint32_t Name::hash_field() { |
3325 return READ_UINT32_FIELD(this, kHashFieldOffset); | 3325 return READ_UINT32_FIELD(this, kHashFieldOffset); |
3326 } | 3326 } |
3327 | 3327 |
3328 | 3328 |
3329 void Name::set_hash_field(uint32_t value) { | 3329 void Name::set_hash_field(uint32_t value) { |
3330 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); | 3330 WRITE_INTPTR_FIELD(this, kHashFieldSlot, value); |
3331 #if V8_HOST_ARCH_64_BIT | |
3332 WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0); | |
3333 #endif | |
3334 } | 3331 } |
3335 | 3332 |
3336 | 3333 |
3337 bool Name::Equals(Name* other) { | 3334 bool Name::Equals(Name* other) { |
3338 if (other == this) return true; | 3335 if (other == this) return true; |
3339 if ((this->IsInternalizedString() && other->IsInternalizedString()) || | 3336 if ((this->IsInternalizedString() && other->IsInternalizedString()) || |
3340 this->IsSymbol() || other->IsSymbol()) { | 3337 this->IsSymbol() || other->IsSymbol()) { |
3341 return false; | 3338 return false; |
3342 } | 3339 } |
3343 return String::cast(this)->SlowEquals(String::cast(other)); | 3340 return String::cast(this)->SlowEquals(String::cast(other)); |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5491 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5488 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, |
5492 kCompilerHintsOffset) | 5489 kCompilerHintsOffset) |
5493 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, | 5490 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, |
5494 kOptCountAndBailoutReasonOffset) | 5491 kOptCountAndBailoutReasonOffset) |
5495 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) | 5492 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) |
5496 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) | 5493 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) |
5497 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) | 5494 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) |
5498 | 5495 |
5499 #else | 5496 #else |
5500 | 5497 |
5501 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ | 5498 #if V8_TARGET_LITTLE_ENDIAN |
5502 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ | 5499 #define PSEUDO_SMI_LO_ALIGN 0 |
5503 int holder::name() const { \ | 5500 #define PSEUDO_SMI_HI_ALIGN kIntSize |
5504 int value = READ_INT_FIELD(this, offset); \ | 5501 #else |
5505 DCHECK(kHeapObjectTag == 1); \ | 5502 #define PSEUDO_SMI_LO_ALIGN kIntSize |
5506 DCHECK((value & kHeapObjectTag) == 0); \ | 5503 #define PSEUDO_SMI_HI_ALIGN 0 |
5507 return value >> 1; \ | 5504 #endif |
5508 } \ | 5505 |
5509 void holder::set_##name(int value) { \ | 5506 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ |
5510 DCHECK(kHeapObjectTag == 1); \ | 5507 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_LO_ALIGN); \ |
5511 DCHECK((value & 0xC0000000) == 0xC0000000 || \ | 5508 int holder::name() const { \ |
5512 (value & 0xC0000000) == 0x0); \ | 5509 int value = READ_INT_FIELD(this, offset); \ |
5513 WRITE_INT_FIELD(this, \ | 5510 DCHECK(kHeapObjectTag == 1); \ |
5514 offset, \ | 5511 DCHECK((value & kHeapObjectTag) == 0); \ |
5515 (value << 1) & ~kHeapObjectTag); \ | 5512 return value >> 1; \ |
| 5513 } \ |
| 5514 void holder::set_##name(int value) { \ |
| 5515 DCHECK(kHeapObjectTag == 1); \ |
| 5516 DCHECK((value & 0xC0000000) == 0xC0000000 || (value & 0xC0000000) == 0x0); \ |
| 5517 WRITE_INT_FIELD(this, offset, (value << 1) & ~kHeapObjectTag); \ |
5516 } | 5518 } |
5517 | 5519 |
5518 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ | 5520 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ |
5519 STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \ | 5521 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_HI_ALIGN); \ |
5520 INT_ACCESSORS(holder, name, offset) | 5522 INT_ACCESSORS(holder, name, offset) |
5521 | 5523 |
5522 | 5524 |
5523 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) | 5525 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) |
5524 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5526 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
5525 formal_parameter_count, | 5527 formal_parameter_count, |
5526 kFormalParameterCountOffset) | 5528 kFormalParameterCountOffset) |
5527 | 5529 |
5528 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 5530 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
5529 expected_nof_properties, | 5531 expected_nof_properties, |
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7269 #undef READ_SHORT_FIELD | 7271 #undef READ_SHORT_FIELD |
7270 #undef WRITE_SHORT_FIELD | 7272 #undef WRITE_SHORT_FIELD |
7271 #undef READ_BYTE_FIELD | 7273 #undef READ_BYTE_FIELD |
7272 #undef WRITE_BYTE_FIELD | 7274 #undef WRITE_BYTE_FIELD |
7273 #undef NOBARRIER_READ_BYTE_FIELD | 7275 #undef NOBARRIER_READ_BYTE_FIELD |
7274 #undef NOBARRIER_WRITE_BYTE_FIELD | 7276 #undef NOBARRIER_WRITE_BYTE_FIELD |
7275 | 7277 |
7276 } } // namespace v8::internal | 7278 } } // namespace v8::internal |
7277 | 7279 |
7278 #endif // V8_OBJECTS_INL_H_ | 7280 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |