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

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

Issue 1191813002: Port "Add flag to disable lazy compilation of invocation dispatchers." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/code_generator.cc ('k') | runtime/vm/stack_frame_test.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/dart_entry.h" 5 #include "vm/dart_entry.h"
6 6
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
11 #include "vm/object_store.h" 11 #include "vm/object_store.h"
12 #include "vm/resolver.h" 12 #include "vm/resolver.h"
13 #include "vm/simulator.h" 13 #include "vm/simulator.h"
14 #include "vm/stub_code.h" 14 #include "vm/stub_code.h"
15 #include "vm/symbols.h" 15 #include "vm/symbols.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 DECLARE_FLAG(bool, lazy_dispatchers);
20
19 // A cache of VM heap allocated arguments descriptors. 21 // A cache of VM heap allocated arguments descriptors.
20 RawArray* ArgumentsDescriptor::cached_args_descriptors_[kCachedDescriptorCount]; 22 RawArray* ArgumentsDescriptor::cached_args_descriptors_[kCachedDescriptorCount];
21 23
22 24
23 RawObject* DartEntry::InvokeFunction(const Function& function, 25 RawObject* DartEntry::InvokeFunction(const Function& function,
24 const Array& arguments) { 26 const Array& arguments) {
25 const Array& arguments_descriptor = 27 const Array& arguments_descriptor =
26 Array::Handle(ArgumentsDescriptor::New(arguments.Length())); 28 Array::Handle(ArgumentsDescriptor::New(arguments.Length()));
27 return InvokeFunction(function, arguments, arguments_descriptor); 29 return InvokeFunction(function, arguments, arguments_descriptor);
28 } 30 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 allocation_args.SetAt(1, arguments_descriptor); 182 allocation_args.SetAt(1, arguments_descriptor);
181 allocation_args.SetAt(2, arguments); 183 allocation_args.SetAt(2, arguments);
182 allocation_args.SetAt(3, Bool::False()); // Not a super invocation. 184 allocation_args.SetAt(3, Bool::False()); // Not a super invocation.
183 const Object& invocation_mirror = Object::Handle( 185 const Object& invocation_mirror = Object::Handle(
184 InvokeFunction(allocation_function, allocation_args)); 186 InvokeFunction(allocation_function, allocation_args));
185 187
186 // Now use the invocation mirror object and invoke NoSuchMethod. 188 // Now use the invocation mirror object and invoke NoSuchMethod.
187 const int kNumArguments = 2; 189 const int kNumArguments = 2;
188 ArgumentsDescriptor args_desc( 190 ArgumentsDescriptor args_desc(
189 Array::Handle(ArgumentsDescriptor::New(kNumArguments))); 191 Array::Handle(ArgumentsDescriptor::New(kNumArguments)));
190 const Function& function = Function::Handle( 192 Function& function = Function::Handle(
191 Resolver::ResolveDynamic(receiver, 193 Resolver::ResolveDynamic(receiver,
192 Symbols::NoSuchMethod(), 194 Symbols::NoSuchMethod(),
193 args_desc)); 195 args_desc));
196 if (function.IsNull()) {
197 ASSERT(!FLAG_lazy_dispatchers);
198 // If noSuchMethod(invocation) is not found, call Object::noSuchMethod.
199 Isolate* isolate = Isolate::Current();
200 function ^= Resolver::ResolveDynamicForReceiverClass(
201 Class::Handle(isolate, isolate->object_store()->object_class()),
202 Symbols::NoSuchMethod(),
203 args_desc);
204 }
194 ASSERT(!function.IsNull()); 205 ASSERT(!function.IsNull());
195 const Array& args = Array::Handle(Array::New(kNumArguments)); 206 const Array& args = Array::Handle(Array::New(kNumArguments));
196 args.SetAt(0, receiver); 207 args.SetAt(0, receiver);
197 args.SetAt(1, invocation_mirror); 208 args.SetAt(1, invocation_mirror);
198 return InvokeFunction(function, args); 209 return InvokeFunction(function, args);
199 } 210 }
200 211
201 212
202 ArgumentsDescriptor::ArgumentsDescriptor(const Array& array) 213 ArgumentsDescriptor::ArgumentsDescriptor(const Array& array)
203 : array_(array) { 214 : array_(array) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 const Array& args = Array::Handle(Array::New(kNumArguments)); 529 const Array& args = Array::Handle(Array::New(kNumArguments));
519 args.SetAt(0, map); 530 args.SetAt(0, map);
520 args.SetAt(1, key); 531 args.SetAt(1, key);
521 args.SetAt(2, value); 532 args.SetAt(2, value);
522 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, 533 const Object& result = Object::Handle(DartEntry::InvokeFunction(function,
523 args)); 534 args));
524 return result.raw(); 535 return result.raw();
525 } 536 }
526 537
527 } // namespace dart 538 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698