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

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

Issue 227723002: VM: Implement closure calls as instance calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: minimal inlining tweaks Created 6 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
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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 const Object& result = Object::Handle( 936 const Object& result = Object::Handle(
937 DartEntry::InvokeNoSuchMethod(receiver, 937 DartEntry::InvokeNoSuchMethod(receiver,
938 original_function_name, 938 original_function_name,
939 orig_arguments, 939 orig_arguments,
940 orig_arguments_desc)); 940 orig_arguments_desc));
941 CheckResultError(result); 941 CheckResultError(result);
942 arguments.SetReturn(result); 942 arguments.SetReturn(result);
943 } 943 }
944 944
945 945
946 // A non-closure object was invoked as a closure, so call the "call" method
947 // on it.
948 // Arg0: arguments descriptor.
949 // Arg1: arguments array, including non-closure object.
950 DEFINE_RUNTIME_ENTRY(InvokeNonClosure, 2) {
951 const Array& args_descriptor = Array::CheckedHandle(arguments.ArgAt(0));
952 const Array& function_args = Array::CheckedHandle(arguments.ArgAt(1));
953
954 const Object& result = Object::Handle(
955 DartEntry::InvokeClosure(function_args, args_descriptor));
956 CheckResultError(result);
957 arguments.SetReturn(result);
958 }
959
960
961 static bool CanOptimizeFunction(const Function& function, Isolate* isolate) { 946 static bool CanOptimizeFunction(const Function& function, Isolate* isolate) {
962 const intptr_t kLowInvocationCount = -100000000; 947 const intptr_t kLowInvocationCount = -100000000;
963 if (isolate->debugger()->IsStepping() || 948 if (isolate->debugger()->IsStepping() ||
964 isolate->debugger()->HasBreakpoint(function)) { 949 isolate->debugger()->HasBreakpoint(function)) {
965 // We cannot set breakpoints and single step in optimized code, 950 // We cannot set breakpoints and single step in optimized code,
966 // so do not optimize the function. 951 // so do not optimize the function.
967 function.set_usage_counter(0); 952 function.set_usage_counter(0);
968 return false; 953 return false;
969 } 954 }
970 if (function.deoptimization_counter() >= 955 if (function.deoptimization_counter() >=
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 // of the given value. 1443 // of the given value.
1459 // Arg0: Field object; 1444 // Arg0: Field object;
1460 // Arg1: Value that is being stored. 1445 // Arg1: Value that is being stored.
1461 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1446 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1462 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1447 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1463 const Object& value = Object::Handle(arguments.ArgAt(1)); 1448 const Object& value = Object::Handle(arguments.ArgAt(1));
1464 field.UpdateGuardedCidAndLength(value); 1449 field.UpdateGuardedCidAndLength(value);
1465 } 1450 }
1466 1451
1467 } // namespace dart 1452 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698