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

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

Issue 1618343002: [interpreter, debugger] abstraction for source position calculation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) 840 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE)
841 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE) 841 TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE)
842 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) 842 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE)
843 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) 843 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE)
844 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) 844 TYPE_CHECKER(JSModule, JS_MODULE_TYPE)
845 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) 845 TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
846 TYPE_CHECKER(JSDate, JS_DATE_TYPE) 846 TYPE_CHECKER(JSDate, JS_DATE_TYPE)
847 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) 847 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE)
848 848
849 849
850 bool Object::IsAbstractCode() const { return IsBytecodeArray() || IsCode(); }
851
852
850 bool Object::IsStringWrapper() const { 853 bool Object::IsStringWrapper() const {
851 return IsJSValue() && JSValue::cast(this)->value()->IsString(); 854 return IsJSValue() && JSValue::cast(this)->value()->IsString();
852 } 855 }
853 856
854 857
855 TYPE_CHECKER(Foreign, FOREIGN_TYPE) 858 TYPE_CHECKER(Foreign, FOREIGN_TYPE)
856 859
857 860
858 bool Object::IsBoolean() const { 861 bool Object::IsBoolean() const {
859 return IsOddball() && 862 return IsOddball() &&
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3171 3174
3172 void SeededNumberDictionary::set_requires_slow_elements() { 3175 void SeededNumberDictionary::set_requires_slow_elements() {
3173 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask)); 3176 set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
3174 } 3177 }
3175 3178
3176 3179
3177 // ------------------------------------ 3180 // ------------------------------------
3178 // Cast operations 3181 // Cast operations
3179 3182
3180 3183
3184 CAST_ACCESSOR(AbstractCode)
3181 CAST_ACCESSOR(ArrayList) 3185 CAST_ACCESSOR(ArrayList)
3182 CAST_ACCESSOR(Bool16x8) 3186 CAST_ACCESSOR(Bool16x8)
3183 CAST_ACCESSOR(Bool32x4) 3187 CAST_ACCESSOR(Bool32x4)
3184 CAST_ACCESSOR(Bool8x16) 3188 CAST_ACCESSOR(Bool8x16)
3185 CAST_ACCESSOR(ByteArray) 3189 CAST_ACCESSOR(ByteArray)
3186 CAST_ACCESSOR(BytecodeArray) 3190 CAST_ACCESSOR(BytecodeArray)
3187 CAST_ACCESSOR(Cell) 3191 CAST_ACCESSOR(Cell)
3188 CAST_ACCESSOR(Code) 3192 CAST_ACCESSOR(Code)
3189 CAST_ACCESSOR(CodeCacheHashTable) 3193 CAST_ACCESSOR(CodeCacheHashTable)
3190 CAST_ACCESSOR(CompilationCacheTable) 3194 CAST_ACCESSOR(CompilationCacheTable)
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after
5271 } 5275 }
5272 private: 5276 private:
5273 static const int kMaxCount = 4; 5277 static const int kMaxCount = 4;
5274 int count_; 5278 int count_;
5275 Handle<Map> find_[kMaxCount]; 5279 Handle<Map> find_[kMaxCount];
5276 Handle<Object> replace_[kMaxCount]; 5280 Handle<Object> replace_[kMaxCount];
5277 friend class Code; 5281 friend class Code;
5278 }; 5282 };
5279 5283
5280 5284
5285 Code* AbstractCode::GetCode() { return Code::cast(this); }
5286 BytecodeArray* AbstractCode::GetBytecodeArray() {
5287 return BytecodeArray::cast(this);
5288 }
5289
5290
5281 Object* Map::prototype() const { 5291 Object* Map::prototype() const {
5282 return READ_FIELD(this, kPrototypeOffset); 5292 return READ_FIELD(this, kPrototypeOffset);
5283 } 5293 }
5284 5294
5285 5295
5286 void Map::set_prototype(Object* value, WriteBarrierMode mode) { 5296 void Map::set_prototype(Object* value, WriteBarrierMode mode) {
5287 DCHECK(value->IsNull() || value->IsJSReceiver()); 5297 DCHECK(value->IsNull() || value->IsJSReceiver());
5288 WRITE_FIELD(this, kPrototypeOffset, value); 5298 WRITE_FIELD(this, kPrototypeOffset, value);
5289 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); 5299 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode);
5290 } 5300 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
5599 DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1))); 5609 DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1)));
5600 set_flags((flags() & ~kOriginOptionsMask) | 5610 set_flags((flags() & ~kOriginOptionsMask) |
5601 (origin_options.Flags() << kOriginOptionsShift)); 5611 (origin_options.Flags() << kOriginOptionsShift));
5602 } 5612 }
5603 5613
5604 5614
5605 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) 5615 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
5606 ACCESSORS(DebugInfo, code, Code, kCodeIndex) 5616 ACCESSORS(DebugInfo, code, Code, kCodeIndex)
5607 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) 5617 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
5608 5618
5609 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) 5619 SMI_ACCESSORS(BreakPointInfo, code_offset, kCodeOffsetIndex)
5610 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) 5620 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex)
5611 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) 5621 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex)
5612 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) 5622 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
5613 5623
5614 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) 5624 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
5615 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, 5625 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray,
5616 kOptimizedCodeMapOffset) 5626 kOptimizedCodeMapOffset)
5617 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 5627 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
5618 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, 5628 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector,
5619 kFeedbackVectorOffset) 5629 kFeedbackVectorOffset)
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
5854 set_start_position_and_type((start_position << kStartPositionShift) 5864 set_start_position_and_type((start_position << kStartPositionShift)
5855 | (start_position_and_type() & ~kStartPositionMask)); 5865 | (start_position_and_type() & ~kStartPositionMask));
5856 } 5866 }
5857 5867
5858 5868
5859 Code* SharedFunctionInfo::code() const { 5869 Code* SharedFunctionInfo::code() const {
5860 return Code::cast(READ_FIELD(this, kCodeOffset)); 5870 return Code::cast(READ_FIELD(this, kCodeOffset));
5861 } 5871 }
5862 5872
5863 5873
5874 AbstractCode* SharedFunctionInfo::AbstractCode() {
5875 if (HasBytecodeArray()) return AbstractCode::cast(bytecode_array());
5876 return AbstractCode::cast(code());
5877 }
5878
5879
5864 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { 5880 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) {
5865 DCHECK(value->kind() != Code::OPTIMIZED_FUNCTION); 5881 DCHECK(value->kind() != Code::OPTIMIZED_FUNCTION);
5866 WRITE_FIELD(this, kCodeOffset, value); 5882 WRITE_FIELD(this, kCodeOffset, value);
5867 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); 5883 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode);
5868 } 5884 }
5869 5885
5870 5886
5871 void SharedFunctionInfo::ReplaceCode(Code* value) { 5887 void SharedFunctionInfo::ReplaceCode(Code* value) {
5872 // If the GC metadata field is already used then the function was 5888 // If the GC metadata field is already used then the function was
5873 // enqueued as a code flushing candidate and we remove it now. 5889 // enqueued as a code flushing candidate and we remove it now.
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
7812 #undef WRITE_INT64_FIELD 7828 #undef WRITE_INT64_FIELD
7813 #undef READ_BYTE_FIELD 7829 #undef READ_BYTE_FIELD
7814 #undef WRITE_BYTE_FIELD 7830 #undef WRITE_BYTE_FIELD
7815 #undef NOBARRIER_READ_BYTE_FIELD 7831 #undef NOBARRIER_READ_BYTE_FIELD
7816 #undef NOBARRIER_WRITE_BYTE_FIELD 7832 #undef NOBARRIER_WRITE_BYTE_FIELD
7817 7833
7818 } // namespace internal 7834 } // namespace internal
7819 } // namespace v8 7835 } // namespace v8
7820 7836
7821 #endif // V8_OBJECTS_INL_H_ 7837 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.cc ('K') | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698