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

Unified Diff: runtime/vm/parser.cc

Issue 11642003: Create and cache method extraction stub in the ICData. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove hand written assembly stub Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index aacdda0b953f57214f7e030b9cbe1fc9a98f3a52..58567f1325fb24c3f78977fc951bf5e250e9f20b 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -756,6 +756,9 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
case RawFunction::kConstImplicitGetter:
node_sequence = parser.ParseStaticConstGetter(func);
break;
+ case RawFunction::kMethodExtractor:
+ node_sequence = parser.ParseMethodExtractor(func);
+ break;
default:
UNREACHABLE();
}
@@ -984,6 +987,37 @@ SequenceNode* Parser::ParseInstanceSetter(const Function& func) {
}
+SequenceNode* Parser::ParseMethodExtractor(const Function& func) {
+ TRACE_PARSER("ParseMethodExtractor");
+ ParamList params;
+
+ // func.token_pos() points to the name of the field.
Ivan Posva 2013/01/17 08:03:20 I don't think this comment is correct. The token_p
Vyacheslav Egorov (Google) 2013/01/17 12:46:38 Indeed it is not. token_pos is 0 actually.
+ intptr_t ident_pos = func.token_pos();
+ ASSERT(current_class().raw() == func.Owner());
+ params.AddReceiver(ReceiverType(ident_pos));
+ ASSERT(func.num_fixed_parameters() == 1); // receiver.
+ ASSERT(!func.HasOptionalParameters());
+
+ // Build local scope for function and populate with the formal parameters.
+ OpenFunctionBlock(func);
+ AddFormalParamsToScope(&params, current_block_->scope);
+
+ // Receiver is local 0.
+ LocalVariable* receiver = current_block_->scope->VariableAt(0);
+ LoadLocalNode* load_receiver = new LoadLocalNode(ident_pos, receiver);
+
+ ClosureNode* closure = new ClosureNode(
+ ident_pos,
+ Function::ZoneHandle(func.extracted_method_closure()),
+ load_receiver,
+ NULL);
+
+ ReturnNode* return_node = new ReturnNode(ident_pos, closure);
+ current_block_->statements->Add(return_node);
+ return CloseBlock();
+}
+
+
void Parser::SkipBlock() {
ASSERT(CurrentToken() == Token::kLBRACE);
GrowableArray<Token::Kind> token_stack(8);

Powered by Google App Engine
This is Rietveld 408576698