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

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

Issue 10695136: Use class id instead of class in subtype test cache. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | 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 "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 6891 matching lines...) Expand 10 before | Expand all | Expand 10 after
6902 } 6902 }
6903 6903
6904 6904
6905 intptr_t SubtypeTestCache::NumberOfChecks() const { 6905 intptr_t SubtypeTestCache::NumberOfChecks() const {
6906 // Do not count the sentinel; 6906 // Do not count the sentinel;
6907 return (Array::Handle(cache()).Length() / kTestEntryLength) - 1; 6907 return (Array::Handle(cache()).Length() / kTestEntryLength) - 1;
6908 } 6908 }
6909 6909
6910 6910
6911 void SubtypeTestCache::AddCheck( 6911 void SubtypeTestCache::AddCheck(
6912 const Class& instance_class, 6912 intptr_t instance_class_id,
6913 const AbstractTypeArguments& instance_type_arguments, 6913 const AbstractTypeArguments& instance_type_arguments,
6914 const AbstractTypeArguments& instantiator_type_arguments, 6914 const AbstractTypeArguments& instantiator_type_arguments,
6915 const Bool& test_result) const { 6915 const Bool& test_result) const {
6916 intptr_t old_num = NumberOfChecks(); 6916 intptr_t old_num = NumberOfChecks();
6917 Array& data = Array::Handle(cache()); 6917 Array& data = Array::Handle(cache());
6918 intptr_t new_len = data.Length() + kTestEntryLength; 6918 intptr_t new_len = data.Length() + kTestEntryLength;
6919 data = Array::Grow(data, new_len); 6919 data = Array::Grow(data, new_len);
6920 set_cache(data); 6920 set_cache(data);
6921 intptr_t data_pos = old_num * kTestEntryLength; 6921 intptr_t data_pos = old_num * kTestEntryLength;
6922 data.SetAt(data_pos + kInstanceClass, instance_class); 6922 data.SetAt(data_pos + kInstanceClassId,
6923 Smi::Handle(Smi::New(instance_class_id)));
6923 data.SetAt(data_pos + kInstanceTypeArguments, instance_type_arguments); 6924 data.SetAt(data_pos + kInstanceTypeArguments, instance_type_arguments);
6924 data.SetAt(data_pos + kInstantiatorTypeArguments, 6925 data.SetAt(data_pos + kInstantiatorTypeArguments,
6925 instantiator_type_arguments); 6926 instantiator_type_arguments);
6926 data.SetAt(data_pos + kTestResult, test_result); 6927 data.SetAt(data_pos + kTestResult, test_result);
6927 } 6928 }
6928 6929
6929 6930
6930 void SubtypeTestCache::GetCheck( 6931 void SubtypeTestCache::GetCheck(
6931 intptr_t ix, 6932 intptr_t ix,
6932 Class* instance_class, 6933 intptr_t* instance_class_id,
6933 AbstractTypeArguments* instance_type_arguments, 6934 AbstractTypeArguments* instance_type_arguments,
6934 AbstractTypeArguments* instantiator_type_arguments, 6935 AbstractTypeArguments* instantiator_type_arguments,
6935 Bool* test_result) const { 6936 Bool* test_result) const {
6936 Array& data = Array::Handle(cache()); 6937 Array& data = Array::Handle(cache());
6937 intptr_t data_pos = ix * kTestEntryLength; 6938 intptr_t data_pos = ix * kTestEntryLength;
6938 *instance_class ^= data.At(data_pos + kInstanceClass); 6939 Smi& instance_class_id_handle = Smi::Handle();
6940 instance_class_id_handle ^= data.At(data_pos + kInstanceClassId);
6941 *instance_class_id = instance_class_id_handle.Value();
6939 *instance_type_arguments ^= data.At(data_pos + kInstanceTypeArguments); 6942 *instance_type_arguments ^= data.At(data_pos + kInstanceTypeArguments);
6940 *instantiator_type_arguments ^= 6943 *instantiator_type_arguments ^=
6941 data.At(data_pos + kInstantiatorTypeArguments); 6944 data.At(data_pos + kInstantiatorTypeArguments);
6942 *test_result ^= data.At(data_pos + kTestResult); 6945 *test_result ^= data.At(data_pos + kTestResult);
6943 } 6946 }
6944 6947
6945 6948
6946 const char* SubtypeTestCache::ToCString() const { 6949 const char* SubtypeTestCache::ToCString() const {
6947 return "SubtypeTestCache"; 6950 return "SubtypeTestCache";
6948 } 6951 }
(...skipping 3293 matching lines...) Expand 10 before | Expand all | Expand 10 after
10242 const String& str = String::Handle(pattern()); 10245 const String& str = String::Handle(pattern());
10243 const char* format = "JSRegExp: pattern=%s flags=%s"; 10246 const char* format = "JSRegExp: pattern=%s flags=%s";
10244 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10247 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10245 char* chars = reinterpret_cast<char*>( 10248 char* chars = reinterpret_cast<char*>(
10246 Isolate::Current()->current_zone()->Allocate(len + 1)); 10249 Isolate::Current()->current_zone()->Allocate(len + 1));
10247 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10250 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10248 return chars; 10251 return chars;
10249 } 10252 }
10250 10253
10251 } // namespace dart 10254 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | runtime/vm/stub_code_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698