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

Unified Diff: runtime/vm/object.h

Issue 2326483005: Shrink AOT snapshot size and memory usage. (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index b502dfcd3558f8c4d33e5a19a39bdbc8c12f8267..6697e5c55b39e2d4718c7f89b5c995b98394e73b 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1886,7 +1886,12 @@ class ICData : public Object {
intptr_t NumArgsTested() const;
intptr_t deopt_id() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return -1;
+#else
return raw_ptr()->deopt_id_;
+#endif
}
bool IsImmutable() const;
@@ -2307,7 +2312,13 @@ class Function : public Object {
return raw_ptr()->code_;
}
- RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; }
+ RawCode* unoptimized_code() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return static_cast<RawCode*>(Object::null());
+#else
+ return raw_ptr()->unoptimized_code_;
+#endif
+ }
void set_unoptimized_code(const Code& value) const;
bool HasCode() const;
@@ -2441,12 +2452,28 @@ class Function : public Object {
}
bool IsInFactoryScope() const;
- TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
+ TokenPosition token_pos() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return TokenPosition();
+#else
+ return raw_ptr()->token_pos_;
+#endif
+ }
void set_token_pos(TokenPosition value) const;
- TokenPosition end_token_pos() const { return raw_ptr()->end_token_pos_; }
+ TokenPosition end_token_pos() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return TokenPosition();
+#else
+ return raw_ptr()->end_token_pos_;
+#endif
+}
void set_end_token_pos(TokenPosition value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
StoreNonPointer(&raw_ptr()->end_token_pos_, value);
+#endif
}
intptr_t num_fixed_parameters() const {
@@ -2484,48 +2511,86 @@ class Function : public Object {
intptr_t NumImplicitParameters() const;
static intptr_t usage_counter_offset() {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return 0;
+#else
return OFFSET_OF(RawFunction, usage_counter_);
+#endif
}
intptr_t usage_counter() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return 0;
+#else
return raw_ptr()->usage_counter_;
+#endif
}
void set_usage_counter(intptr_t value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
// TODO(Srdjan): Assert that this is thread-safe, i.e., only
// set from mutator-thread or while at a safepoint (e.g., during marking).
StoreNonPointer(&raw_ptr()->usage_counter_, value);
+#endif
}
int8_t deoptimization_counter() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return 0;
+#else
return raw_ptr()->deoptimization_counter_;
+#endif
}
void set_deoptimization_counter(int8_t value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
ASSERT(value >= 0);
StoreNonPointer(&raw_ptr()->deoptimization_counter_, value);
+#endif
}
static const intptr_t kMaxInstructionCount = (1 << 16) - 1;
intptr_t optimized_instruction_count() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return 0;
+#else
return raw_ptr()->optimized_instruction_count_;
+#endif
}
void set_optimized_instruction_count(intptr_t value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
ASSERT(value >= 0);
if (value > kMaxInstructionCount) {
value = kMaxInstructionCount;
}
StoreNonPointer(&raw_ptr()->optimized_instruction_count_,
static_cast<uint16_t>(value));
+#endif
}
intptr_t optimized_call_site_count() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return 0;
+#else
return raw_ptr()->optimized_call_site_count_;
+#endif
}
void set_optimized_call_site_count(intptr_t value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
ASSERT(value >= 0);
if (value > kMaxInstructionCount) {
value = kMaxInstructionCount;
}
StoreNonPointer(&raw_ptr()->optimized_call_site_count_,
static_cast<uint16_t>(value));
+#endif
}
bool IsOptimizable() const;
@@ -2785,9 +2850,20 @@ class Function : public Object {
// VM instantiation. It is independent from presence of type feedback
// (ic_data_array) and code, which may be loaded from a snapshot.
void set_was_compiled(bool value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
StoreNonPointer(&raw_ptr()->was_compiled_, value ? 1 : 0);
+#endif
+ }
+ bool was_compiled() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return true;
+#else
+ return raw_ptr()->was_compiled_ == 1;
+#endif
}
- bool was_compiled() const { return raw_ptr()->was_compiled_ == 1; }
// static: Considered during class-side or top-level resolution rather than
// instance-side resolution.
@@ -4504,7 +4580,12 @@ class DeoptInfo : public AllStatic {
class Code : public Object {
public:
RawInstructions* active_instructions() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return NULL;
+#else
return raw_ptr()->active_instructions_;
+#endif
}
RawInstructions* instructions() const { return raw_ptr()->instructions_; }
@@ -4572,12 +4653,20 @@ class Code : public Object {
}
RawCodeSourceMap* code_source_map() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return CodeSourceMap::null();
+#else
return raw_ptr()->code_source_map_;
+#endif
}
void set_code_source_map(const CodeSourceMap& code_source_map) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
ASSERT(code_source_map.IsOld());
StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw());
+#endif
}
// Used during reloading (see object_reload.cc). Calls Reset on all ICDatas
@@ -4588,7 +4677,12 @@ class Code : public Object {
// Array of DeoptInfo objects.
RawArray* deopt_info_array() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return NULL;
+#else
return raw_ptr()->deopt_info_array_;
+#endif
}
void set_deopt_info_array(const Array& array) const;
@@ -4608,7 +4702,12 @@ class Code : public Object {
void set_static_calls_target_table(const Array& value) const;
RawArray* static_calls_target_table() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return NULL;
+#else
return raw_ptr()->static_calls_target_table_;
+#endif
}
RawTypedData* GetDeoptInfoAtPc(uword pc,
@@ -4659,7 +4758,12 @@ class Code : public Object {
void set_comments(const Comments& comments) const;
RawObject* return_address_metadata() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return NULL;
+#else
return raw_ptr()->return_address_metadata_;
+#endif
}
// Sets |return_address_metadata|.
void SetPrologueOffset(intptr_t offset) const;
@@ -4694,11 +4798,20 @@ class Code : public Object {
void DumpInlinedIntervals() const;
RawLocalVarDescriptors* var_descriptors() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+ return NULL;
+#else
return raw_ptr()->var_descriptors_;
+#endif
}
void set_var_descriptors(const LocalVarDescriptors& value) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
ASSERT(value.IsOld());
StorePointer(&raw_ptr()->var_descriptors_, value.raw());
+#endif
}
// Will compute local var descriptors is necessary.
@@ -4779,14 +4892,26 @@ class Code : public Object {
RawString* QualifiedName() const;
int64_t compile_timestamp() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return 0;
+#else
return raw_ptr()->compile_timestamp_;
+#endif
}
intptr_t lazy_deopt_pc_offset() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
Florian Schneider 2016/09/15 17:17:37 Is this used in AOT? UNREACHABLE as well?
rmacnak 2016/09/16 21:59:02 From the profiler.
+ return 0;
+#else
return raw_ptr()->lazy_deopt_pc_offset_;
+#endif
}
void set_lazy_deopt_pc_offset(intptr_t pc) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
StoreNonPointer(&raw_ptr()->lazy_deopt_pc_offset_, pc);
+#endif
}
bool IsAllocationStubCode() const;
@@ -4850,7 +4975,11 @@ class Code : public Object {
static const intptr_t kEntrySize = sizeof(int32_t); // NOLINT
void set_compile_timestamp(int64_t timestamp) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp);
+#endif
}
void SetActiveInstructions(RawInstructions* instructions) const;
@@ -5080,6 +5209,7 @@ class MegamorphicCache : public Object {
private:
friend class Class;
friend class MegamorphicCacheTable;
+ friend class Precompiler;
static RawMegamorphicCache* New();
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698