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

Unified Diff: runtime/vm/compiler.cc

Issue 1289643005: Rename accessors of class Field to make it more apparent as to what is being accessed - static fiel… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add-comment Created 5 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
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/constant_propagator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index b7c15f26ab9e1a8fbd9e414b85fed17b9089c204..41495fb6289afbc31dc2e7572e4deaa14cdb84bb 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -1279,13 +1279,13 @@ RawError* Compiler::CompileAllFunctions(const Class& cls) {
void Compiler::CompileStaticInitializer(const Field& field) {
ASSERT(field.is_static());
- if (field.initializer() != Function::null()) {
+ if (field.PrecompiledInitializer() != Function::null()) {
// TODO(rmacnak): Investigate why this happens for _enum_names.
OS::Print("Warning: Ignoring repeated request for initializer for %s\n",
field.ToCString());
return;
}
- ASSERT(field.initializer() == Function::null());
+ ASSERT(field.PrecompiledInitializer() == Function::null());
Thread* thread = Thread::Current();
StackZone zone(thread);
@@ -1300,7 +1300,7 @@ void Compiler::CompileStaticInitializer(const Field& field) {
Isolate::kNoDeoptId);
const Function& initializer = parsed_function->function();
- field.set_initializer(initializer);
+ field.SetPrecompiledInitializer(initializer);
}
@@ -1308,16 +1308,15 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
ASSERT(field.is_static());
// The VM sets the field's value to transiton_sentinel prior to
// evaluating the initializer value.
- ASSERT(field.value() == Object::transition_sentinel().raw());
+ ASSERT(field.StaticValue() == Object::transition_sentinel().raw());
LongJumpScope jump;
if (setjmp(*jump.Set()) == 0) {
- Function& initializer = Function::Handle(field.initializer());
-
// Under precompilation, the initializer may have already been compiled, in
// which case use it. Under lazy compilation or early in precompilation, the
// initializer has not yet been created, so create it now, but don't bother
// remembering it because it won't be used again.
- if (initializer.IsNull()) {
+ Function& initializer = Function::Handle();
+ if (!field.HasPrecompiledInitializer()) {
Thread* const thread = Thread::Current();
StackZone zone(thread);
ParsedFunction* parsed_function =
@@ -1331,6 +1330,8 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
false, // optimized
Isolate::kNoDeoptId);
initializer = parsed_function->function().raw();
+ } else {
+ initializer ^= field.PrecompiledInitializer();
}
// Invoke the function to evaluate the expression.
return DartEntry::InvokeFunction(initializer, Object::empty_array());
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/constant_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698