Chromium Code Reviews| 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 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3288 SMI_ACCESSORS(String, length, kLengthOffset) | 3288 SMI_ACCESSORS(String, length, kLengthOffset) |
| 3289 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) | 3289 SYNCHRONIZED_SMI_ACCESSORS(String, length, kLengthOffset) |
| 3290 | 3290 |
| 3291 | 3291 |
| 3292 uint32_t Name::hash_field() { | 3292 uint32_t Name::hash_field() { |
| 3293 return READ_UINT32_FIELD(this, kHashFieldOffset); | 3293 return READ_UINT32_FIELD(this, kHashFieldOffset); |
| 3294 } | 3294 } |
| 3295 | 3295 |
| 3296 | 3296 |
| 3297 void Name::set_hash_field(uint32_t value) { | 3297 void Name::set_hash_field(uint32_t value) { |
| 3298 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); | 3298 WRITE_INTPTR_FIELD(this, kHashFieldSlot, value); |
|
Sven Panne
2014/09/16 10:48:40
Hmmm, this is a bit brittle for 2 reasons: Writing
andrew_low
2014/09/22 17:49:17
Changed to still use kHashFieldSlot to reference t
| |
| 3299 #if V8_HOST_ARCH_64_BIT | |
| 3300 WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0); | |
| 3301 #endif | |
| 3302 } | 3299 } |
| 3303 | 3300 |
| 3304 | 3301 |
| 3305 bool Name::Equals(Name* other) { | 3302 bool Name::Equals(Name* other) { |
| 3306 if (other == this) return true; | 3303 if (other == this) return true; |
| 3307 if ((this->IsInternalizedString() && other->IsInternalizedString()) || | 3304 if ((this->IsInternalizedString() && other->IsInternalizedString()) || |
| 3308 this->IsSymbol() || other->IsSymbol()) { | 3305 this->IsSymbol() || other->IsSymbol()) { |
| 3309 return false; | 3306 return false; |
| 3310 } | 3307 } |
| 3311 return String::cast(this)->SlowEquals(String::cast(other)); | 3308 return String::cast(this)->SlowEquals(String::cast(other)); |
| (...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5460 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5457 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 5461 kCompilerHintsOffset) | 5458 kCompilerHintsOffset) |
| 5462 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, | 5459 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, |
| 5463 kOptCountAndBailoutReasonOffset) | 5460 kOptCountAndBailoutReasonOffset) |
| 5464 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) | 5461 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) |
| 5465 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) | 5462 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) |
| 5466 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) | 5463 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset) |
| 5467 | 5464 |
| 5468 #else | 5465 #else |
| 5469 | 5466 |
| 5470 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ | 5467 #if V8_TARGET_LITTLE_ENDIAN |
| 5471 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ | 5468 #define PSEUDO_SMI_LO_ALIGN 0 |
| 5472 int holder::name() const { \ | 5469 #define PSEUDO_SMI_HI_ALIGN kIntSize |
| 5473 int value = READ_INT_FIELD(this, offset); \ | 5470 #else |
| 5474 DCHECK(kHeapObjectTag == 1); \ | 5471 #define PSEUDO_SMI_LO_ALIGN kIntSize |
| 5475 DCHECK((value & kHeapObjectTag) == 0); \ | 5472 #define PSEUDO_SMI_HI_ALIGN 0 |
| 5476 return value >> 1; \ | 5473 #endif |
| 5477 } \ | 5474 |
| 5478 void holder::set_##name(int value) { \ | 5475 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ |
| 5479 DCHECK(kHeapObjectTag == 1); \ | 5476 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_LO_ALIGN); \ |
| 5480 DCHECK((value & 0xC0000000) == 0xC0000000 || \ | 5477 int holder::name() const { \ |
| 5481 (value & 0xC0000000) == 0x0); \ | 5478 int value = READ_INT_FIELD(this, offset); \ |
| 5482 WRITE_INT_FIELD(this, \ | 5479 DCHECK(kHeapObjectTag == 1); \ |
| 5483 offset, \ | 5480 DCHECK((value & kHeapObjectTag) == 0); \ |
| 5484 (value << 1) & ~kHeapObjectTag); \ | 5481 return value >> 1; \ |
| 5482 } \ | |
| 5483 void holder::set_##name(int value) { \ | |
| 5484 DCHECK(kHeapObjectTag == 1); \ | |
| 5485 DCHECK((value & 0xC0000000) == 0xC0000000 || (value & 0xC0000000) == 0x0); \ | |
| 5486 WRITE_INT_FIELD(this, offset, (value << 1) & ~kHeapObjectTag); \ | |
| 5485 } | 5487 } |
| 5486 | 5488 |
| 5487 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ | 5489 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ |
| 5488 STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \ | 5490 STATIC_ASSERT(holder::offset % kPointerSize == PSEUDO_SMI_HI_ALIGN); \ |
| 5489 INT_ACCESSORS(holder, name, offset) | 5491 INT_ACCESSORS(holder, name, offset) |
| 5490 | 5492 |
| 5491 | 5493 |
| 5492 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) | 5494 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) |
| 5493 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 5495 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
| 5494 formal_parameter_count, | 5496 formal_parameter_count, |
| 5495 kFormalParameterCountOffset) | 5497 kFormalParameterCountOffset) |
| 5496 | 5498 |
| 5497 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 5499 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
| 5498 expected_nof_properties, | 5500 expected_nof_properties, |
| (...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7263 #undef READ_SHORT_FIELD | 7265 #undef READ_SHORT_FIELD |
| 7264 #undef WRITE_SHORT_FIELD | 7266 #undef WRITE_SHORT_FIELD |
| 7265 #undef READ_BYTE_FIELD | 7267 #undef READ_BYTE_FIELD |
| 7266 #undef WRITE_BYTE_FIELD | 7268 #undef WRITE_BYTE_FIELD |
| 7267 #undef NOBARRIER_READ_BYTE_FIELD | 7269 #undef NOBARRIER_READ_BYTE_FIELD |
| 7268 #undef NOBARRIER_WRITE_BYTE_FIELD | 7270 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7269 | 7271 |
| 7270 } } // namespace v8::internal | 7272 } } // namespace v8::internal |
| 7271 | 7273 |
| 7272 #endif // V8_OBJECTS_INL_H_ | 7274 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |