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

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

Issue 178233003: Allocate instance closures similarly to regular closures, i.e. without a (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.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 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 if (IsImplicitStaticClosureFunction()) { 4600 if (IsImplicitStaticClosureFunction()) {
4601 const Object& obj = Object::Handle(raw_ptr()->data_); 4601 const Object& obj = Object::Handle(raw_ptr()->data_);
4602 ASSERT(!obj.IsNull()); 4602 ASSERT(!obj.IsNull());
4603 ClosureData::Cast(obj).set_implicit_static_closure(closure); 4603 ClosureData::Cast(obj).set_implicit_static_closure(closure);
4604 return; 4604 return;
4605 } 4605 }
4606 UNREACHABLE(); 4606 UNREACHABLE();
4607 } 4607 }
4608 4608
4609 4609
4610 RawCode* Function::closure_allocation_stub() const {
4611 if (IsClosureFunction()) {
4612 const Object& obj = Object::Handle(raw_ptr()->data_);
4613 ASSERT(!obj.IsNull());
4614 return ClosureData::Cast(obj).closure_allocation_stub();
4615 }
4616 return Code::null();
4617 }
4618
4619
4620 void Function::set_closure_allocation_stub(const Code& value) const {
4621 if (IsClosureFunction()) {
4622 const Object& obj = Object::Handle(raw_ptr()->data_);
4623 ASSERT(!obj.IsNull());
4624 ClosureData::Cast(obj).set_closure_allocation_stub(value);
4625 return;
4626 }
4627 UNREACHABLE();
4628 }
4629
4630
4631 RawFunction* Function::extracted_method_closure() const { 4610 RawFunction* Function::extracted_method_closure() const {
4632 ASSERT(kind() == RawFunction::kMethodExtractor); 4611 ASSERT(kind() == RawFunction::kMethodExtractor);
4633 const Object& obj = Object::Handle(raw_ptr()->data_); 4612 const Object& obj = Object::Handle(raw_ptr()->data_);
4634 ASSERT(obj.IsFunction()); 4613 ASSERT(obj.IsFunction());
4635 return Function::Cast(obj).raw(); 4614 return Function::Cast(obj).raw();
4636 } 4615 }
4637 4616
4638 4617
4639 void Function::set_extracted_method_closure(const Function& value) const { 4618 void Function::set_extracted_method_closure(const Function& value) const {
4640 ASSERT(kind() == RawFunction::kMethodExtractor); 4619 ASSERT(kind() == RawFunction::kMethodExtractor);
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
6121 } 6100 }
6122 6101
6123 6102
6124 void ClosureData::set_implicit_static_closure(const Instance& closure) const { 6103 void ClosureData::set_implicit_static_closure(const Instance& closure) const {
6125 ASSERT(!closure.IsNull()); 6104 ASSERT(!closure.IsNull());
6126 ASSERT(raw_ptr()->closure_ == Instance::null()); 6105 ASSERT(raw_ptr()->closure_ == Instance::null());
6127 StorePointer(&raw_ptr()->closure_, closure.raw()); 6106 StorePointer(&raw_ptr()->closure_, closure.raw());
6128 } 6107 }
6129 6108
6130 6109
6131 void ClosureData::set_closure_allocation_stub(const Code& value) const {
6132 ASSERT(!value.IsNull());
6133 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null());
6134 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw());
6135 }
6136
6137
6138 void ClosureData::set_parent_function(const Function& value) const { 6110 void ClosureData::set_parent_function(const Function& value) const {
6139 StorePointer(&raw_ptr()->parent_function_, value.raw()); 6111 StorePointer(&raw_ptr()->parent_function_, value.raw());
6140 } 6112 }
6141 6113
6142 6114
6143 void ClosureData::set_signature_class(const Class& value) const { 6115 void ClosureData::set_signature_class(const Class& value) const {
6144 StorePointer(&raw_ptr()->signature_class_, value.raw()); 6116 StorePointer(&raw_ptr()->signature_class_, value.raw());
6145 } 6117 }
6146 6118
6147 6119
(...skipping 11308 matching lines...) Expand 10 before | Expand all | Expand 10 after
17456 return "_MirrorReference"; 17428 return "_MirrorReference";
17457 } 17429 }
17458 17430
17459 17431
17460 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 17432 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
17461 Instance::PrintToJSONStream(stream, ref); 17433 Instance::PrintToJSONStream(stream, ref);
17462 } 17434 }
17463 17435
17464 17436
17465 } // namespace dart 17437 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698