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

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

Issue 183973035: More performance fixes. (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 | « no previous file | 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 10946 matching lines...) Expand 10 before | Expand all | Expand 10 after
10957 10957
10958 intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const { 10958 intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const {
10959 ASSERT(index < NumberOfChecks()); 10959 ASSERT(index < NumberOfChecks());
10960 const Array& data = Array::Handle(ic_data()); 10960 const Array& data = Array::Handle(ic_data());
10961 const intptr_t data_pos = index * TestEntryLength(); 10961 const intptr_t data_pos = index * TestEntryLength();
10962 return Smi::Value(Smi::RawCast(data.At(data_pos))); 10962 return Smi::Value(Smi::RawCast(data.At(data_pos)));
10963 } 10963 }
10964 10964
10965 10965
10966 RawFunction* ICData::GetTargetAt(intptr_t index) const { 10966 RawFunction* ICData::GetTargetAt(intptr_t index) const {
10967 const Array& data = Array::Handle(ic_data());
10968 const intptr_t data_pos = index * TestEntryLength() + num_args_tested(); 10967 const intptr_t data_pos = index * TestEntryLength() + num_args_tested();
10969 ASSERT(Object::Handle(data.At(data_pos)).IsFunction()); 10968 ASSERT(Object::Handle(Array::Handle(ic_data()).At(data_pos)).IsFunction());
10970 return reinterpret_cast<RawFunction*>(data.At(data_pos)); 10969
10970 NoGCScope no_gc;
10971 RawArray* raw_data = ic_data();
10972 return reinterpret_cast<RawFunction*>(raw_data->ptr()->data()[data_pos]);
10971 } 10973 }
10972 10974
10973 10975
10974 void ICData::IncrementCountAt(intptr_t index, intptr_t value) const { 10976 void ICData::IncrementCountAt(intptr_t index, intptr_t value) const {
10975 ASSERT(0 <= value); 10977 ASSERT(0 <= value);
10976 ASSERT(value <= Smi::kMaxValue); 10978 ASSERT(value <= Smi::kMaxValue);
10977 SetCountAt(index, Utils::Minimum(GetCountAt(index) + value, Smi::kMaxValue)); 10979 SetCountAt(index, Utils::Minimum(GetCountAt(index) + value, Smi::kMaxValue));
10978 } 10980 }
10979 10981
10980 10982
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
11105 return true; 11107 return true;
11106 } 11108 }
11107 } 11109 }
11108 return false; 11110 return false;
11109 } 11111 }
11110 11112
11111 11113
11112 // Returns true if all targets are the same. 11114 // Returns true if all targets are the same.
11113 // TODO(srdjan): if targets are native use their C_function to compare. 11115 // TODO(srdjan): if targets are native use their C_function to compare.
11114 bool ICData::HasOneTarget() const { 11116 bool ICData::HasOneTarget() const {
11115 ASSERT(NumberOfChecks() > 0);
11116 const Function& first_target = Function::Handle(GetTargetAt(0));
11117 const intptr_t len = NumberOfChecks(); 11117 const intptr_t len = NumberOfChecks();
11118 ASSERT(len > 0);
11119 NoGCScope no_gc;
11120 RawFunction* first_target = GetTargetAt(0);
siva 2014/03/06 18:47:00 I am a little bit concerned about putting a NoGCSc
srdjan 2014/03/06 18:50:53 I agree with your concern, reverting code of this
11118 for (intptr_t i = 1; i < len; i++) { 11121 for (intptr_t i = 1; i < len; i++) {
11119 if (GetTargetAt(i) != first_target.raw()) { 11122 if (GetTargetAt(i) != first_target) {
11120 return false; 11123 return false;
11121 } 11124 }
11122 } 11125 }
11123 return true; 11126 return true;
11124 } 11127 }
11125 11128
11126 11129
11127 RawICData* ICData::New(const Function& function, 11130 RawICData* ICData::New(const Function& function,
11128 const String& target_name, 11131 const String& target_name,
11129 const Array& arguments_descriptor, 11132 const Array& arguments_descriptor,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
11298 return result.raw(); 11301 return result.raw();
11299 } 11302 }
11300 11303
11301 11304
11302 void SubtypeTestCache::set_cache(const Array& value) const { 11305 void SubtypeTestCache::set_cache(const Array& value) const {
11303 StorePointer(&raw_ptr()->cache_, value.raw()); 11306 StorePointer(&raw_ptr()->cache_, value.raw());
11304 } 11307 }
11305 11308
11306 11309
11307 intptr_t SubtypeTestCache::NumberOfChecks() const { 11310 intptr_t SubtypeTestCache::NumberOfChecks() const {
11311 NoGCScope no_gc;
11308 // Do not count the sentinel; 11312 // Do not count the sentinel;
11309 return (Array::Handle(cache()).Length() / kTestEntryLength) - 1; 11313 return (Smi::Value(cache()->ptr()->length_) / kTestEntryLength) - 1;
11310 } 11314 }
11311 11315
11312 11316
11313 void SubtypeTestCache::AddCheck( 11317 void SubtypeTestCache::AddCheck(
11314 intptr_t instance_class_id, 11318 intptr_t instance_class_id,
11315 const TypeArguments& instance_type_arguments, 11319 const TypeArguments& instance_type_arguments,
11316 const TypeArguments& instantiator_type_arguments, 11320 const TypeArguments& instantiator_type_arguments,
11317 const Bool& test_result) const { 11321 const Bool& test_result) const {
11318 intptr_t old_num = NumberOfChecks(); 11322 intptr_t old_num = NumberOfChecks();
11319 Array& data = Array::Handle(cache()); 11323 Array& data = Array::Handle(cache());
(...skipping 6187 matching lines...) Expand 10 before | Expand all | Expand 10 after
17507 return "_MirrorReference"; 17511 return "_MirrorReference";
17508 } 17512 }
17509 17513
17510 17514
17511 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 17515 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
17512 Instance::PrintToJSONStream(stream, ref); 17516 Instance::PrintToJSONStream(stream, ref);
17513 } 17517 }
17514 17518
17515 17519
17516 } // namespace dart 17520 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698