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

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

Issue 13951007: Fix bug in MegamorphicCacheMissHandler: put kNullCid into the cache when receiver is null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) { 1007 DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) {
1008 ASSERT(arguments.ArgCount() == 1008 ASSERT(arguments.ArgCount() ==
1009 kMegamorphicCacheMissHandlerRuntimeEntry.argument_count()); 1009 kMegamorphicCacheMissHandlerRuntimeEntry.argument_count());
1010 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); 1010 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
1011 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); 1011 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
1012 const Array& descriptor = Array::CheckedHandle(arguments.ArgAt(2)); 1012 const Array& descriptor = Array::CheckedHandle(arguments.ArgAt(2));
1013 const String& name = String::Handle(ic_data.target_name()); 1013 const String& name = String::Handle(ic_data.target_name());
1014 const MegamorphicCache& cache = MegamorphicCache::Handle( 1014 const MegamorphicCache& cache = MegamorphicCache::Handle(
1015 isolate->megamorphic_cache_table()->Lookup(name, descriptor)); 1015 isolate->megamorphic_cache_table()->Lookup(name, descriptor));
1016 Class& cls = Class::Handle(receiver.clazz()); 1016 Class& cls = Class::Handle(receiver.clazz());
1017 const bool is_null = cls.IsNullClass();
1017 // For lookups treat null as an instance of class Object. 1018 // For lookups treat null as an instance of class Object.
1018 if (cls.IsNullClass()) { 1019 if (is_null) {
1019 cls = isolate->object_store()->object_class(); 1020 cls = isolate->object_store()->object_class();
1020 } 1021 }
1021 ASSERT(!cls.IsNull()); 1022 ASSERT(!cls.IsNull());
1022 if (FLAG_trace_ic || FLAG_trace_ic_miss_in_optimized) { 1023 if (FLAG_trace_ic || FLAG_trace_ic_miss_in_optimized) {
1023 OS::PrintErr("Megamorphic IC miss, class=%s, function=%s\n", 1024 OS::PrintErr("Megamorphic IC miss, class=%s, function=%s\n",
1024 cls.ToCString(), name.ToCString()); 1025 cls.ToCString(), name.ToCString());
1025 } 1026 }
1026 1027
1027 intptr_t arg_count = 1028 intptr_t arg_count =
1028 Smi::Cast(Object::Handle(descriptor.At(0))).Value(); 1029 Smi::Cast(Object::Handle(descriptor.At(0))).Value();
(...skipping 13 matching lines...) Expand all
1042 Exceptions::PropagateError(error); 1043 Exceptions::PropagateError(error);
1043 } 1044 }
1044 } 1045 }
1045 ASSERT(target.HasCode()); 1046 ASSERT(target.HasCode());
1046 instructions = Code::Handle(target.CurrentCode()).instructions(); 1047 instructions = Code::Handle(target.CurrentCode()).instructions();
1047 } 1048 }
1048 arguments.SetReturn(instructions); 1049 arguments.SetReturn(instructions);
1049 if (instructions.IsNull()) return; 1050 if (instructions.IsNull()) return;
1050 1051
1051 cache.EnsureCapacity(); 1052 cache.EnsureCapacity();
1052 const Smi& class_id = Smi::Handle(Smi::New(cls.id())); 1053 const Smi& class_id = Smi::Handle(Smi::New(is_null ? kNullCid : cls.id()));
1053 cache.Insert(class_id, target); 1054 cache.Insert(class_id, target);
1054 return; 1055 return;
1055 } 1056 }
1056 1057
1057 1058
1058 // Updates IC data for two arguments. Used by the equality operation when 1059 // Updates IC data for two arguments. Used by the equality operation when
1059 // the control flow bypasses regular inline cache (null arguments). 1060 // the control flow bypasses regular inline cache (null arguments).
1060 // Arg0: Receiver object. 1061 // Arg0: Receiver object.
1061 // Arg1: Argument after receiver. 1062 // Arg1: Argument after receiver.
1062 // Arg2: Target's name. 1063 // Arg2: Target's name.
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // Arg1: Value that is being stored. 1726 // Arg1: Value that is being stored.
1726 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1727 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1727 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); 1728 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count());
1728 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1729 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1729 const Object& value = Object::Handle(arguments.ArgAt(1)); 1730 const Object& value = Object::Handle(arguments.ArgAt(1));
1730 1731
1731 field.UpdateCid(Class::Handle(value.clazz()).id()); 1732 field.UpdateCid(Class::Handle(value.clazz()).id());
1732 } 1733 }
1733 1734
1734 } // namespace dart 1735 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698