| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 (function.kind() == RawFunction::kConstImplicitGetter))); | 503 (function.kind() == RawFunction::kConstImplicitGetter))); |
| 504 // Implicit getters do not need a type check at return, unless they compute | 504 // Implicit getters do not need a type check at return, unless they compute |
| 505 // the initial value of a static field. | 505 // the initial value of a static field. |
| 506 // The body of a constructor cannot modify the type of the | 506 // The body of a constructor cannot modify the type of the |
| 507 // constructed instance, which is passed in as an implicit parameter. | 507 // constructed instance, which is passed in as an implicit parameter. |
| 508 // However, factories may create an instance of the wrong type. | 508 // However, factories may create an instance of the wrong type. |
| 509 if (!is_implicit_dynamic_getter && !function.IsConstructor()) { | 509 if (!is_implicit_dynamic_getter && !function.IsConstructor()) { |
| 510 const AbstractType& dst_type = | 510 const AbstractType& dst_type = |
| 511 AbstractType::ZoneHandle( | 511 AbstractType::ZoneHandle( |
| 512 owner()->parsed_function().function().result_type()); | 512 owner()->parsed_function().function().result_type()); |
| 513 const String& dst_name = String::ZoneHandle(Symbols::FunctionResult()); | |
| 514 return_value = BuildAssignableValue(node->value()->token_pos(), | 513 return_value = BuildAssignableValue(node->value()->token_pos(), |
| 515 return_value, | 514 return_value, |
| 516 dst_type, | 515 dst_type, |
| 517 dst_name); | 516 Symbols::FunctionResult()); |
| 518 } | 517 } |
| 519 } | 518 } |
| 520 | 519 |
| 521 intptr_t current_context_level = owner()->context_level(); | 520 intptr_t current_context_level = owner()->context_level(); |
| 522 ASSERT(current_context_level >= 0); | 521 ASSERT(current_context_level >= 0); |
| 523 if (owner()->parsed_function().saved_context_var() != NULL) { | 522 if (owner()->parsed_function().saved_context_var() != NULL) { |
| 524 // CTX on entry was saved, but not linked as context parent. | 523 // CTX on entry was saved, but not linked as context parent. |
| 525 BuildLoadContext(*owner()->parsed_function().saved_context_var()); | 524 BuildLoadContext(*owner()->parsed_function().saved_context_var()); |
| 526 } else { | 525 } else { |
| 527 while (current_context_level-- > 0) { | 526 while (current_context_level-- > 0) { |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 node->token_pos(), | 1600 node->token_pos(), |
| 1602 node->function_name(), Token::kILLEGAL, arguments, | 1601 node->function_name(), Token::kILLEGAL, arguments, |
| 1603 node->arguments()->names(), 1); | 1602 node->arguments()->names(), 1); |
| 1604 ReturnDefinition(call); | 1603 ReturnDefinition(call); |
| 1605 } | 1604 } |
| 1606 | 1605 |
| 1607 | 1606 |
| 1608 // <Expression> ::= StaticCall { function: Function | 1607 // <Expression> ::= StaticCall { function: Function |
| 1609 // arguments: <ArgumentList> } | 1608 // arguments: <ArgumentList> } |
| 1610 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 1609 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
| 1611 if (node->function().name() == Symbols::Identical()) { | 1610 if (node->function().name() == Symbols::Identical().raw()) { |
| 1612 // Attempt to replace top level defined 'identical' from the core | 1611 // Attempt to replace top level defined 'identical' from the core |
| 1613 // library with strict equal early on. | 1612 // library with strict equal early on. |
| 1614 // TODO(hausner): Evaluate if this can happen at AST building time. | 1613 // TODO(hausner): Evaluate if this can happen at AST building time. |
| 1615 const Class& cls = Class::Handle(node->function().Owner()); | 1614 const Class& cls = Class::Handle(node->function().Owner()); |
| 1616 if (cls.IsTopLevel()) { | 1615 if (cls.IsTopLevel()) { |
| 1617 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1616 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 1618 if (cls.library() == core_lib.raw()) { | 1617 if (cls.library() == core_lib.raw()) { |
| 1619 ASSERT(node->arguments()->length() == 2); | 1618 ASSERT(node->arguments()->length() == 2); |
| 1620 ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth()); | 1619 ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth()); |
| 1621 node->arguments()->NodeAt(0)->Visit(&for_left_value); | 1620 node->arguments()->NodeAt(0)->Visit(&for_left_value); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 const Library& lib = Library::Handle(clazz.library()); | 1751 const Library& lib = Library::Handle(clazz.library()); |
| 1753 | 1752 |
| 1754 const String& expected_class_name = | 1753 const String& expected_class_name = |
| 1755 String::Handle(lib.PrivateName(expected)); | 1754 String::Handle(lib.PrivateName(expected)); |
| 1756 if (!String::Handle(clazz.Name()).Equals(expected_class_name)) { | 1755 if (!String::Handle(clazz.Name()).Equals(expected_class_name)) { |
| 1757 return false; | 1756 return false; |
| 1758 } | 1757 } |
| 1759 | 1758 |
| 1760 const String& function_name = String::Handle(function.name()); | 1759 const String& function_name = String::Handle(function.name()); |
| 1761 const String& expected_function_name = String::Handle( | 1760 const String& expected_function_name = String::Handle( |
| 1762 String::Concat(expected_class_name, Symbols::DotHandle())); | 1761 String::Concat(expected_class_name, Symbols::Dot())); |
| 1763 return function_name.Equals(expected_function_name); | 1762 return function_name.Equals(expected_function_name); |
| 1764 } | 1763 } |
| 1765 | 1764 |
| 1766 | 1765 |
| 1767 static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) { | 1766 static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) { |
| 1768 const Function& function = node->constructor(); | 1767 const Function& function = node->constructor(); |
| 1769 const Class& function_class = Class::Handle(function.Owner()); | 1768 const Class& function_class = Class::Handle(function.Owner()); |
| 1770 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1769 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 1771 | 1770 |
| 1772 if (function_class.library() != core_lib.raw()) { | 1771 if (function_class.library() != core_lib.raw()) { |
| 1773 return kDynamicCid; | 1772 return kDynamicCid; |
| 1774 } | 1773 } |
| 1775 | 1774 |
| 1776 if (node->constructor().IsFactory()) { | 1775 if (node->constructor().IsFactory()) { |
| 1777 if ((function_class.Name() == Symbols::List()) && | 1776 if ((function_class.Name() == Symbols::List().raw()) && |
| 1778 (function.name() == Symbols::ListFactory())) { | 1777 (function.name() == Symbols::ListFactory().raw())) { |
| 1779 // If there are no arguments then the result is guaranteed to be a | 1778 // If there are no arguments then the result is guaranteed to be a |
| 1780 // GrowableObjectArray. However if there is an argument the result | 1779 // GrowableObjectArray. However if there is an argument the result |
| 1781 // is not guaranteed to be a fixed size array because the argument | 1780 // is not guaranteed to be a fixed size array because the argument |
| 1782 // can be null. | 1781 // can be null. |
| 1783 if (node->arguments()->length() == 0) { | 1782 if (node->arguments()->length() == 0) { |
| 1784 return kGrowableObjectArrayCid; | 1783 return kGrowableObjectArrayCid; |
| 1785 } | 1784 } |
| 1786 } else { | 1785 } else { |
| 1787 if (IsRecognizedConstructor(function, | 1786 if (IsRecognizedConstructor(function, Symbols::ObjectArray()) && |
| 1788 String::Handle(Symbols::ObjectArray())) && | |
| 1789 (node->arguments()->length() == 1)) { | 1787 (node->arguments()->length() == 1)) { |
| 1790 return kArrayCid; | 1788 return kArrayCid; |
| 1791 } else if (IsRecognizedConstructor(function, | 1789 } else if (IsRecognizedConstructor(function, |
| 1792 String::Handle(Symbols::GrowableObjectArray())) && | 1790 Symbols::GrowableObjectArray()) && |
| 1793 (node->arguments()->length() == 0)) { | 1791 (node->arguments()->length() == 0)) { |
| 1794 return kGrowableObjectArrayCid; | 1792 return kGrowableObjectArrayCid; |
| 1795 } | 1793 } |
| 1796 } | 1794 } |
| 1797 } | 1795 } |
| 1798 return kDynamicCid; // Result cid not known. | 1796 return kDynamicCid; // Result cid not known. |
| 1799 } | 1797 } |
| 1800 | 1798 |
| 1801 | 1799 |
| 1802 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 1800 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2389 ReturnDefinition(BuildStoreStaticField(node, kResultNeeded)); | 2387 ReturnDefinition(BuildStoreStaticField(node, kResultNeeded)); |
| 2390 } | 2388 } |
| 2391 | 2389 |
| 2392 | 2390 |
| 2393 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { | 2391 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { |
| 2394 Function* super_function = NULL; | 2392 Function* super_function = NULL; |
| 2395 if (node->IsSuperLoad()) { | 2393 if (node->IsSuperLoad()) { |
| 2396 // Resolve the load indexed operator in the super class. | 2394 // Resolve the load indexed operator in the super class. |
| 2397 super_function = &Function::ZoneHandle( | 2395 super_function = &Function::ZoneHandle( |
| 2398 Resolver::ResolveDynamicAnyArgs(node->super_class(), | 2396 Resolver::ResolveDynamicAnyArgs(node->super_class(), |
| 2399 Symbols::IndexTokenHandle())); | 2397 Symbols::IndexToken())); |
| 2400 if (super_function->IsNull()) { | 2398 if (super_function->IsNull()) { |
| 2401 // Could not resolve super operator. Generate call noSuchMethod() of the | 2399 // Could not resolve super operator. Generate call noSuchMethod() of the |
| 2402 // super class instead. | 2400 // super class instead. |
| 2403 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); | 2401 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); |
| 2404 arguments->Add(node->array()); | 2402 arguments->Add(node->array()); |
| 2405 arguments->Add(node->index_expr()); | 2403 arguments->Add(node->index_expr()); |
| 2406 StaticCallInstr* call = | 2404 StaticCallInstr* call = |
| 2407 BuildStaticNoSuchMethodCall(node->super_class(), | 2405 BuildStaticNoSuchMethodCall(node->super_class(), |
| 2408 node->array(), | 2406 node->array(), |
| 2409 Symbols::IndexTokenHandle(), | 2407 Symbols::IndexToken(), |
| 2410 arguments); | 2408 arguments); |
| 2411 ReturnDefinition(call); | 2409 ReturnDefinition(call); |
| 2412 return; | 2410 return; |
| 2413 } | 2411 } |
| 2414 } | 2412 } |
| 2415 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2413 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2416 new ZoneGrowableArray<PushArgumentInstr*>(2); | 2414 new ZoneGrowableArray<PushArgumentInstr*>(2); |
| 2417 ValueGraphVisitor for_array(owner(), temp_index(), loop_depth()); | 2415 ValueGraphVisitor for_array(owner(), temp_index(), loop_depth()); |
| 2418 node->array()->Visit(&for_array); | 2416 node->array()->Visit(&for_array); |
| 2419 Append(for_array); | 2417 Append(for_array); |
| 2420 arguments->Add(PushArgument(for_array.value())); | 2418 arguments->Add(PushArgument(for_array.value())); |
| 2421 | 2419 |
| 2422 ValueGraphVisitor for_index(owner(), temp_index(), loop_depth()); | 2420 ValueGraphVisitor for_index(owner(), temp_index(), loop_depth()); |
| 2423 node->index_expr()->Visit(&for_index); | 2421 node->index_expr()->Visit(&for_index); |
| 2424 Append(for_index); | 2422 Append(for_index); |
| 2425 arguments->Add(PushArgument(for_index.value())); | 2423 arguments->Add(PushArgument(for_index.value())); |
| 2426 | 2424 |
| 2427 if (super_function != NULL) { | 2425 if (super_function != NULL) { |
| 2428 // Generate static call to super operator. | 2426 // Generate static call to super operator. |
| 2429 StaticCallInstr* load = new StaticCallInstr(node->token_pos(), | 2427 StaticCallInstr* load = new StaticCallInstr(node->token_pos(), |
| 2430 *super_function, | 2428 *super_function, |
| 2431 Array::ZoneHandle(), | 2429 Array::ZoneHandle(), |
| 2432 arguments); | 2430 arguments); |
| 2433 ReturnDefinition(load); | 2431 ReturnDefinition(load); |
| 2434 } else { | 2432 } else { |
| 2435 // Generate dynamic call to index operator. | 2433 // Generate dynamic call to index operator. |
| 2436 const intptr_t checked_argument_count = 1; | 2434 const intptr_t checked_argument_count = 1; |
| 2437 InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(), | 2435 InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(), |
| 2438 Symbols::IndexTokenHandle(), | 2436 Symbols::IndexToken(), |
| 2439 Token::kINDEX, | 2437 Token::kINDEX, |
| 2440 arguments, | 2438 arguments, |
| 2441 Array::ZoneHandle(), | 2439 Array::ZoneHandle(), |
| 2442 checked_argument_count); | 2440 checked_argument_count); |
| 2443 ReturnDefinition(load); | 2441 ReturnDefinition(load); |
| 2444 } | 2442 } |
| 2445 } | 2443 } |
| 2446 | 2444 |
| 2447 | 2445 |
| 2448 Definition* EffectGraphVisitor::BuildStoreIndexedValues( | 2446 Definition* EffectGraphVisitor::BuildStoreIndexedValues( |
| 2449 StoreIndexedNode* node, | 2447 StoreIndexedNode* node, |
| 2450 bool result_is_needed) { | 2448 bool result_is_needed) { |
| 2451 Function* super_function = NULL; | 2449 Function* super_function = NULL; |
| 2452 if (node->IsSuperStore()) { | 2450 if (node->IsSuperStore()) { |
| 2453 // Resolve the store indexed operator in the super class. | 2451 // Resolve the store indexed operator in the super class. |
| 2454 super_function = &Function::ZoneHandle( | 2452 super_function = &Function::ZoneHandle( |
| 2455 Resolver::ResolveDynamicAnyArgs(node->super_class(), | 2453 Resolver::ResolveDynamicAnyArgs(node->super_class(), |
| 2456 Symbols::AssignIndexTokenHandle())); | 2454 Symbols::AssignIndexToken())); |
| 2457 if (super_function->IsNull()) { | 2455 if (super_function->IsNull()) { |
| 2458 // Could not resolve super operator. Generate call noSuchMethod() of the | 2456 // Could not resolve super operator. Generate call noSuchMethod() of the |
| 2459 // super class instead. | 2457 // super class instead. |
| 2460 if (result_is_needed) { | 2458 if (result_is_needed) { |
| 2461 // Even though noSuchMethod most likely does not return, | 2459 // Even though noSuchMethod most likely does not return, |
| 2462 // we save the stored value if the result is needed. | 2460 // we save the stored value if the result is needed. |
| 2463 ValueGraphVisitor for_value(owner(), temp_index(), loop_depth()); | 2461 ValueGraphVisitor for_value(owner(), temp_index(), loop_depth()); |
| 2464 node->value()->Visit(&for_value); | 2462 node->value()->Visit(&for_value); |
| 2465 Append(for_value); | 2463 Append(for_value); |
| 2466 Bind(BuildStoreExprTemp(for_value.value())); | 2464 Bind(BuildStoreExprTemp(for_value.value())); |
| 2467 } | 2465 } |
| 2468 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); | 2466 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); |
| 2469 arguments->Add(node->array()); | 2467 arguments->Add(node->array()); |
| 2470 arguments->Add(node->index_expr()); | 2468 arguments->Add(node->index_expr()); |
| 2471 arguments->Add(node->value()); | 2469 arguments->Add(node->value()); |
| 2472 StaticCallInstr* call = | 2470 StaticCallInstr* call = |
| 2473 BuildStaticNoSuchMethodCall(node->super_class(), | 2471 BuildStaticNoSuchMethodCall(node->super_class(), |
| 2474 node->array(), | 2472 node->array(), |
| 2475 Symbols::AssignIndexTokenHandle(), | 2473 Symbols::AssignIndexToken(), |
| 2476 arguments); | 2474 arguments); |
| 2477 if (result_is_needed) { | 2475 if (result_is_needed) { |
| 2478 Do(call); | 2476 Do(call); |
| 2479 return BuildLoadExprTemp(); | 2477 return BuildLoadExprTemp(); |
| 2480 } else { | 2478 } else { |
| 2481 return call; | 2479 return call; |
| 2482 } | 2480 } |
| 2483 } | 2481 } |
| 2484 } | 2482 } |
| 2485 | 2483 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2799 | 2797 |
| 2800 // Looks up dynamic method noSuchMethod in target_class | 2798 // Looks up dynamic method noSuchMethod in target_class |
| 2801 // (including its super class chain) and builds a static call to it. | 2799 // (including its super class chain) and builds a static call to it. |
| 2802 StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( | 2800 StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( |
| 2803 const Class& target_class, | 2801 const Class& target_class, |
| 2804 AstNode* receiver, | 2802 AstNode* receiver, |
| 2805 const String& method_name, | 2803 const String& method_name, |
| 2806 ArgumentListNode* method_arguments) { | 2804 ArgumentListNode* method_arguments) { |
| 2807 // Build the graph to allocate an InvocationMirror object by calling | 2805 // Build the graph to allocate an InvocationMirror object by calling |
| 2808 // the static allocation method. | 2806 // the static allocation method. |
| 2809 const String& mirror_name = String::Handle(Symbols::InvocationMirror()); | |
| 2810 const Library& corelib = Library::Handle(Library::CoreLibrary()); | 2807 const Library& corelib = Library::Handle(Library::CoreLibrary()); |
| 2811 const Class& mirror_class = Class::Handle( | 2808 const Class& mirror_class = Class::Handle( |
| 2812 corelib.LookupClassAllowPrivate(mirror_name)); | 2809 corelib.LookupClassAllowPrivate(Symbols::InvocationMirror())); |
| 2813 ASSERT(!mirror_class.IsNull()); | 2810 ASSERT(!mirror_class.IsNull()); |
| 2814 const String& function_name = String::Handle( | |
| 2815 Symbols::AllocateInvocationMirror()); | |
| 2816 const Function& allocation_function = Function::ZoneHandle( | 2811 const Function& allocation_function = Function::ZoneHandle( |
| 2817 Resolver::ResolveStaticByName(mirror_class, | 2812 Resolver::ResolveStaticByName(mirror_class, |
| 2818 function_name, | 2813 Symbols::AllocateInvocationMirror(), |
| 2819 Resolver::kIsQualified)); | 2814 Resolver::kIsQualified)); |
| 2820 ASSERT(!allocation_function.IsNull()); | 2815 ASSERT(!allocation_function.IsNull()); |
| 2821 | 2816 |
| 2822 // Evaluate the receiver before the arguments. This will be used | 2817 // Evaluate the receiver before the arguments. This will be used |
| 2823 // as an argument to the noSuchMethod call. | 2818 // as an argument to the noSuchMethod call. |
| 2824 ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth()); | 2819 ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth()); |
| 2825 receiver->Visit(&for_receiver); | 2820 receiver->Visit(&for_receiver); |
| 2826 Append(for_receiver); | 2821 Append(for_receiver); |
| 2827 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); | 2822 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); |
| 2828 | 2823 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2848 ZoneGrowableArray<PushArgumentInstr*>* allocation_args = | 2843 ZoneGrowableArray<PushArgumentInstr*>* allocation_args = |
| 2849 new ZoneGrowableArray<PushArgumentInstr*>(arguments->length()); | 2844 new ZoneGrowableArray<PushArgumentInstr*>(arguments->length()); |
| 2850 BuildPushArguments(*arguments, allocation_args); | 2845 BuildPushArguments(*arguments, allocation_args); |
| 2851 StaticCallInstr* allocation = new StaticCallInstr(args_pos, | 2846 StaticCallInstr* allocation = new StaticCallInstr(args_pos, |
| 2852 allocation_function, | 2847 allocation_function, |
| 2853 Array::ZoneHandle(), | 2848 Array::ZoneHandle(), |
| 2854 allocation_args); | 2849 allocation_args); |
| 2855 Value* invocation_mirror = Bind(allocation); | 2850 Value* invocation_mirror = Bind(allocation); |
| 2856 PushArgumentInstr* push_invocation_mirror = PushArgument(invocation_mirror); | 2851 PushArgumentInstr* push_invocation_mirror = PushArgument(invocation_mirror); |
| 2857 // Lookup noSuchMethod and call it with the receiver and the InvocationMirror. | 2852 // Lookup noSuchMethod and call it with the receiver and the InvocationMirror. |
| 2858 const String& no_such_method_name = | |
| 2859 String::ZoneHandle(Symbols::NoSuchMethod()); | |
| 2860 const Function& no_such_method_func = Function::ZoneHandle( | 2853 const Function& no_such_method_func = Function::ZoneHandle( |
| 2861 Resolver::ResolveDynamicAnyArgs(target_class, no_such_method_name)); | 2854 Resolver::ResolveDynamicAnyArgs(target_class, Symbols::NoSuchMethod())); |
| 2862 // We are guaranteed to find noSuchMethod of class Object. | 2855 // We are guaranteed to find noSuchMethod of class Object. |
| 2863 ASSERT(!no_such_method_func.IsNull()); | 2856 ASSERT(!no_such_method_func.IsNull()); |
| 2864 ZoneGrowableArray<PushArgumentInstr*>* args = | 2857 ZoneGrowableArray<PushArgumentInstr*>* args = |
| 2865 new ZoneGrowableArray<PushArgumentInstr*>(2); | 2858 new ZoneGrowableArray<PushArgumentInstr*>(2); |
| 2866 args->Add(push_receiver); | 2859 args->Add(push_receiver); |
| 2867 args->Add(push_invocation_mirror); | 2860 args->Add(push_invocation_mirror); |
| 2868 return new StaticCallInstr(args_pos, | 2861 return new StaticCallInstr(args_pos, |
| 2869 no_such_method_func, | 2862 no_such_method_func, |
| 2870 Array::ZoneHandle(), | 2863 Array::ZoneHandle(), |
| 2871 args); | 2864 args); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2899 arguments->Add(PushArgument(arguments_value)); | 2892 arguments->Add(PushArgument(arguments_value)); |
| 2900 // List argumentNames. | 2893 // List argumentNames. |
| 2901 Value* argument_names_value = | 2894 Value* argument_names_value = |
| 2902 Bind(new ConstantInstr(Array::ZoneHandle())); | 2895 Bind(new ConstantInstr(Array::ZoneHandle())); |
| 2903 arguments->Add(PushArgument(argument_names_value)); | 2896 arguments->Add(PushArgument(argument_names_value)); |
| 2904 // List existingArgumentNames. | 2897 // List existingArgumentNames. |
| 2905 Value* existing_argument_names_value = | 2898 Value* existing_argument_names_value = |
| 2906 Bind(new ConstantInstr(Array::ZoneHandle())); | 2899 Bind(new ConstantInstr(Array::ZoneHandle())); |
| 2907 arguments->Add(PushArgument(existing_argument_names_value)); | 2900 arguments->Add(PushArgument(existing_argument_names_value)); |
| 2908 // Resolve and call NoSuchMethodError._throwNew. | 2901 // Resolve and call NoSuchMethodError._throwNew. |
| 2909 const String& cls_name = String::Handle(Symbols::NoSuchMethodError()); | 2902 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 2910 const String& func_name = String::Handle(Symbols::ThrowNew()); | |
| 2911 const Class& cls = Class::Handle( | 2903 const Class& cls = Class::Handle( |
| 2912 Library::Handle(Library::CoreLibrary()).LookupClass(cls_name)); | 2904 core_lib.LookupClass(Symbols::NoSuchMethodError())); |
| 2913 ASSERT(!cls.IsNull()); | 2905 ASSERT(!cls.IsNull()); |
| 2914 const Function& func = Function::ZoneHandle( | 2906 const Function& func = Function::ZoneHandle( |
| 2915 Resolver::ResolveStatic(cls, | 2907 Resolver::ResolveStatic(cls, |
| 2916 func_name, | 2908 Symbols::ThrowNew(), |
| 2917 arguments->length(), | 2909 arguments->length(), |
| 2918 Array::ZoneHandle(), | 2910 Array::ZoneHandle(), |
| 2919 Resolver::kIsQualified)); | 2911 Resolver::kIsQualified)); |
| 2920 ASSERT(!func.IsNull()); | 2912 ASSERT(!func.IsNull()); |
| 2921 return new StaticCallInstr(token_pos, | 2913 return new StaticCallInstr(token_pos, |
| 2922 func, | 2914 func, |
| 2923 Array::ZoneHandle(), // No names. | 2915 Array::ZoneHandle(), // No names. |
| 2924 arguments); | 2916 arguments); |
| 2925 } | 2917 } |
| 2926 | 2918 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3039 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3031 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3040 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3032 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3041 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3033 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3042 const Error& error = Error::Handle( | 3034 const Error& error = Error::Handle( |
| 3043 LanguageError::New(String::Handle(String::New(chars)))); | 3035 LanguageError::New(String::Handle(String::New(chars)))); |
| 3044 Isolate::Current()->long_jump_base()->Jump(1, error); | 3036 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3045 } | 3037 } |
| 3046 | 3038 |
| 3047 | 3039 |
| 3048 } // namespace dart | 3040 } // namespace dart |
| OLD | NEW |