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

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

Issue 2147123002: Made simple instance-of checks fast for unoptimized code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed compile_time_constants_ from object_store. Created 4 years, 5 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.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/become.h" 10 #include "vm/become.h"
(...skipping 12830 matching lines...) Expand 10 before | Expand all | Expand 10 after
12841 // Set count to 0 as this is called during compilation, before the 12841 // Set count to 0 as this is called during compilation, before the
12842 // call has been executed. 12842 // call has been executed.
12843 const Smi& value = Smi::Handle(Smi::New(0)); 12843 const Smi& value = Smi::Handle(Smi::New(0));
12844 data.SetAt(data_pos, value); 12844 data.SetAt(data_pos, value);
12845 // Multithreaded access to ICData requires setting of array to be the last 12845 // Multithreaded access to ICData requires setting of array to be the last
12846 // operation. 12846 // operation.
12847 set_ic_data_array(data); 12847 set_ic_data_array(data);
12848 } 12848 }
12849 12849
12850 12850
12851 bool ICData::ValidateInterceptor(const Function& target) const {
12852 ObjectStore* store = Isolate::Current()->object_store();
12853 ASSERT((target.raw() == store->simple_instance_of_true_function()) ||
12854 (target.raw() == store->simple_instance_of_false_function()));
12855 const String& instance_of_name = String::Handle(
12856 Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()).raw());
12857 ASSERT(target_name() == instance_of_name.raw());
12858 return true;
12859 }
12860
12851 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids, 12861 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids,
12852 const Function& target) const { 12862 const Function& target) const {
12853 ASSERT(!target.IsNull()); 12863 ASSERT(!target.IsNull());
12854 ASSERT(target.name() == target_name()); 12864 ASSERT((target.name() == target_name()) || ValidateInterceptor(target));
12855 DEBUG_ASSERT(!HasCheck(class_ids)); 12865 DEBUG_ASSERT(!HasCheck(class_ids));
12856 ASSERT(NumArgsTested() > 1); // Otherwise use 'AddReceiverCheck'. 12866 ASSERT(NumArgsTested() > 1); // Otherwise use 'AddReceiverCheck'.
12857 ASSERT(class_ids.length() == NumArgsTested()); 12867 ASSERT(class_ids.length() == NumArgsTested());
12858 const intptr_t old_num = NumberOfChecks(); 12868 const intptr_t old_num = NumberOfChecks();
12859 Array& data = Array::Handle(ic_data()); 12869 Array& data = Array::Handle(ic_data());
12860 // ICData of static calls with NumArgsTested() > 0 have initially a 12870 // ICData of static calls with NumArgsTested() > 0 have initially a
12861 // dummy set of cids entered (see ICData::AddTarget). That entry is 12871 // dummy set of cids entered (see ICData::AddTarget). That entry is
12862 // overwritten by first real type feedback data. 12872 // overwritten by first real type feedback data.
12863 if (old_num == 1) { 12873 if (old_num == 1) {
12864 bool has_dummy_entry = true; 12874 bool has_dummy_entry = true;
(...skipping 9729 matching lines...) Expand 10 before | Expand all | Expand 10 after
22594 return UserTag::null(); 22604 return UserTag::null();
22595 } 22605 }
22596 22606
22597 22607
22598 const char* UserTag::ToCString() const { 22608 const char* UserTag::ToCString() const {
22599 const String& tag_label = String::Handle(label()); 22609 const String& tag_label = String::Handle(label());
22600 return tag_label.ToCString(); 22610 return tag_label.ToCString();
22601 } 22611 }
22602 22612
22603 } // namespace dart 22613 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698