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

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

Issue 57813002: Version 0.8.10.3 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « dart/runtime/vm/object.h ('k') | dart/runtime/vm/parser.cc » ('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 4209 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 4220
4221 4221
4222 void Function::set_saved_args_desc(const Array& value) const { 4222 void Function::set_saved_args_desc(const Array& value) const {
4223 ASSERT(kind() == RawFunction::kNoSuchMethodDispatcher || 4223 ASSERT(kind() == RawFunction::kNoSuchMethodDispatcher ||
4224 kind() == RawFunction::kInvokeFieldDispatcher); 4224 kind() == RawFunction::kInvokeFieldDispatcher);
4225 ASSERT(raw_ptr()->data_ == Object::null()); 4225 ASSERT(raw_ptr()->data_ == Object::null());
4226 set_data(value); 4226 set_data(value);
4227 } 4227 }
4228 4228
4229 4229
4230 RawField* Function::saved_static_field() const {
4231 ASSERT(kind() == RawFunction::kStaticInitializer);
4232 const Object& obj = Object::Handle(raw_ptr()->data_);
4233 ASSERT(obj.IsField());
4234 return Field::Cast(obj).raw();
4235 }
4236
4237
4238 void Function::set_saved_static_field(const Field& value) const {
4239 ASSERT(kind() == RawFunction::kStaticInitializer);
4240 ASSERT(raw_ptr()->data_ == Object::null());
4241 set_data(value);
4242 }
4243
4244
4230 RawFunction* Function::parent_function() const { 4245 RawFunction* Function::parent_function() const {
4231 if (IsClosureFunction()) { 4246 if (IsClosureFunction()) {
4232 const Object& obj = Object::Handle(raw_ptr()->data_); 4247 const Object& obj = Object::Handle(raw_ptr()->data_);
4233 ASSERT(!obj.IsNull()); 4248 ASSERT(!obj.IsNull());
4234 return ClosureData::Cast(obj).parent_function(); 4249 return ClosureData::Cast(obj).parent_function();
4235 } 4250 }
4236 return Function::null(); 4251 return Function::null();
4237 } 4252 }
4238 4253
4239 4254
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 ToFullyQualifiedCString(), 5462 ToFullyQualifiedCString(),
5448 fp, 5463 fp,
5449 SourceFingerprint()); 5464 SourceFingerprint());
5450 return false; 5465 return false;
5451 } 5466 }
5452 } 5467 }
5453 return true; 5468 return true;
5454 } 5469 }
5455 5470
5456 5471
5457 RawFunction* Function::NewStaticInitializer(const String& field_name, 5472 RawFunction* Function::NewStaticInitializer(const Field& field) {
5458 const AbstractType& result_type, 5473 ASSERT(field.is_static());
5459 const Class& cls, 5474 const String& field_name = String::Handle(field.name());
5460 intptr_t initializer_pos) {
5461 const String& init_name = 5475 const String& init_name =
5462 String::Handle(Symbols::New(String::Handle( 5476 String::Handle(Symbols::New(String::Handle(
5463 String::Concat(Symbols::InitPrefix(), field_name)))); 5477 String::Concat(Symbols::InitPrefix(), field_name))));
5464 const Function& init_function = Function::ZoneHandle( 5478 const Function& init_function = Function::ZoneHandle(
5465 Function::New(init_name, 5479 Function::New(init_name,
5466 RawFunction::kStaticInitializer, 5480 RawFunction::kStaticInitializer,
5467 true, // static 5481 true, // static
5468 false, // !const 5482 false, // !const
5469 false, // !abstract 5483 false, // !abstract
5470 false, // !external 5484 false, // !external
5471 cls, 5485 Class::Handle(field.owner()),
5472 initializer_pos)); 5486 field.token_pos()));
5473 init_function.set_result_type(result_type); 5487 init_function.set_result_type(AbstractType::Handle(field.type()));
5474 // Static initializer functions are generated by the VM and are therfore 5488 // Static initializer functions are generated by the VM and are therfore
5475 // hidden from the user. Since they are only executed once, we avoid 5489 // hidden from the user. Since they are only executed once, we avoid
5476 // optimizing and inlining them. After the field is initialized, the 5490 // optimizing and inlining them. After the field is initialized, the
5477 // optimizing compiler can eliminate the call to the static initializer 5491 // optimizing compiler can eliminate the call to the static initializer
5478 // via constant folding. 5492 // via constant folding.
5479 init_function.set_is_visible(false); 5493 init_function.set_is_visible(false);
5480 init_function.set_is_optimizable(false); 5494 init_function.set_is_optimizable(false);
5481 init_function.set_is_inlinable(false); 5495 init_function.set_is_inlinable(false);
5496 init_function.set_saved_static_field(field);
5482 return init_function.raw(); 5497 return init_function.raw();
5483 } 5498 }
5484 5499
5485 5500
5486 const char* Function::ToCString() const { 5501 const char* Function::ToCString() const {
5487 const char* static_str = is_static() ? " static" : ""; 5502 const char* static_str = is_static() ? " static" : "";
5488 const char* abstract_str = is_abstract() ? " abstract" : ""; 5503 const char* abstract_str = is_abstract() ? " abstract" : "";
5489 const char* kind_str = NULL; 5504 const char* kind_str = NULL;
5490 const char* const_str = is_const() ? " const" : ""; 5505 const char* const_str = is_const() ? " const" : "";
5491 switch (kind()) { 5506 switch (kind()) {
(...skipping 10209 matching lines...) Expand 10 before | Expand all | Expand 10 after
15701 return "_MirrorReference"; 15716 return "_MirrorReference";
15702 } 15717 }
15703 15718
15704 15719
15705 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15720 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15706 JSONObject jsobj(stream); 15721 JSONObject jsobj(stream);
15707 } 15722 }
15708 15723
15709 15724
15710 } // namespace dart 15725 } // namespace dart
OLDNEW
« no previous file with comments | « dart/runtime/vm/object.h ('k') | dart/runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698