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

Side by Side Diff: runtime/vm/object.h

Issue 2489723003: Run field initializers for new instance fields after a reload (Closed)
Patch Set: Created 4 years, 1 month 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_OBJECT_H_ 5 #ifndef RUNTIME_VM_OBJECT_H_
6 #define RUNTIME_VM_OBJECT_H_ 6 #define RUNTIME_VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 } 2837 }
2838 2838
2839 bool IsAsyncOrGenerator() const { 2839 bool IsAsyncOrGenerator() const {
2840 return modifier() != RawFunction::kNoModifier; 2840 return modifier() != RawFunction::kNoModifier;
2841 } 2841 }
2842 2842
2843 static intptr_t InstanceSize() { 2843 static intptr_t InstanceSize() {
2844 return RoundedAllocationSize(sizeof(RawFunction)); 2844 return RoundedAllocationSize(sizeof(RawFunction));
2845 } 2845 }
2846 2846
2847 static RawFunction* EvaluateHelper(const Class& cls,
2848 const String& expr,
2849 const Array& param_names,
2850 bool is_static);
2851
2847 static RawFunction* New(const String& name, 2852 static RawFunction* New(const String& name,
2848 RawFunction::Kind kind, 2853 RawFunction::Kind kind,
2849 bool is_static, 2854 bool is_static,
2850 bool is_const, 2855 bool is_const,
2851 bool is_abstract, 2856 bool is_abstract,
2852 bool is_external, 2857 bool is_external,
2853 bool is_native, 2858 bool is_native,
2854 const Object& owner, 2859 const Object& owner,
2855 TokenPosition token_pos); 2860 TokenPosition token_pos);
2856 2861
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 return OFFSET_OF(RawField, value_.offset_); 3233 return OFFSET_OF(RawField, value_.offset_);
3229 } 3234 }
3230 static intptr_t static_value_offset() { 3235 static intptr_t static_value_offset() {
3231 return OFFSET_OF(RawField, value_.static_value_); 3236 return OFFSET_OF(RawField, value_.static_value_);
3232 } 3237 }
3233 3238
3234 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } 3239 static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); }
3235 3240
3236 TokenPosition token_pos() const { return raw_ptr()->token_pos_; } 3241 TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
3237 3242
3243 RawString* InitializingExpression() const;
3244
3238 bool has_initializer() const { 3245 bool has_initializer() const {
3239 return HasInitializerBit::decode(raw_ptr()->kind_bits_); 3246 return HasInitializerBit::decode(raw_ptr()->kind_bits_);
3240 } 3247 }
3241 // Called by parser after allocating field. 3248 // Called by parser after allocating field.
3242 void set_has_initializer(bool has_initializer) const { 3249 void set_has_initializer(bool has_initializer) const {
3243 ASSERT(IsOriginal()); 3250 ASSERT(IsOriginal());
3244 ASSERT(Thread::Current()->IsMutatorThread()); 3251 ASSERT(Thread::Current()->IsMutatorThread());
3245 set_kind_bits(HasInitializerBit::update(has_initializer, 3252 set_kind_bits(HasInitializerBit::update(has_initializer,
3246 raw_ptr()->kind_bits_)); 3253 raw_ptr()->kind_bits_));
3247 } 3254 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 void set_compile_time_constants(const Array& value) const; 3606 void set_compile_time_constants(const Array& value) const;
3600 3607
3601 RawTokenStream* tokens() const { return raw_ptr()->tokens_; } 3608 RawTokenStream* tokens() const { return raw_ptr()->tokens_; }
3602 3609
3603 void Tokenize(const String& private_key, 3610 void Tokenize(const String& private_key,
3604 bool use_shared_tokens = true) const; 3611 bool use_shared_tokens = true) const;
3605 3612
3606 RawLibrary* FindLibrary() const; 3613 RawLibrary* FindLibrary() const;
3607 RawString* GetLine(intptr_t line_number, 3614 RawString* GetLine(intptr_t line_number,
3608 Heap::Space space = Heap::kNew) const; 3615 Heap::Space space = Heap::kNew) const;
3616 RawString* GetSnippet(TokenPosition from, TokenPosition to) const;
3609 RawString* GetSnippet(intptr_t from_line, 3617 RawString* GetSnippet(intptr_t from_line,
3610 intptr_t from_column, 3618 intptr_t from_column,
3611 intptr_t to_line, 3619 intptr_t to_line,
3612 intptr_t to_column) const; 3620 intptr_t to_column) const;
3613 3621
3614 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const; 3622 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const;
3615 3623
3616 void GetTokenLocation(TokenPosition token_pos, 3624 void GetTokenLocation(TokenPosition token_pos,
3617 intptr_t* line, 3625 intptr_t* line,
3618 intptr_t* column, 3626 intptr_t* column,
(...skipping 5420 matching lines...) Expand 10 before | Expand all | Expand 10 after
9039 9047
9040 inline void TypeArguments::SetHash(intptr_t value) const { 9048 inline void TypeArguments::SetHash(intptr_t value) const {
9041 // This is only safe because we create a new Smi, which does not cause 9049 // This is only safe because we create a new Smi, which does not cause
9042 // heap allocation. 9050 // heap allocation.
9043 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 9051 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
9044 } 9052 }
9045 9053
9046 } // namespace dart 9054 } // namespace dart
9047 9055
9048 #endif // RUNTIME_VM_OBJECT_H_ 9056 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698