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

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

Issue 2063013004: [wasm] Disassemble wasm code from script (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-frame-inspection
Patch Set: address comments Created 4 years, 6 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const type* type::cast(const Object* object) { \ 71 const type* type::cast(const Object* object) { \
72 SLOW_DCHECK(object->Is##type()); \ 72 SLOW_DCHECK(object->Is##type()); \
73 return reinterpret_cast<const type*>(object); \ 73 return reinterpret_cast<const type*>(object); \
74 } 74 }
75 75
76 76
77 #define INT_ACCESSORS(holder, name, offset) \ 77 #define INT_ACCESSORS(holder, name, offset) \
78 int holder::name() const { return READ_INT_FIELD(this, offset); } \ 78 int holder::name() const { return READ_INT_FIELD(this, offset); } \
79 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } 79 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); }
80 80
81 81 #define ACCESSORS_CHECKED(holder, name, type, offset, condition) \
82 #define ACCESSORS(holder, name, type, offset) \ 82 type* holder::name() const { \
83 type* holder::name() const { return type::cast(READ_FIELD(this, offset)); } \ 83 DCHECK(condition); \
84 void holder::set_##name(type* value, WriteBarrierMode mode) { \ 84 return type::cast(READ_FIELD(this, offset)); \
85 WRITE_FIELD(this, offset, value); \ 85 } \
86 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ 86 void holder::set_##name(type* value, WriteBarrierMode mode) { \
87 DCHECK(condition); \
88 WRITE_FIELD(this, offset, value); \
89 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \
87 } 90 }
88 91
92 #define ACCESSORS(holder, name, type, offset) \
93 ACCESSORS_CHECKED(holder, name, type, offset, true)
89 94
90 // Getter that returns a Smi as an int and writes an int as a Smi. 95 // Getter that returns a Smi as an int and writes an int as a Smi.
91 #define SMI_ACCESSORS(holder, name, offset) \ 96 #define SMI_ACCESSORS_CHECKED(holder, name, offset, condition) \
92 int holder::name() const { \ 97 int holder::name() const { \
93 Object* value = READ_FIELD(this, offset); \ 98 DCHECK(condition); \
94 return Smi::cast(value)->value(); \ 99 Object* value = READ_FIELD(this, offset); \
95 } \ 100 return Smi::cast(value)->value(); \
96 void holder::set_##name(int value) { \ 101 } \
97 WRITE_FIELD(this, offset, Smi::FromInt(value)); \ 102 void holder::set_##name(int value) { \
103 DCHECK(condition); \
104 WRITE_FIELD(this, offset, Smi::FromInt(value)); \
98 } 105 }
99 106
107 #define SMI_ACCESSORS(holder, name, offset) \
108 SMI_ACCESSORS_CHECKED(holder, name, offset, true)
109
100 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \ 110 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \
101 int holder::synchronized_##name() const { \ 111 int holder::synchronized_##name() const { \
102 Object* value = ACQUIRE_READ_FIELD(this, offset); \ 112 Object* value = ACQUIRE_READ_FIELD(this, offset); \
103 return Smi::cast(value)->value(); \ 113 return Smi::cast(value)->value(); \
104 } \ 114 } \
105 void holder::synchronized_set_##name(int value) { \ 115 void holder::synchronized_set_##name(int value) { \
106 RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \ 116 RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
107 } 117 }
108 118
109 #define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \ 119 #define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \
(...skipping 5450 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 5570
5561 ACCESSORS(Script, source, Object, kSourceOffset) 5571 ACCESSORS(Script, source, Object, kSourceOffset)
5562 ACCESSORS(Script, name, Object, kNameOffset) 5572 ACCESSORS(Script, name, Object, kNameOffset)
5563 SMI_ACCESSORS(Script, id, kIdOffset) 5573 SMI_ACCESSORS(Script, id, kIdOffset)
5564 SMI_ACCESSORS(Script, line_offset, kLineOffsetOffset) 5574 SMI_ACCESSORS(Script, line_offset, kLineOffsetOffset)
5565 SMI_ACCESSORS(Script, column_offset, kColumnOffsetOffset) 5575 SMI_ACCESSORS(Script, column_offset, kColumnOffsetOffset)
5566 ACCESSORS(Script, context_data, Object, kContextOffset) 5576 ACCESSORS(Script, context_data, Object, kContextOffset)
5567 ACCESSORS(Script, wrapper, HeapObject, kWrapperOffset) 5577 ACCESSORS(Script, wrapper, HeapObject, kWrapperOffset)
5568 SMI_ACCESSORS(Script, type, kTypeOffset) 5578 SMI_ACCESSORS(Script, type, kTypeOffset)
5569 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) 5579 ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
5570 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) 5580 ACCESSORS_CHECKED(Script, eval_from_shared, Object, kEvalFromSharedOffset,
5571 SMI_ACCESSORS(Script, eval_from_position, kEvalFromPositionOffset) 5581 this->type() != TYPE_WASM)
5582 SMI_ACCESSORS_CHECKED(Script, eval_from_position, kEvalFromPositionOffset,
5583 this->type() != TYPE_WASM)
Yang 2016/06/17 18:16:31 we should be able to assert here that compilation
Clemens Hammacher 2016/06/24 15:12:33 Nope, it already fails in mksnapshot. I'll leave i
Clemens Hammacher 2016/06/24 15:45:44 Short follow-up: The check fails since the check i
5572 ACCESSORS(Script, shared_function_infos, Object, kSharedFunctionInfosOffset) 5584 ACCESSORS(Script, shared_function_infos, Object, kSharedFunctionInfosOffset)
5573 SMI_ACCESSORS(Script, flags, kFlagsOffset) 5585 SMI_ACCESSORS(Script, flags, kFlagsOffset)
5574 ACCESSORS(Script, source_url, Object, kSourceUrlOffset) 5586 ACCESSORS(Script, source_url, Object, kSourceUrlOffset)
5575 ACCESSORS(Script, source_mapping_url, Object, kSourceMappingUrlOffset) 5587 ACCESSORS(Script, source_mapping_url, Object, kSourceMappingUrlOffset)
5588 ACCESSORS_CHECKED(Script, wasm_object, JSObject, kEvalFromSharedOffset,
5589 this->type() == TYPE_WASM)
5590 SMI_ACCESSORS_CHECKED(Script, wasm_function_index, kEvalFromPositionOffset,
5591 this->type() == TYPE_WASM)
5576 5592
5577 Script::CompilationType Script::compilation_type() { 5593 Script::CompilationType Script::compilation_type() {
5578 return BooleanBit::get(flags(), kCompilationTypeBit) ? 5594 return BooleanBit::get(flags(), kCompilationTypeBit) ?
5579 COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST; 5595 COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST;
5580 } 5596 }
5581 void Script::set_compilation_type(CompilationType type) { 5597 void Script::set_compilation_type(CompilationType type) {
5582 set_flags(BooleanBit::set(flags(), kCompilationTypeBit, 5598 set_flags(BooleanBit::set(flags(), kCompilationTypeBit,
5583 type == COMPILATION_TYPE_EVAL)); 5599 type == COMPILATION_TYPE_EVAL));
5584 } 5600 }
5585 bool Script::hide_source() { return BooleanBit::get(flags(), kHideSourceBit); } 5601 bool Script::hide_source() { return BooleanBit::get(flags(), kHideSourceBit); }
(...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after
7909 #undef WRITE_INT64_FIELD 7925 #undef WRITE_INT64_FIELD
7910 #undef READ_BYTE_FIELD 7926 #undef READ_BYTE_FIELD
7911 #undef WRITE_BYTE_FIELD 7927 #undef WRITE_BYTE_FIELD
7912 #undef NOBARRIER_READ_BYTE_FIELD 7928 #undef NOBARRIER_READ_BYTE_FIELD
7913 #undef NOBARRIER_WRITE_BYTE_FIELD 7929 #undef NOBARRIER_WRITE_BYTE_FIELD
7914 7930
7915 } // namespace internal 7931 } // namespace internal
7916 } // namespace v8 7932 } // namespace v8
7917 7933
7918 #endif // V8_OBJECTS_INL_H_ 7934 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/debug/debug.js ('K') | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698