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

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

Issue 1392893003: In precompilation, finalize all classes eagerly. Use the stable class hierarchy for doing CHA based… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Sync Created 5 years, 2 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 return raw_ptr()->invocation_dispatcher_cache_; 2773 return raw_ptr()->invocation_dispatcher_cache_;
2774 } 2774 }
2775 2775
2776 2776
2777 void Class::set_invocation_dispatcher_cache(const Array& cache) const { 2777 void Class::set_invocation_dispatcher_cache(const Array& cache) const {
2778 StorePointer(&raw_ptr()->invocation_dispatcher_cache_, cache.raw()); 2778 StorePointer(&raw_ptr()->invocation_dispatcher_cache_, cache.raw());
2779 } 2779 }
2780 2780
2781 2781
2782 void Class::Finalize() const { 2782 void Class::Finalize() const {
2783 // Even if all regular classes are prefinalized (precompilation), signature
2784 // classes may be added later when we encounter local functions.
2785 ASSERT(IsSignatureClass() || !Isolate::Current()->all_classes_finalized());
2783 ASSERT(!is_finalized()); 2786 ASSERT(!is_finalized());
2784 // Prefinalized classes have a VM internal representation and no Dart fields. 2787 // Prefinalized classes have a VM internal representation and no Dart fields.
2785 // Their instance size is precomputed and field offsets are known. 2788 // Their instance size is precomputed and field offsets are known.
2786 if (!is_prefinalized()) { 2789 if (!is_prefinalized()) {
2787 // Compute offsets of instance fields and instance size. 2790 // Compute offsets of instance fields and instance size.
2788 CalculateFieldOffsets(); 2791 CalculateFieldOffsets();
2789 } 2792 }
2790 set_is_finalized(); 2793 set_is_finalized();
2791 } 2794 }
2792 2795
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
3037 const Array& param_values) const { 3040 const Array& param_values) const {
3038 const Function& eval_func = 3041 const Function& eval_func =
3039 Function::Handle(EvaluateHelper(*this, expr, param_names, true)); 3042 Function::Handle(EvaluateHelper(*this, expr, param_names, true));
3040 const Object& result = 3043 const Object& result =
3041 Object::Handle(DartEntry::InvokeFunction(eval_func, param_values)); 3044 Object::Handle(DartEntry::InvokeFunction(eval_func, param_values));
3042 return result.raw(); 3045 return result.raw();
3043 } 3046 }
3044 3047
3045 3048
3046 // Ensure that top level parsing of the class has been done. 3049 // Ensure that top level parsing of the class has been done.
3047 // TODO(24109): Migrate interface to Thread*.
3048 RawError* Class::EnsureIsFinalized(Thread* thread) const { 3050 RawError* Class::EnsureIsFinalized(Thread* thread) const {
3049 // Finalized classes have already been parsed. 3051 // Finalized classes have already been parsed.
3050 if (is_finalized()) { 3052 if (is_finalized()) {
3051 return Error::null(); 3053 return Error::null();
3052 } 3054 }
3053 ASSERT(thread != NULL); 3055 ASSERT(thread != NULL);
3054 const Error& error = Error::Handle( 3056 const Error& error = Error::Handle(
3055 thread->zone(), Compiler::CompileClass(*this)); 3057 thread->zone(), Compiler::CompileClass(*this));
3056 if (!error.IsNull()) { 3058 if (!error.IsNull()) {
3057 ASSERT(thread == Thread::Current()); 3059 ASSERT(thread == Thread::Current());
(...skipping 18573 matching lines...) Expand 10 before | Expand all | Expand 10 after
21631 return tag_label.ToCString(); 21633 return tag_label.ToCString();
21632 } 21634 }
21633 21635
21634 21636
21635 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21637 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21636 Instance::PrintJSONImpl(stream, ref); 21638 Instance::PrintJSONImpl(stream, ref);
21637 } 21639 }
21638 21640
21639 21641
21640 } // namespace dart 21642 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698