| OLD | NEW | 
|    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" | 
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  404 } |  404 } | 
|  405  |  405  | 
|  406  |  406  | 
|  407 RawObject* DartLibraryCalls::InstanceCreate(const Library& lib, |  407 RawObject* DartLibraryCalls::InstanceCreate(const Library& lib, | 
|  408                                             const String& class_name, |  408                                             const String& class_name, | 
|  409                                             const String& constructor_name, |  409                                             const String& constructor_name, | 
|  410                                             const Array& arguments) { |  410                                             const Array& arguments) { | 
|  411   const Class& cls = Class::Handle(lib.LookupClassAllowPrivate(class_name)); |  411   const Class& cls = Class::Handle(lib.LookupClassAllowPrivate(class_name)); | 
|  412   ASSERT(!cls.IsNull()); |  412   ASSERT(!cls.IsNull()); | 
|  413   // For now, we only support a non-parameterized or raw type. |  413   // For now, we only support a non-parameterized or raw type. | 
|  414   const int kNumExtraArgs = 2;  // implicit rcvr and construction phase args. |  414   const int kNumExtraArgs = 1;  // implicit rcvr arg. | 
|  415   const Instance& exception_object = Instance::Handle(Instance::New(cls)); |  415   const Instance& exception_object = Instance::Handle(Instance::New(cls)); | 
|  416   const Array& constructor_arguments = |  416   const Array& constructor_arguments = | 
|  417     Array::Handle(Array::New(arguments.Length() + kNumExtraArgs)); |  417     Array::Handle(Array::New(arguments.Length() + kNumExtraArgs)); | 
|  418   constructor_arguments.SetAt(0, exception_object); |  418   constructor_arguments.SetAt(0, exception_object); | 
|  419   constructor_arguments.SetAt( |  | 
|  420       1, Smi::Handle(Smi::New(Function::kCtorPhaseAll))); |  | 
|  421   Object& obj = Object::Handle(); |  419   Object& obj = Object::Handle(); | 
|  422   for (intptr_t i = 0; i < arguments.Length(); i++) { |  420   for (intptr_t i = 0; i < arguments.Length(); i++) { | 
|  423     obj = arguments.At(i); |  421     obj = arguments.At(i); | 
|  424     constructor_arguments.SetAt((i + kNumExtraArgs), obj); |  422     constructor_arguments.SetAt((i + kNumExtraArgs), obj); | 
|  425   } |  423   } | 
|  426  |  424  | 
|  427   const String& function_name = String::Handle( |  425   const String& function_name = String::Handle( | 
|  428       String::Concat(class_name, constructor_name)); |  426       String::Concat(class_name, constructor_name)); | 
|  429   const Function& constructor = |  427   const Function& constructor = | 
|  430       Function::Handle(cls.LookupConstructorAllowPrivate(function_name)); |  428       Function::Handle(cls.LookupConstructorAllowPrivate(function_name)); | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  592   const Array& args = Array::Handle(Array::New(kNumArguments)); |  590   const Array& args = Array::Handle(Array::New(kNumArguments)); | 
|  593   args.SetAt(0, map); |  591   args.SetAt(0, map); | 
|  594   args.SetAt(1, key); |  592   args.SetAt(1, key); | 
|  595   args.SetAt(2, value); |  593   args.SetAt(2, value); | 
|  596   const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |  594   const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 
|  597                                                                   args)); |  595                                                                   args)); | 
|  598   return result.raw(); |  596   return result.raw(); | 
|  599 } |  597 } | 
|  600  |  598  | 
|  601 }  // namespace dart |  599 }  // namespace dart | 
| OLD | NEW |