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

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

Issue 19774007: Collect both arguments for math's min/max static functions. Later that information will be used to … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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) 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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 GrowableArray<const Instance*> args(3); 1017 GrowableArray<const Instance*> args(3);
1018 args.Add(&receiver); 1018 args.Add(&receiver);
1019 args.Add(&arg1); 1019 args.Add(&arg1);
1020 args.Add(&arg2); 1020 args.Add(&arg2);
1021 const Function& result = 1021 const Function& result =
1022 Function::Handle(InlineCacheMissHandler(args, ic_data)); 1022 Function::Handle(InlineCacheMissHandler(args, ic_data));
1023 arguments.SetReturn(result); 1023 arguments.SetReturn(result);
1024 } 1024 }
1025 1025
1026 1026
1027 // Handles a static call in unoptimized code that has two arguments types not
regis 2013/07/18 21:30:18 arguments -> argument
srdjan 2013/07/18 22:17:06 Done.
1028 // seen before. Compile the target if necessary and update the ICData.
1029 // Arg0: argument 0.
1030 // Arg1: argument 1.
1031 // Arg2: IC data object.
1032 DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerTwoArgs, 3) {
1033 ASSERT(arguments.ArgCount() ==
1034 kStaticCallMissHandlerTwoArgsRuntimeEntry.argument_count());
1035 const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0));
1036 const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1));
1037 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2));
1038 // IC data for static call is prepopulated with the statically known target.
1039 ASSERT(ic_data.NumberOfChecks() > 0);
1040 const Function& target = Function::Handle(ic_data.GetTargetAt(0));
1041 if (!target.HasCode()) {
1042 const Error& error = Error::Handle(Compiler::CompileFunction(target));
1043 if (!error.IsNull()) {
1044 Exceptions::PropagateError(error);
1045 }
1046 }
1047 ASSERT(!target.IsNull() && target.HasCode());
1048 GrowableArray<intptr_t> cids(2);
1049 cids.Add(arg0.GetClassId());
1050 cids.Add(arg1.GetClassId());
1051 ic_data.AddCheck(cids, target);
1052 if (FLAG_trace_ic) {
1053 DartFrameIterator iterator;
1054 StackFrame* caller_frame = iterator.NextFrame();
1055 ASSERT(caller_frame != NULL);
1056 OS::PrintErr("StaticCallMissHandler at %#"Px" target %s (%"Pd", %"Pd")\n",
1057 caller_frame->pc(), target.ToCString(), cids[0], cids[1]);
1058 }
1059 arguments.SetReturn(target);
1060 }
1061
1062
1027 // Handle a miss of a megamorphic cache. 1063 // Handle a miss of a megamorphic cache.
1028 // Arg0: Receiver. 1064 // Arg0: Receiver.
1029 // Arg1: ICData object. 1065 // Arg1: ICData object.
1030 // Arg2: Arguments descriptor array. 1066 // Arg2: Arguments descriptor array.
1031 1067
1032 // Returns: target instructions to call or null if the 1068 // Returns: target instructions to call or null if the
1033 // InstanceFunctionLookup stub should be used (e.g., to invoke no such 1069 // InstanceFunctionLookup stub should be used (e.g., to invoke no such
1034 // method and implicit closures).. 1070 // method and implicit closures)..
1035 DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) { 1071 DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) {
1036 ASSERT(arguments.ArgCount() == 1072 ASSERT(arguments.ArgCount() ==
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 // Arg1: Value that is being stored. 1913 // Arg1: Value that is being stored.
1878 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1914 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1879 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); 1915 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count());
1880 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1916 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1881 const Object& value = Object::Handle(arguments.ArgAt(1)); 1917 const Object& value = Object::Handle(arguments.ArgAt(1));
1882 1918
1883 field.UpdateCid(value.GetClassId()); 1919 field.UpdateCid(value.GetClassId());
1884 } 1920 }
1885 1921
1886 } // namespace dart 1922 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698