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

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

Issue 11642003: Create and cache method extraction stub in the ICData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove hand written assembly stub Created 7 years, 11 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
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 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 if (IsClosureFunction()) { 3213 if (IsClosureFunction()) {
3214 const Object& obj = Object::Handle(raw_ptr()->data_); 3214 const Object& obj = Object::Handle(raw_ptr()->data_);
3215 ASSERT(!obj.IsNull()); 3215 ASSERT(!obj.IsNull());
3216 ClosureData::Cast(obj).set_closure_allocation_stub(value); 3216 ClosureData::Cast(obj).set_closure_allocation_stub(value);
3217 return; 3217 return;
3218 } 3218 }
3219 UNREACHABLE(); 3219 UNREACHABLE();
3220 } 3220 }
3221 3221
3222 3222
3223 RawFunction* Function::method_extractor() const {
3224 ASSERT(IsImplicitClosureFunction());
3225 const Object& obj = Object::Handle(raw_ptr()->data_);
3226 ASSERT(!obj.IsNull());
3227 return ClosureData::Cast(obj).method_extractor();
3228 }
3229
3230
3231 void Function::set_method_extractor(const Function& value) const {
3232 ASSERT(IsImplicitClosureFunction());
3233 const Object& obj = Object::Handle(raw_ptr()->data_);
3234 ASSERT(!obj.IsNull());
3235 ClosureData::Cast(obj).set_method_extractor(value);
3236 }
3237
3238
3239 RawFunction* Function::extracted_method_closure() const {
3240 ASSERT(kind() == RawFunction::kMethodExtractor);
3241 const Object& obj = Object::Handle(raw_ptr()->data_);
3242 ASSERT(obj.IsFunction());
3243 return Function::Cast(obj).raw();
3244 }
3245
3246
3247 void Function::set_extracted_method_closure(const Function& value) const {
3248 ASSERT(kind() == RawFunction::kMethodExtractor);
3249 ASSERT(raw_ptr()->data_ == Object::null());
3250 set_data(value);
3251 }
3252
3253
3223 RawFunction* Function::parent_function() const { 3254 RawFunction* Function::parent_function() const {
3224 if (IsClosureFunction()) { 3255 if (IsClosureFunction()) {
3225 const Object& obj = Object::Handle(raw_ptr()->data_); 3256 const Object& obj = Object::Handle(raw_ptr()->data_);
3226 ASSERT(!obj.IsNull()); 3257 ASSERT(!obj.IsNull());
3227 return ClosureData::Cast(obj).parent_function(); 3258 return ClosureData::Cast(obj).parent_function();
3228 } 3259 }
3229 return Function::null(); 3260 return Function::null();
3230 } 3261 }
3231 3262
3232 3263
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
4302 break; 4333 break;
4303 case RawFunction::kImplicitGetter: 4334 case RawFunction::kImplicitGetter:
4304 kind_str = " getter"; 4335 kind_str = " getter";
4305 break; 4336 break;
4306 case RawFunction::kImplicitSetter: 4337 case RawFunction::kImplicitSetter:
4307 kind_str = " setter"; 4338 kind_str = " setter";
4308 break; 4339 break;
4309 case RawFunction::kConstImplicitGetter: 4340 case RawFunction::kConstImplicitGetter:
4310 kind_str = " const-getter"; 4341 kind_str = " const-getter";
4311 break; 4342 break;
4343 case RawFunction::kMethodExtractor:
4344 kind_str = " method-extractor";
4345 break;
4312 default: 4346 default:
4313 UNREACHABLE(); 4347 UNREACHABLE();
4314 } 4348 }
4315 const char* kFormat = "Function '%s':%s%s%s%s."; 4349 const char* kFormat = "Function '%s':%s%s%s%s.";
4316 const char* function_name = String::Handle(name()).ToCString(); 4350 const char* function_name = String::Handle(name()).ToCString();
4317 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, 4351 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name,
4318 static_str, abstract_str, kind_str, const_str) + 1; 4352 static_str, abstract_str, kind_str, const_str) + 1;
4319 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 4353 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
4320 OS::SNPrint(chars, len, kFormat, function_name, 4354 OS::SNPrint(chars, len, kFormat, function_name,
4321 static_str, abstract_str, kind_str, const_str); 4355 static_str, abstract_str, kind_str, const_str);
(...skipping 13 matching lines...) Expand all
4335 } 4369 }
4336 4370
4337 4371
4338 void ClosureData::set_closure_allocation_stub(const Code& value) const { 4372 void ClosureData::set_closure_allocation_stub(const Code& value) const {
4339 ASSERT(!value.IsNull()); 4373 ASSERT(!value.IsNull());
4340 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null()); 4374 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null());
4341 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw()); 4375 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw());
4342 } 4376 }
4343 4377
4344 4378
4379 void ClosureData::set_method_extractor(const Function& value) const {
4380 ASSERT(!value.IsNull());
4381 ASSERT(raw_ptr()->method_extractor_ == Function::null());
4382 StorePointer(&raw_ptr()->method_extractor_, value.raw());
4383 }
4384
4385
4345 void ClosureData::set_parent_function(const Function& value) const { 4386 void ClosureData::set_parent_function(const Function& value) const {
4346 StorePointer(&raw_ptr()->parent_function_, value.raw()); 4387 StorePointer(&raw_ptr()->parent_function_, value.raw());
4347 } 4388 }
4348 4389
4349 4390
4350 void ClosureData::set_signature_class(const Class& value) const { 4391 void ClosureData::set_signature_class(const Class& value) const {
4351 StorePointer(&raw_ptr()->signature_class_, value.raw()); 4392 StorePointer(&raw_ptr()->signature_class_, value.raw());
4352 } 4393 }
4353 4394
4354 4395
(...skipping 8141 matching lines...) Expand 10 before | Expand all | Expand 10 after
12496 } 12537 }
12497 return result.raw(); 12538 return result.raw();
12498 } 12539 }
12499 12540
12500 12541
12501 const char* WeakProperty::ToCString() const { 12542 const char* WeakProperty::ToCString() const {
12502 return "_WeakProperty"; 12543 return "_WeakProperty";
12503 } 12544 }
12504 12545
12505 } // namespace dart 12546 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698