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

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

Issue 11359151: Fix for issue 6623 - Canonicalize implicit static closure objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « 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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 if (IsClosureFunction()) { 3059 if (IsClosureFunction()) {
3060 const Object& obj = Object::Handle(raw_ptr()->data_); 3060 const Object& obj = Object::Handle(raw_ptr()->data_);
3061 ASSERT(!obj.IsNull()); 3061 ASSERT(!obj.IsNull());
3062 ClosureData::Cast(obj).set_context_scope(value); 3062 ClosureData::Cast(obj).set_context_scope(value);
3063 return; 3063 return;
3064 } 3064 }
3065 UNREACHABLE(); 3065 UNREACHABLE();
3066 } 3066 }
3067 3067
3068 3068
3069 RawInstance* Function::implicit_static_closure() const {
3070 if (IsImplicitStaticClosureFunction()) {
3071 const Object& obj = Object::Handle(raw_ptr()->data_);
3072 ASSERT(!obj.IsNull());
3073 return ClosureData::Cast(obj).implicit_static_closure();
3074 }
3075 return Instance::null();
3076 }
3077
3078
3079 void Function::set_implicit_static_closure(const Instance& closure) const {
3080 if (IsImplicitStaticClosureFunction()) {
3081 const Object& obj = Object::Handle(raw_ptr()->data_);
3082 ASSERT(!obj.IsNull());
3083 ClosureData::Cast(obj).set_implicit_static_closure(closure);
3084 return;
3085 }
3086 UNREACHABLE();
3087 }
3088
3089
3069 RawCode* Function::closure_allocation_stub() const { 3090 RawCode* Function::closure_allocation_stub() const {
3070 if (IsClosureFunction()) { 3091 if (IsClosureFunction()) {
3071 const Object& obj = Object::Handle(raw_ptr()->data_); 3092 const Object& obj = Object::Handle(raw_ptr()->data_);
3072 ASSERT(!obj.IsNull()); 3093 ASSERT(!obj.IsNull());
3073 return ClosureData::Cast(obj).closure_allocation_stub(); 3094 return ClosureData::Cast(obj).closure_allocation_stub();
3074 } 3095 }
3075 return Code::null(); 3096 return Code::null();
3076 } 3097 }
3077 3098
3078 3099
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
4163 static_str, abstract_str, kind_str, const_str); 4184 static_str, abstract_str, kind_str, const_str);
4164 return chars; 4185 return chars;
4165 } 4186 }
4166 4187
4167 4188
4168 void ClosureData::set_context_scope(const ContextScope& value) const { 4189 void ClosureData::set_context_scope(const ContextScope& value) const {
4169 StorePointer(&raw_ptr()->context_scope_, value.raw()); 4190 StorePointer(&raw_ptr()->context_scope_, value.raw());
4170 } 4191 }
4171 4192
4172 4193
4194 void ClosureData::set_implicit_static_closure(const Instance& closure) const {
4195 ASSERT(!closure.IsNull());
4196 ASSERT(raw_ptr()->closure_ == Instance::null());
4197 StorePointer(&raw_ptr()->closure_, closure.raw());
4198 }
4199
4200
4173 void ClosureData::set_closure_allocation_stub(const Code& value) const { 4201 void ClosureData::set_closure_allocation_stub(const Code& value) const {
4174 ASSERT(!value.IsNull()); 4202 ASSERT(!value.IsNull());
4175 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null()); 4203 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null());
4176 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw()); 4204 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw());
4177 } 4205 }
4178 4206
4179 4207
4180 void ClosureData::set_parent_function(const Function& value) const { 4208 void ClosureData::set_parent_function(const Function& value) const {
4181 StorePointer(&raw_ptr()->parent_function_, value.raw()); 4209 StorePointer(&raw_ptr()->parent_function_, value.raw());
4182 } 4210 }
(...skipping 7802 matching lines...) Expand 10 before | Expand all | Expand 10 after
11985 } 12013 }
11986 return result.raw(); 12014 return result.raw();
11987 } 12015 }
11988 12016
11989 12017
11990 const char* WeakProperty::ToCString() const { 12018 const char* WeakProperty::ToCString() const {
11991 return "_WeakProperty"; 12019 return "_WeakProperty";
11992 } 12020 }
11993 12021
11994 } // namespace dart 12022 } // 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