| 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/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 Bailout("EffectGraphVisitor::VisitInstanceCallNode"); | 554 Bailout("EffectGraphVisitor::VisitInstanceCallNode"); |
| 555 } | 555 } |
| 556 void ValueGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { | 556 void ValueGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { |
| 557 Bailout("ValueGraphVisitor::VisitInstanceCallNode"); | 557 Bailout("ValueGraphVisitor::VisitInstanceCallNode"); |
| 558 } | 558 } |
| 559 void TestGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { | 559 void TestGraphVisitor::VisitInstanceCallNode(InstanceCallNode* node) { |
| 560 Bailout("TestGraphVisitor::VisitInstanceCallNode"); | 560 Bailout("TestGraphVisitor::VisitInstanceCallNode"); |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 void EffectGraphVisitor::TranslateArgumentList( |
| 565 const ArgumentListNode& node, ZoneGrowableArray<Value*>* values) { |
| 566 int index = temp_index(); |
| 567 for (intptr_t i = 0; i < node.length(); ++i) { |
| 568 ValueGraphVisitor for_value(owner(), index); |
| 569 node.NodeAt(i)->Visit(&for_value); |
| 570 Append(for_value); |
| 571 CHECK_ALIVE(return); |
| 572 Value* argument_value = for_value.value(); |
| 573 index = for_value.temp_index(); |
| 574 if (argument_value->IsConstant()) { |
| 575 AddInstruction(new BindInstr(index, argument_value)); |
| 576 argument_value = new TempValue(index++); |
| 577 } |
| 578 values->Add(argument_value); |
| 579 } |
| 580 } |
| 581 |
| 564 // <Expression> ::= StaticCall { function: Function | 582 // <Expression> ::= StaticCall { function: Function |
| 565 // arguments: <ArgumentList> } | 583 // arguments: <ArgumentList> } |
| 566 StaticCallComp* EffectGraphVisitor::TranslateStaticCall( | 584 StaticCallComp* EffectGraphVisitor::TranslateStaticCall( |
| 567 const StaticCallNode& node) { | 585 const StaticCallNode& node) { |
| 568 ArgumentListNode* arguments = node.arguments(); | 586 int length = node.arguments()->length(); |
| 569 int length = arguments->length(); | |
| 570 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length); | 587 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length); |
| 571 int index = temp_index(); | 588 TranslateArgumentList(*node.arguments(), values); |
| 572 for (intptr_t i = 0; i < length; ++i) { | 589 CHECK_ALIVE(return NULL); |
| 573 ValueGraphVisitor for_value(owner(), index); | |
| 574 arguments->NodeAt(i)->Visit(&for_value); | |
| 575 Append(for_value); | |
| 576 CHECK_ALIVE(return NULL); | |
| 577 values->Add(for_value.value()); | |
| 578 index = for_value.temp_index(); | |
| 579 } | |
| 580 return new StaticCallComp(node.function(), values); | 590 return new StaticCallComp(node.function(), values); |
| 581 } | 591 } |
| 582 | 592 |
| 583 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 593 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
| 584 StaticCallComp* call = TranslateStaticCall(*node); | 594 StaticCallComp* call = TranslateStaticCall(*node); |
| 585 CHECK_ALIVE(return); | 595 CHECK_ALIVE(return); |
| 586 DoComputation(call); | 596 DoComputation(call); |
| 587 } | 597 } |
| 588 | 598 |
| 589 void ValueGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { | 599 void ValueGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 char* chars = reinterpret_cast<char*>( | 998 char* chars = reinterpret_cast<char*>( |
| 989 Isolate::Current()->current_zone()->Allocate(len)); | 999 Isolate::Current()->current_zone()->Allocate(len)); |
| 990 OS::SNPrint(chars, len, kFormat, reason); | 1000 OS::SNPrint(chars, len, kFormat, reason); |
| 991 const Error& error = Error::Handle( | 1001 const Error& error = Error::Handle( |
| 992 LanguageError::New(String::Handle(String::New(chars)))); | 1002 LanguageError::New(String::Handle(String::New(chars)))); |
| 993 Isolate::Current()->long_jump_base()->Jump(1, error); | 1003 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 994 } | 1004 } |
| 995 | 1005 |
| 996 | 1006 |
| 997 } // namespace dart | 1007 } // namespace dart |
| OLD | NEW |