Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: src/objects-inl.h

Issue 1230753004: [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Avoid outputting junk data in BytecodeArray::Print() and ByteArray::Print(). Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 uint32_t seed_; 641 uint32_t seed_;
642 }; 642 };
643 643
644 644
645 bool Object::IsNumber() const { 645 bool Object::IsNumber() const {
646 return IsSmi() || IsHeapNumber(); 646 return IsSmi() || IsHeapNumber();
647 } 647 }
648 648
649 649
650 TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE) 650 TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE)
651 TYPE_CHECKER(BytecodeArray, BYTECODE_ARRAY_TYPE)
651 TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE) 652 TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
652 653
653 654
654 bool Object::IsFiller() const { 655 bool Object::IsFiller() const {
655 if (!Object::IsHeapObject()) return false; 656 if (!Object::IsHeapObject()) return false;
656 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type(); 657 InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
657 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE; 658 return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE;
658 } 659 }
659 660
660 661
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 } 2944 }
2944 2945
2945 2946
2946 // ------------------------------------ 2947 // ------------------------------------
2947 // Cast operations 2948 // Cast operations
2948 2949
2949 2950
2950 CAST_ACCESSOR(AccessorInfo) 2951 CAST_ACCESSOR(AccessorInfo)
2951 CAST_ACCESSOR(ArrayList) 2952 CAST_ACCESSOR(ArrayList)
2952 CAST_ACCESSOR(ByteArray) 2953 CAST_ACCESSOR(ByteArray)
2954 CAST_ACCESSOR(BytecodeArray)
2953 CAST_ACCESSOR(Cell) 2955 CAST_ACCESSOR(Cell)
2954 CAST_ACCESSOR(Code) 2956 CAST_ACCESSOR(Code)
2955 CAST_ACCESSOR(CodeCacheHashTable) 2957 CAST_ACCESSOR(CodeCacheHashTable)
2956 CAST_ACCESSOR(CompilationCacheTable) 2958 CAST_ACCESSOR(CompilationCacheTable)
2957 CAST_ACCESSOR(ConsString) 2959 CAST_ACCESSOR(ConsString)
2958 CAST_ACCESSOR(DeoptimizationInputData) 2960 CAST_ACCESSOR(DeoptimizationInputData)
2959 CAST_ACCESSOR(DeoptimizationOutputData) 2961 CAST_ACCESSOR(DeoptimizationOutputData)
2960 CAST_ACCESSOR(DependentCode) 2962 CAST_ACCESSOR(DependentCode)
2961 CAST_ACCESSOR(DescriptorArray) 2963 CAST_ACCESSOR(DescriptorArray)
2962 CAST_ACCESSOR(ExternalArray) 2964 CAST_ACCESSOR(ExternalArray)
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 DCHECK_TAG_ALIGNED(address); 3646 DCHECK_TAG_ALIGNED(address);
3645 return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag); 3647 return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag);
3646 } 3648 }
3647 3649
3648 3650
3649 Address ByteArray::GetDataStartAddress() { 3651 Address ByteArray::GetDataStartAddress() {
3650 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize; 3652 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
3651 } 3653 }
3652 3654
3653 3655
3656 int BytecodeArray::frame_size() {
3657 return READ_INT_FIELD(this, kFrameSizeOffset);
rmcilroy 2015/07/20 11:39:46 These should be stored as SMI values. Could you ju
oth 2015/07/20 13:47:30 Done.
3658 }
3659
3660
3661 void BytecodeArray::set_frame_size(int value) {
3662 WRITE_INT_FIELD(this, kFrameSizeOffset, value);
3663 }
3664
3665
3666 int BytecodeArray::number_of_locals() {
3667 return READ_INT_FIELD(this, kNumberOfLocalsOffset);
3668 }
3669
3670
3671 void BytecodeArray::set_number_of_locals(int value) {
3672 WRITE_INT_FIELD(this, kNumberOfLocalsOffset, value);
3673 }
3674
3675
3676 Address BytecodeArray::GetFirstBytecodeAddress() {
3677 return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
3678 }
3679
3680
3654 uint8_t* ExternalUint8ClampedArray::external_uint8_clamped_pointer() { 3681 uint8_t* ExternalUint8ClampedArray::external_uint8_clamped_pointer() {
3655 return reinterpret_cast<uint8_t*>(external_pointer()); 3682 return reinterpret_cast<uint8_t*>(external_pointer());
3656 } 3683 }
3657 3684
3658 3685
3659 uint8_t ExternalUint8ClampedArray::get_scalar(int index) { 3686 uint8_t ExternalUint8ClampedArray::get_scalar(int index) {
3660 DCHECK((index >= 0) && (index < this->length())); 3687 DCHECK((index >= 0) && (index < this->length()));
3661 uint8_t* ptr = external_uint8_clamped_pointer(); 3688 uint8_t* ptr = external_uint8_clamped_pointer();
3662 return ptr[index]; 3689 return ptr[index];
3663 } 3690 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 if (instance_type == ONE_BYTE_STRING_TYPE || 4146 if (instance_type == ONE_BYTE_STRING_TYPE ||
4120 instance_type == ONE_BYTE_INTERNALIZED_STRING_TYPE) { 4147 instance_type == ONE_BYTE_INTERNALIZED_STRING_TYPE) {
4121 // Strings may get concurrently truncated, hence we have to access its 4148 // Strings may get concurrently truncated, hence we have to access its
4122 // length synchronized. 4149 // length synchronized.
4123 return SeqOneByteString::SizeFor( 4150 return SeqOneByteString::SizeFor(
4124 reinterpret_cast<SeqOneByteString*>(this)->synchronized_length()); 4151 reinterpret_cast<SeqOneByteString*>(this)->synchronized_length());
4125 } 4152 }
4126 if (instance_type == BYTE_ARRAY_TYPE) { 4153 if (instance_type == BYTE_ARRAY_TYPE) {
4127 return reinterpret_cast<ByteArray*>(this)->ByteArraySize(); 4154 return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
4128 } 4155 }
4156 if (instance_type == BYTECODE_ARRAY_TYPE) {
4157 return reinterpret_cast<BytecodeArray*>(this)->BytecodeArraySize();
4158 }
4129 if (instance_type == FREE_SPACE_TYPE) { 4159 if (instance_type == FREE_SPACE_TYPE) {
4130 return reinterpret_cast<FreeSpace*>(this)->nobarrier_size(); 4160 return reinterpret_cast<FreeSpace*>(this)->nobarrier_size();
4131 } 4161 }
4132 if (instance_type == STRING_TYPE || 4162 if (instance_type == STRING_TYPE ||
4133 instance_type == INTERNALIZED_STRING_TYPE) { 4163 instance_type == INTERNALIZED_STRING_TYPE) {
4134 // Strings may get concurrently truncated, hence we have to access its 4164 // Strings may get concurrently truncated, hence we have to access its
4135 // length synchronized. 4165 // length synchronized.
4136 return SeqTwoByteString::SizeFor( 4166 return SeqTwoByteString::SizeFor(
4137 reinterpret_cast<SeqTwoByteString*>(this)->synchronized_length()); 4167 reinterpret_cast<SeqTwoByteString*>(this)->synchronized_length());
4138 } 4168 }
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
5183 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) 5213 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex)
5184 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) 5214 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex)
5185 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) 5215 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
5186 5216
5187 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) 5217 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
5188 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object, 5218 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object,
5189 kOptimizedCodeMapOffset) 5219 kOptimizedCodeMapOffset)
5190 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 5220 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
5191 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, 5221 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector,
5192 kFeedbackVectorOffset) 5222 kFeedbackVectorOffset)
5223 ACCESSORS(SharedFunctionInfo, bytecode_array, BytecodeArray,
5224 kBytecodeArrayOffset)
5193 #if TRACE_MAPS 5225 #if TRACE_MAPS
5194 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) 5226 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset)
5195 #endif 5227 #endif
5196 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, 5228 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
5197 kInstanceClassNameOffset) 5229 kInstanceClassNameOffset)
5198 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) 5230 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
5199 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) 5231 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
5200 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) 5232 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
5201 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) 5233 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
5202 5234
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after
7314 #undef READ_SHORT_FIELD 7346 #undef READ_SHORT_FIELD
7315 #undef WRITE_SHORT_FIELD 7347 #undef WRITE_SHORT_FIELD
7316 #undef READ_BYTE_FIELD 7348 #undef READ_BYTE_FIELD
7317 #undef WRITE_BYTE_FIELD 7349 #undef WRITE_BYTE_FIELD
7318 #undef NOBARRIER_READ_BYTE_FIELD 7350 #undef NOBARRIER_READ_BYTE_FIELD
7319 #undef NOBARRIER_WRITE_BYTE_FIELD 7351 #undef NOBARRIER_WRITE_BYTE_FIELD
7320 7352
7321 } } // namespace v8::internal 7353 } } // namespace v8::internal
7322 7354
7323 #endif // V8_OBJECTS_INL_H_ 7355 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698