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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 node->token_pos(), | 1592 node->token_pos(), |
1594 node->function_name(), Token::kILLEGAL, arguments, | 1593 node->function_name(), Token::kILLEGAL, arguments, |
1595 node->arguments()->names(), 1); | 1594 node->arguments()->names(), 1); |
1596 ReturnDefinition(call); | 1595 ReturnDefinition(call); |
1597 } | 1596 } |
1598 | 1597 |
1599 | 1598 |
1600 // <Expression> ::= StaticCall { function: Function | 1599 // <Expression> ::= StaticCall { function: Function |
1601 // arguments: <ArgumentList> } | 1600 // arguments: <ArgumentList> } |
1602 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 1601 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
1603 if (node->function().name() == Symbols::Identical()) { | 1602 if (node->function().name() == Symbols::Identical().raw()) { |
1604 // Attempt to replace top level defined 'identical' from the core | 1603 // Attempt to replace top level defined 'identical' from the core |
1605 // library with strict equal early on. | 1604 // library with strict equal early on. |
1606 // TODO(hausner): Evaluate if this can happen at AST building time. | 1605 // TODO(hausner): Evaluate if this can happen at AST building time. |
1607 const Class& cls = Class::Handle(node->function().Owner()); | 1606 const Class& cls = Class::Handle(node->function().Owner()); |
1608 if (cls.IsTopLevel()) { | 1607 if (cls.IsTopLevel()) { |
1609 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1608 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
1610 if (cls.library() == core_lib.raw()) { | 1609 if (cls.library() == core_lib.raw()) { |
1611 ASSERT(node->arguments()->length() == 2); | 1610 ASSERT(node->arguments()->length() == 2); |
1612 ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth()); | 1611 ValueGraphVisitor for_left_value(owner(), temp_index(), loop_depth()); |
1613 node->arguments()->NodeAt(0)->Visit(&for_left_value); | 1612 node->arguments()->NodeAt(0)->Visit(&for_left_value); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 const Library& lib = Library::Handle(clazz.library()); | 1743 const Library& lib = Library::Handle(clazz.library()); |
1745 | 1744 |
1746 const String& expected_class_name = | 1745 const String& expected_class_name = |
1747 String::Handle(lib.PrivateName(expected)); | 1746 String::Handle(lib.PrivateName(expected)); |
1748 if (!String::Handle(clazz.Name()).Equals(expected_class_name)) { | 1747 if (!String::Handle(clazz.Name()).Equals(expected_class_name)) { |
1749 return false; | 1748 return false; |
1750 } | 1749 } |
1751 | 1750 |
1752 const String& function_name = String::Handle(function.name()); | 1751 const String& function_name = String::Handle(function.name()); |
1753 const String& expected_function_name = String::Handle( | 1752 const String& expected_function_name = String::Handle( |
1754 String::Concat(expected_class_name, Symbols::DotHandle())); | 1753 String::Concat(expected_class_name, Symbols::Dot())); |
1755 return function_name.Equals(expected_function_name); | 1754 return function_name.Equals(expected_function_name); |
1756 } | 1755 } |
1757 | 1756 |
1758 | 1757 |
1759 static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) { | 1758 static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) { |
1760 const Function& function = node->constructor(); | 1759 const Function& function = node->constructor(); |
1761 const Class& function_class = Class::Handle(function.Owner()); | 1760 const Class& function_class = Class::Handle(function.Owner()); |
1762 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 1761 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
1763 | 1762 |
1764 if (function_class.library() != core_lib.raw()) { | 1763 if (function_class.library() != core_lib.raw()) { |
1765 return kDynamicCid; | 1764 return kDynamicCid; |
1766 } | 1765 } |
1767 | 1766 |
1768 if (node->constructor().IsFactory()) { | 1767 if (node->constructor().IsFactory()) { |
1769 if ((function_class.Name() == Symbols::List()) && | 1768 if ((function_class.Name() == Symbols::List().raw()) && |
1770 (function.name() == Symbols::ListFactory())) { | 1769 (function.name() == Symbols::ListFactory().raw())) { |
1771 // If there are no arguments then the result is guaranteed to be a | 1770 // If there are no arguments then the result is guaranteed to be a |
1772 // GrowableObjectArray. However if there is an argument the result | 1771 // GrowableObjectArray. However if there is an argument the result |
1773 // is not guaranteed to be a fixed size array because the argument | 1772 // is not guaranteed to be a fixed size array because the argument |
1774 // can be null. | 1773 // can be null. |
1775 if (node->arguments()->length() == 0) { | 1774 if (node->arguments()->length() == 0) { |
1776 return kGrowableObjectArrayCid; | 1775 return kGrowableObjectArrayCid; |
1777 } | 1776 } |
1778 } else { | 1777 } else { |
1779 if (IsRecognizedConstructor(function, | 1778 if (IsRecognizedConstructor(function, Symbols::ObjectArray()) && |
1780 String::Handle(Symbols::ObjectArray())) && | |
1781 (node->arguments()->length() == 1)) { | 1779 (node->arguments()->length() == 1)) { |
1782 return kArrayCid; | 1780 return kArrayCid; |
1783 } else if (IsRecognizedConstructor(function, | 1781 } else if (IsRecognizedConstructor(function, |
1784 String::Handle(Symbols::GrowableObjectArray())) && | 1782 Symbols::GrowableObjectArray()) && |
1785 (node->arguments()->length() == 0)) { | 1783 (node->arguments()->length() == 0)) { |
1786 return kGrowableObjectArrayCid; | 1784 return kGrowableObjectArrayCid; |
1787 } | 1785 } |
1788 } | 1786 } |
1789 } | 1787 } |
1790 return kDynamicCid; // Result cid not known. | 1788 return kDynamicCid; // Result cid not known. |
1791 } | 1789 } |
1792 | 1790 |
1793 | 1791 |
1794 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { | 1792 void EffectGraphVisitor::VisitConstructorCallNode(ConstructorCallNode* node) { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2129 // NoSuchMethodError. | 2127 // NoSuchMethodError. |
2130 | 2128 |
2131 // Location argument. | 2129 // Location argument. |
2132 Value* call_pos = Bind( | 2130 Value* call_pos = Bind( |
2133 new ConstantInstr(Smi::ZoneHandle(Smi::New(node->token_pos())))); | 2131 new ConstantInstr(Smi::ZoneHandle(Smi::New(node->token_pos())))); |
2134 arguments->Add(PushArgument(call_pos)); | 2132 arguments->Add(PushArgument(call_pos)); |
2135 // Function name argument. | 2133 // Function name argument. |
2136 const String& method_name = String::ZoneHandle(Symbols::New(getter_name)); | 2134 const String& method_name = String::ZoneHandle(Symbols::New(getter_name)); |
2137 Value* method_name_value = Bind(new ConstantInstr(method_name)); | 2135 Value* method_name_value = Bind(new ConstantInstr(method_name)); |
2138 arguments->Add(PushArgument(method_name_value)); | 2136 arguments->Add(PushArgument(method_name_value)); |
2139 const String& cls_name = String::Handle(Symbols::NoSuchMethodError()); | 2137 const Class& cls = Class::Handle(Library::Handle( |
2140 const String& func_name = String::Handle(Symbols::ThrowNew()); | 2138 Library::CoreLibrary()).LookupClass( |
2141 const Class& cls = Class::Handle( | 2139 Symbols::NoSuchMethodErrorImpl())); |
2142 Library::Handle(Library::CoreLibrary()).LookupClass(cls_name)); | |
2143 ASSERT(!cls.IsNull()); | 2140 ASSERT(!cls.IsNull()); |
2144 getter_function = Resolver::ResolveStatic(cls, | 2141 getter_function = Resolver::ResolveStatic(cls, |
2145 func_name, | 2142 Symbols::ThrowNew(), |
2146 arguments->length(), | 2143 arguments->length(), |
2147 Array::ZoneHandle(), | 2144 Object::empty_array(), |
2148 Resolver::kIsQualified); | 2145 Resolver::kIsQualified); |
2149 ASSERT(!getter_function.IsNull()); | 2146 ASSERT(!getter_function.IsNull()); |
2150 } | 2147 } |
2151 } | 2148 } |
2152 StaticCallInstr* call = new StaticCallInstr(node->token_pos(), | 2149 StaticCallInstr* call = new StaticCallInstr(node->token_pos(), |
2153 getter_function, | 2150 getter_function, |
2154 Array::ZoneHandle(), // No names. | 2151 Array::ZoneHandle(), // No names. |
2155 arguments); | 2152 arguments); |
2156 ReturnDefinition(call); | 2153 ReturnDefinition(call); |
2157 } | 2154 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2365 ReturnDefinition(BuildStoreStaticField(node, kResultNeeded)); | 2362 ReturnDefinition(BuildStoreStaticField(node, kResultNeeded)); |
2366 } | 2363 } |
2367 | 2364 |
2368 | 2365 |
2369 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { | 2366 void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) { |
2370 Function* super_function = NULL; | 2367 Function* super_function = NULL; |
2371 if (node->IsSuperLoad()) { | 2368 if (node->IsSuperLoad()) { |
2372 // Resolve the load indexed operator in the super class. | 2369 // Resolve the load indexed operator in the super class. |
2373 super_function = &Function::ZoneHandle( | 2370 super_function = &Function::ZoneHandle( |
2374 Resolver::ResolveDynamicAnyArgs(node->super_class(), | 2371 Resolver::ResolveDynamicAnyArgs(node->super_class(), |
2375 Symbols::IndexTokenHandle())); | 2372 Symbols::IndexToken())); |
2376 if (super_function->IsNull()) { | 2373 if (super_function->IsNull()) { |
2377 // Could not resolve super operator. Generate call noSuchMethod() of the | 2374 // Could not resolve super operator. Generate call noSuchMethod() of the |
2378 // super class instead. | 2375 // super class instead. |
2379 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); | 2376 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); |
2380 arguments->Add(node->index_expr()); | 2377 arguments->Add(node->index_expr()); |
2381 StaticCallInstr* call = | 2378 StaticCallInstr* call = |
2382 BuildStaticNoSuchMethodCall(node->super_class(), | 2379 BuildStaticNoSuchMethodCall(node->super_class(), |
2383 node->array(), | 2380 node->array(), |
2384 Symbols::IndexTokenHandle(), | 2381 Symbols::IndexToken(), |
2385 arguments); | 2382 arguments); |
2386 ReturnDefinition(call); | 2383 ReturnDefinition(call); |
2387 return; | 2384 return; |
2388 } | 2385 } |
2389 } | 2386 } |
2390 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2387 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
2391 new ZoneGrowableArray<PushArgumentInstr*>(2); | 2388 new ZoneGrowableArray<PushArgumentInstr*>(2); |
2392 ValueGraphVisitor for_array(owner(), temp_index(), loop_depth()); | 2389 ValueGraphVisitor for_array(owner(), temp_index(), loop_depth()); |
2393 node->array()->Visit(&for_array); | 2390 node->array()->Visit(&for_array); |
2394 Append(for_array); | 2391 Append(for_array); |
2395 arguments->Add(PushArgument(for_array.value())); | 2392 arguments->Add(PushArgument(for_array.value())); |
2396 | 2393 |
2397 ValueGraphVisitor for_index(owner(), temp_index(), loop_depth()); | 2394 ValueGraphVisitor for_index(owner(), temp_index(), loop_depth()); |
2398 node->index_expr()->Visit(&for_index); | 2395 node->index_expr()->Visit(&for_index); |
2399 Append(for_index); | 2396 Append(for_index); |
2400 arguments->Add(PushArgument(for_index.value())); | 2397 arguments->Add(PushArgument(for_index.value())); |
2401 | 2398 |
2402 if (super_function != NULL) { | 2399 if (super_function != NULL) { |
2403 // Generate static call to super operator. | 2400 // Generate static call to super operator. |
2404 StaticCallInstr* load = new StaticCallInstr(node->token_pos(), | 2401 StaticCallInstr* load = new StaticCallInstr(node->token_pos(), |
2405 *super_function, | 2402 *super_function, |
2406 Array::ZoneHandle(), | 2403 Array::ZoneHandle(), |
2407 arguments); | 2404 arguments); |
2408 ReturnDefinition(load); | 2405 ReturnDefinition(load); |
2409 } else { | 2406 } else { |
2410 // Generate dynamic call to index operator. | 2407 // Generate dynamic call to index operator. |
2411 const intptr_t checked_argument_count = 1; | 2408 const intptr_t checked_argument_count = 1; |
2412 InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(), | 2409 InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(), |
2413 Symbols::IndexTokenHandle(), | 2410 Symbols::IndexToken(), |
2414 Token::kINDEX, | 2411 Token::kINDEX, |
2415 arguments, | 2412 arguments, |
2416 Array::ZoneHandle(), | 2413 Array::ZoneHandle(), |
2417 checked_argument_count); | 2414 checked_argument_count); |
2418 ReturnDefinition(load); | 2415 ReturnDefinition(load); |
2419 } | 2416 } |
2420 } | 2417 } |
2421 | 2418 |
2422 | 2419 |
2423 Definition* EffectGraphVisitor::BuildStoreIndexedValues( | 2420 Definition* EffectGraphVisitor::BuildStoreIndexedValues( |
2424 StoreIndexedNode* node, | 2421 StoreIndexedNode* node, |
2425 bool result_is_needed) { | 2422 bool result_is_needed) { |
2426 Function* super_function = NULL; | 2423 Function* super_function = NULL; |
2427 if (node->IsSuperStore()) { | 2424 if (node->IsSuperStore()) { |
2428 // Resolve the store indexed operator in the super class. | 2425 // Resolve the store indexed operator in the super class. |
2429 super_function = &Function::ZoneHandle( | 2426 super_function = &Function::ZoneHandle( |
2430 Resolver::ResolveDynamicAnyArgs(node->super_class(), | 2427 Resolver::ResolveDynamicAnyArgs(node->super_class(), |
2431 Symbols::AssignIndexTokenHandle())); | 2428 Symbols::AssignIndexToken())); |
2432 if (super_function->IsNull()) { | 2429 if (super_function->IsNull()) { |
2433 // Could not resolve super operator. Generate call noSuchMethod() of the | 2430 // Could not resolve super operator. Generate call noSuchMethod() of the |
2434 // super class instead. | 2431 // super class instead. |
2435 if (result_is_needed) { | 2432 if (result_is_needed) { |
2436 // Even though noSuchMethod most likely does not return, | 2433 // Even though noSuchMethod most likely does not return, |
2437 // we save the stored value if the result is needed. | 2434 // we save the stored value if the result is needed. |
2438 ValueGraphVisitor for_value(owner(), temp_index(), loop_depth()); | 2435 ValueGraphVisitor for_value(owner(), temp_index(), loop_depth()); |
2439 node->value()->Visit(&for_value); | 2436 node->value()->Visit(&for_value); |
2440 Append(for_value); | 2437 Append(for_value); |
2441 Bind(BuildStoreExprTemp(for_value.value())); | 2438 Bind(BuildStoreExprTemp(for_value.value())); |
2442 } | 2439 } |
2443 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); | 2440 ArgumentListNode* arguments = new ArgumentListNode(node->token_pos()); |
2444 arguments->Add(node->index_expr()); | 2441 arguments->Add(node->index_expr()); |
2445 arguments->Add(node->value()); | 2442 arguments->Add(node->value()); |
2446 StaticCallInstr* call = | 2443 StaticCallInstr* call = |
2447 BuildStaticNoSuchMethodCall(node->super_class(), | 2444 BuildStaticNoSuchMethodCall(node->super_class(), |
2448 node->array(), | 2445 node->array(), |
2449 Symbols::AssignIndexTokenHandle(), | 2446 Symbols::AssignIndexToken(), |
2450 arguments); | 2447 arguments); |
2451 if (result_is_needed) { | 2448 if (result_is_needed) { |
2452 Do(call); | 2449 Do(call); |
2453 return BuildLoadExprTemp(); | 2450 return BuildLoadExprTemp(); |
2454 } else { | 2451 } else { |
2455 return call; | 2452 return call; |
2456 } | 2453 } |
2457 } | 2454 } |
2458 } | 2455 } |
2459 | 2456 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 | 2770 |
2774 // Looks up dynamic method noSuchMethod in target_class | 2771 // Looks up dynamic method noSuchMethod in target_class |
2775 // (including its super class chain) and builds a static call to it. | 2772 // (including its super class chain) and builds a static call to it. |
2776 StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( | 2773 StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall( |
2777 const Class& target_class, | 2774 const Class& target_class, |
2778 AstNode* receiver, | 2775 AstNode* receiver, |
2779 const String& method_name, | 2776 const String& method_name, |
2780 ArgumentListNode* method_arguments) { | 2777 ArgumentListNode* method_arguments) { |
2781 // Build the graph to allocate an InvocationMirror object by calling | 2778 // Build the graph to allocate an InvocationMirror object by calling |
2782 // the static allocation method. | 2779 // the static allocation method. |
2783 const String& mirror_name = String::Handle(Symbols::InvocationMirror()); | |
2784 const Library& corelib = Library::Handle(Library::CoreLibrary()); | 2780 const Library& corelib = Library::Handle(Library::CoreLibrary()); |
2785 const Class& mirror_class = Class::Handle( | 2781 const Class& mirror_class = Class::Handle( |
2786 corelib.LookupClassAllowPrivate(mirror_name)); | 2782 corelib.LookupClassAllowPrivate(Symbols::InvocationMirror())); |
2787 ASSERT(!mirror_class.IsNull()); | 2783 ASSERT(!mirror_class.IsNull()); |
2788 const String& function_name = String::Handle( | |
2789 Symbols::AllocateInvocationMirror()); | |
2790 const Function& allocation_function = Function::ZoneHandle( | 2784 const Function& allocation_function = Function::ZoneHandle( |
2791 Resolver::ResolveStaticByName(mirror_class, | 2785 Resolver::ResolveStaticByName(mirror_class, |
2792 function_name, | 2786 Symbols::AllocateInvocationMirror(), |
2793 Resolver::kIsQualified)); | 2787 Resolver::kIsQualified)); |
2794 ASSERT(!allocation_function.IsNull()); | 2788 ASSERT(!allocation_function.IsNull()); |
2795 | 2789 |
2796 // Evaluate the receiver before the arguments. This will be used | 2790 // Evaluate the receiver before the arguments. This will be used |
2797 // as an argument to the noSuchMethod call. | 2791 // as an argument to the noSuchMethod call. |
2798 ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth()); | 2792 ValueGraphVisitor for_receiver(owner(), temp_index(), loop_depth()); |
2799 receiver->Visit(&for_receiver); | 2793 receiver->Visit(&for_receiver); |
2800 Append(for_receiver); | 2794 Append(for_receiver); |
2801 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); | 2795 PushArgumentInstr* push_receiver = PushArgument(for_receiver.value()); |
2802 | 2796 |
(...skipping 19 matching lines...) Expand all Loading... |
2822 ZoneGrowableArray<PushArgumentInstr*>* allocation_args = | 2816 ZoneGrowableArray<PushArgumentInstr*>* allocation_args = |
2823 new ZoneGrowableArray<PushArgumentInstr*>(arguments->length()); | 2817 new ZoneGrowableArray<PushArgumentInstr*>(arguments->length()); |
2824 BuildPushArguments(*arguments, allocation_args); | 2818 BuildPushArguments(*arguments, allocation_args); |
2825 StaticCallInstr* allocation = new StaticCallInstr(args_pos, | 2819 StaticCallInstr* allocation = new StaticCallInstr(args_pos, |
2826 allocation_function, | 2820 allocation_function, |
2827 Array::ZoneHandle(), | 2821 Array::ZoneHandle(), |
2828 allocation_args); | 2822 allocation_args); |
2829 Value* invocation_mirror = Bind(allocation); | 2823 Value* invocation_mirror = Bind(allocation); |
2830 PushArgumentInstr* push_invocation_mirror = PushArgument(invocation_mirror); | 2824 PushArgumentInstr* push_invocation_mirror = PushArgument(invocation_mirror); |
2831 // Lookup noSuchMethod and call it with the receiver and the InvocationMirror. | 2825 // Lookup noSuchMethod and call it with the receiver and the InvocationMirror. |
2832 const String& no_such_method_name = | |
2833 String::ZoneHandle(Symbols::NoSuchMethod()); | |
2834 const Function& no_such_method_func = Function::ZoneHandle( | 2826 const Function& no_such_method_func = Function::ZoneHandle( |
2835 Resolver::ResolveDynamicAnyArgs(target_class, no_such_method_name)); | 2827 Resolver::ResolveDynamicAnyArgs(target_class, Symbols::NoSuchMethod())); |
2836 // We are guaranteed to find noSuchMethod of class Object. | 2828 // We are guaranteed to find noSuchMethod of class Object. |
2837 ASSERT(!no_such_method_func.IsNull()); | 2829 ASSERT(!no_such_method_func.IsNull()); |
2838 ZoneGrowableArray<PushArgumentInstr*>* args = | 2830 ZoneGrowableArray<PushArgumentInstr*>* args = |
2839 new ZoneGrowableArray<PushArgumentInstr*>(2); | 2831 new ZoneGrowableArray<PushArgumentInstr*>(2); |
2840 args->Add(push_receiver); | 2832 args->Add(push_receiver); |
2841 args->Add(push_invocation_mirror); | 2833 args->Add(push_invocation_mirror); |
2842 return new StaticCallInstr(args_pos, | 2834 return new StaticCallInstr(args_pos, |
2843 no_such_method_func, | 2835 no_such_method_func, |
2844 Array::ZoneHandle(), | 2836 Array::ZoneHandle(), |
2845 args); | 2837 args); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2952 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
2961 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2953 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
2962 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2954 OS::SNPrint(chars, len, kFormat, function_name, reason); |
2963 const Error& error = Error::Handle( | 2955 const Error& error = Error::Handle( |
2964 LanguageError::New(String::Handle(String::New(chars)))); | 2956 LanguageError::New(String::Handle(String::New(chars)))); |
2965 Isolate::Current()->long_jump_base()->Jump(1, error); | 2957 Isolate::Current()->long_jump_base()->Jump(1, error); |
2966 } | 2958 } |
2967 | 2959 |
2968 | 2960 |
2969 } // namespace dart | 2961 } // namespace dart |
OLD | NEW |