| 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 5111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5122 bool Code::is_keyed_stub() { | 5122 bool Code::is_keyed_stub() { |
| 5123 return is_keyed_load_stub() || is_keyed_store_stub(); | 5123 return is_keyed_load_stub() || is_keyed_store_stub(); |
| 5124 } | 5124 } |
| 5125 | 5125 |
| 5126 | 5126 |
| 5127 bool Code::is_debug_stub() { | 5127 bool Code::is_debug_stub() { |
| 5128 return ic_state() == DEBUG_STUB; | 5128 return ic_state() == DEBUG_STUB; |
| 5129 } | 5129 } |
| 5130 | 5130 |
| 5131 | 5131 |
| 5132 ConstantPoolArray* Code::constant_pool() { | 5132 Address Code::constant_pool() { |
| 5133 return ConstantPoolArray::cast(READ_FIELD(this, kConstantPoolOffset)); | 5133 Address constant_pool = NULL; |
| 5134 if (FLAG_enable_ool_constant_pool) { |
| 5135 constant_pool = |
| 5136 reinterpret_cast<Address>(READ_FIELD(this, kConstantPoolOffset)); |
| 5137 } else if (FLAG_enable_embedded_constant_pool) { |
| 5138 int offset = constant_pool_offset(); |
| 5139 if (offset < instruction_size()) { |
| 5140 constant_pool = FIELD_ADDR(this, kHeaderSize + offset); |
| 5141 } |
| 5142 } |
| 5143 return constant_pool; |
| 5134 } | 5144 } |
| 5135 | 5145 |
| 5136 | 5146 |
| 5137 void Code::set_constant_pool(Object* value) { | 5147 void Code::set_constant_pool(Object* value) { |
| 5148 DCHECK(FLAG_enable_ool_constant_pool); |
| 5138 DCHECK(value->IsConstantPoolArray()); | 5149 DCHECK(value->IsConstantPoolArray()); |
| 5139 WRITE_FIELD(this, kConstantPoolOffset, value); | 5150 WRITE_FIELD(this, kConstantPoolOffset, value); |
| 5140 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); | 5151 WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value); |
| 5141 } | 5152 } |
| 5142 | 5153 |
| 5143 | 5154 |
| 5144 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, | 5155 Code::Flags Code::ComputeFlags(Kind kind, InlineCacheState ic_state, |
| 5145 ExtraICState extra_ic_state, StubType type, | 5156 ExtraICState extra_ic_state, StubType type, |
| 5146 CacheHolderFlag holder) { | 5157 CacheHolderFlag holder) { |
| 5147 // Compute the bit mask. | 5158 // Compute the bit mask. |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6286 ACCESSORS(JSMessageObject, type, String, kTypeOffset) | 6297 ACCESSORS(JSMessageObject, type, String, kTypeOffset) |
| 6287 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset) | 6298 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset) |
| 6288 ACCESSORS(JSMessageObject, script, Object, kScriptOffset) | 6299 ACCESSORS(JSMessageObject, script, Object, kScriptOffset) |
| 6289 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) | 6300 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) |
| 6290 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) | 6301 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) |
| 6291 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) | 6302 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) |
| 6292 | 6303 |
| 6293 | 6304 |
| 6294 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 6305 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 6295 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 6306 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
| 6307 INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) |
| 6296 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 6308 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 6297 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 6309 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
| 6298 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 6310 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 6299 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 6311 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
| 6300 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset) | 6312 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset) |
| 6301 | 6313 |
| 6302 | 6314 |
| 6303 void Code::WipeOutHeader() { | 6315 void Code::WipeOutHeader() { |
| 6304 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 6316 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
| 6305 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 6317 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
| 6306 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 6318 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
| 6307 WRITE_FIELD(this, kConstantPoolOffset, NULL); | 6319 if (FLAG_enable_ool_constant_pool) { |
| 6320 WRITE_FIELD(this, kConstantPoolOffset, NULL); |
| 6321 } |
| 6308 // Do not wipe out major/minor keys on a code stub or IC | 6322 // Do not wipe out major/minor keys on a code stub or IC |
| 6309 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { | 6323 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
| 6310 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); | 6324 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); |
| 6311 } | 6325 } |
| 6312 } | 6326 } |
| 6313 | 6327 |
| 6314 | 6328 |
| 6315 Object* Code::type_feedback_info() { | 6329 Object* Code::type_feedback_info() { |
| 6316 DCHECK(kind() == FUNCTION); | 6330 DCHECK(kind() == FUNCTION); |
| 6317 return raw_type_feedback_info(); | 6331 return raw_type_feedback_info(); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6811 | 6825 |
| 6812 | 6826 |
| 6813 void String::SetForwardedInternalizedString(String* canonical) { | 6827 void String::SetForwardedInternalizedString(String* canonical) { |
| 6814 DCHECK(IsInternalizedString()); | 6828 DCHECK(IsInternalizedString()); |
| 6815 DCHECK(HasHashCode()); | 6829 DCHECK(HasHashCode()); |
| 6816 if (canonical == this) return; // No need to forward. | 6830 if (canonical == this) return; // No need to forward. |
| 6817 DCHECK(SlowEquals(canonical)); | 6831 DCHECK(SlowEquals(canonical)); |
| 6818 DCHECK(canonical->IsInternalizedString()); | 6832 DCHECK(canonical->IsInternalizedString()); |
| 6819 DCHECK(canonical->HasHashCode()); | 6833 DCHECK(canonical->HasHashCode()); |
| 6820 WRITE_FIELD(this, kHashFieldSlot, canonical); | 6834 WRITE_FIELD(this, kHashFieldSlot, canonical); |
| 6835 |
| 6821 // Setting the hash field to a tagged value sets the LSB, causing the hash | 6836 // Setting the hash field to a tagged value sets the LSB, causing the hash |
| 6822 // code to be interpreted as uninitialized. We use this fact to recognize | 6837 // code to be interpreted as uninitialized. We use this fact to recognize |
| 6823 // that we have a forwarded string. | 6838 // that we have a forwarded string. |
| 6824 DCHECK(!HasHashCode()); | 6839 DCHECK(!HasHashCode()); |
| 6825 } | 6840 } |
| 6826 | 6841 |
| 6827 | 6842 |
| 6828 String* String::GetForwardedInternalizedString() { | 6843 String* String::GetForwardedInternalizedString() { |
| 6829 DCHECK(IsInternalizedString()); | 6844 DCHECK(IsInternalizedString()); |
| 6830 if (HasHashCode()) return this; | 6845 if (HasHashCode()) return this; |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7510 #undef READ_SHORT_FIELD | 7525 #undef READ_SHORT_FIELD |
| 7511 #undef WRITE_SHORT_FIELD | 7526 #undef WRITE_SHORT_FIELD |
| 7512 #undef READ_BYTE_FIELD | 7527 #undef READ_BYTE_FIELD |
| 7513 #undef WRITE_BYTE_FIELD | 7528 #undef WRITE_BYTE_FIELD |
| 7514 #undef NOBARRIER_READ_BYTE_FIELD | 7529 #undef NOBARRIER_READ_BYTE_FIELD |
| 7515 #undef NOBARRIER_WRITE_BYTE_FIELD | 7530 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7516 | 7531 |
| 7517 } } // namespace v8::internal | 7532 } } // namespace v8::internal |
| 7518 | 7533 |
| 7519 #endif // V8_OBJECTS_INL_H_ | 7534 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |