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

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

Issue 10536162: Add token kind into InstanceCallComp so that we do not need to extract it from name (addresses vego… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.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) 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/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 ValueGraphVisitor for_right_value(owner(), temp_index()); 420 ValueGraphVisitor for_right_value(owner(), temp_index());
421 node->right()->Visit(&for_right_value); 421 node->right()->Visit(&for_right_value);
422 Append(for_right_value); 422 Append(for_right_value);
423 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2); 423 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2);
424 arguments->Add(for_left_value.value()); 424 arguments->Add(for_left_value.value());
425 arguments->Add(for_right_value.value()); 425 arguments->Add(for_right_value.value());
426 const String& name = String::ZoneHandle(String::NewSymbol(node->Name())); 426 const String& name = String::ZoneHandle(String::NewSymbol(node->Name()));
427 InstanceCallComp* call = new InstanceCallComp(node->token_index(), 427 InstanceCallComp* call = new InstanceCallComp(node->token_index(),
428 owner()->try_index(), 428 owner()->try_index(),
429 name, 429 name,
430 node->kind(),
430 arguments, 431 arguments,
431 Array::ZoneHandle(), 432 Array::ZoneHandle(),
432 2); 433 2);
433 ReturnComputation(call); 434 ReturnComputation(call);
434 } 435 }
435 436
436 437
437 // Special handling for AND/OR. 438 // Special handling for AND/OR.
438 void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) { 439 void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
439 // Operators "&&" and "||" cannot be overloaded therefore do not call 440 // Operators "&&" and "||" cannot be overloaded therefore do not call
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 831 }
831 BooleanNegateComp* negate = new BooleanNegateComp(value); 832 BooleanNegateComp* negate = new BooleanNegateComp(value);
832 ReturnComputation(negate); 833 ReturnComputation(negate);
833 return; 834 return;
834 } 835 }
835 ValueGraphVisitor for_value(owner(), temp_index()); 836 ValueGraphVisitor for_value(owner(), temp_index());
836 node->operand()->Visit(&for_value); 837 node->operand()->Visit(&for_value);
837 Append(for_value); 838 Append(for_value);
838 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1); 839 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1);
839 arguments->Add(for_value.value()); 840 arguments->Add(for_value.value());
841 Token::Kind token_kind =
842 (node->kind() == Token::kSUB) ? Token::kNEGATE : node->kind();
843
840 const String& name = 844 const String& name =
841 String::ZoneHandle(String::NewSymbol((node->kind() == Token::kSUB) 845 String::ZoneHandle(String::NewSymbol(Token::Str(token_kind)));
842 ? Token::Str(Token::kNEGATE)
843 : node->Name()));
844 InstanceCallComp* call = new InstanceCallComp( 846 InstanceCallComp* call = new InstanceCallComp(
845 node->token_index(), owner()->try_index(), name, 847 node->token_index(), owner()->try_index(), name, token_kind,
846 arguments, Array::ZoneHandle(), 1); 848 arguments, Array::ZoneHandle(), 1);
847 ReturnComputation(call); 849 ReturnComputation(call);
848 } 850 }
849 851
850 852
851 void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) { 853 void EffectGraphVisitor::VisitConditionalExprNode(ConditionalExprNode* node) {
852 TestGraphVisitor for_test(owner(), 854 TestGraphVisitor for_test(owner(),
853 temp_index(), 855 temp_index(),
854 node->condition()->token_index()); 856 node->condition()->token_index());
855 node->condition()->Visit(&for_test); 857 node->condition()->Visit(&for_test);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length + 1); 1371 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length + 1);
1370 1372
1371 ValueGraphVisitor for_receiver(owner(), temp_index()); 1373 ValueGraphVisitor for_receiver(owner(), temp_index());
1372 node->receiver()->Visit(&for_receiver); 1374 node->receiver()->Visit(&for_receiver);
1373 Append(for_receiver); 1375 Append(for_receiver);
1374 values->Add(for_receiver.value()); 1376 values->Add(for_receiver.value());
1375 1377
1376 TranslateArgumentList(*arguments, values); 1378 TranslateArgumentList(*arguments, values);
1377 InstanceCallComp* call = new InstanceCallComp( 1379 InstanceCallComp* call = new InstanceCallComp(
1378 node->token_index(), owner()->try_index(), 1380 node->token_index(), owner()->try_index(),
1379 node->function_name(), values, 1381 node->function_name(), Token::kILLEGAL, values,
1380 arguments->names(), 1); 1382 arguments->names(), 1);
1381 ReturnComputation(call); 1383 ReturnComputation(call);
1382 } 1384 }
1383 1385
1384 1386
1385 // <Expression> ::= StaticCall { function: Function 1387 // <Expression> ::= StaticCall { function: Function
1386 // arguments: <ArgumentList> } 1388 // arguments: <ArgumentList> }
1387 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) { 1389 void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
1388 int length = node->arguments()->length(); 1390 int length = node->arguments()->length();
1389 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length); 1391 ZoneGrowableArray<Value*>* values = new ZoneGrowableArray<Value*>(length);
1390 TranslateArgumentList(*node->arguments(), values); 1392 TranslateArgumentList(*node->arguments(), values);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 1743
1742 void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) { 1744 void EffectGraphVisitor::VisitInstanceGetterNode(InstanceGetterNode* node) {
1743 ValueGraphVisitor for_receiver(owner(), temp_index()); 1745 ValueGraphVisitor for_receiver(owner(), temp_index());
1744 node->receiver()->Visit(&for_receiver); 1746 node->receiver()->Visit(&for_receiver);
1745 Append(for_receiver); 1747 Append(for_receiver);
1746 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1); 1748 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(1);
1747 arguments->Add(for_receiver.value()); 1749 arguments->Add(for_receiver.value());
1748 const String& name = 1750 const String& name =
1749 String::ZoneHandle(Field::GetterSymbol(node->field_name())); 1751 String::ZoneHandle(Field::GetterSymbol(node->field_name()));
1750 InstanceCallComp* call = new InstanceCallComp( 1752 InstanceCallComp* call = new InstanceCallComp(
1751 node->token_index(), owner()->try_index(), name, 1753 node->token_index(), owner()->try_index(), name, Token::kGET,
1752 arguments, Array::ZoneHandle(), 1); 1754 arguments, Array::ZoneHandle(), 1);
1753 ReturnComputation(call); 1755 ReturnComputation(call);
1754 } 1756 }
1755 1757
1756 1758
1757 void EffectGraphVisitor::BuildInstanceSetterValues( 1759 void EffectGraphVisitor::BuildInstanceSetterValues(
1758 InstanceSetterNode* node, Value** receiver, Value** value) { 1760 InstanceSetterNode* node, Value** receiver, Value** value) {
1759 ValueGraphVisitor for_receiver(owner(), temp_index()); 1761 ValueGraphVisitor for_receiver(owner(), temp_index());
1760 node->receiver()->Visit(&for_receiver); 1762 node->receiver()->Visit(&for_receiver);
1761 Append(for_receiver); 1763 Append(for_receiver);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 char* chars = reinterpret_cast<char*>( 2552 char* chars = reinterpret_cast<char*>(
2551 Isolate::Current()->current_zone()->Allocate(len)); 2553 Isolate::Current()->current_zone()->Allocate(len));
2552 OS::SNPrint(chars, len, kFormat, function_name, reason); 2554 OS::SNPrint(chars, len, kFormat, function_name, reason);
2553 const Error& error = Error::Handle( 2555 const Error& error = Error::Handle(
2554 LanguageError::New(String::Handle(String::New(chars)))); 2556 LanguageError::New(String::Handle(String::New(chars))));
2555 Isolate::Current()->long_jump_base()->Jump(1, error); 2557 Isolate::Current()->long_jump_base()->Jump(1, error);
2556 } 2558 }
2557 2559
2558 2560
2559 } // namespace dart 2561 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698