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

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

Issue 265443002: VM: Explicitly load function and context before calling a closure. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 6 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 ASSERT(Code::kSCallTableOffsetEntry == 0); 464 ASSERT(Code::kSCallTableOffsetEntry == 0);
465 static_calls_target_table_.Add( 465 static_calls_target_table_.Add(
466 Smi::Handle(Smi::New(assembler()->CodeSize()))); 466 Smi::Handle(Smi::New(assembler()->CodeSize())));
467 ASSERT(Code::kSCallTableFunctionEntry == 1); 467 ASSERT(Code::kSCallTableFunctionEntry == 1);
468 static_calls_target_table_.Add(func); 468 static_calls_target_table_.Add(func);
469 ASSERT(Code::kSCallTableCodeEntry == 2); 469 ASSERT(Code::kSCallTableCodeEntry == 2);
470 static_calls_target_table_.Add(Code::Handle()); 470 static_calls_target_table_.Add(Code::Handle());
471 } 471 }
472 472
473 473
474 // Add a lazy deoptimization environment at a call. input_count specifies
475 // a number of input operands that will be removed from the environment to
476 // match the stack frame layout after the call: Pushed args are present,
477 // input operands are consumed before the call.
474 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, 478 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id,
475 intptr_t token_pos) { 479 intptr_t token_pos,
480 intptr_t input_count) {
476 ASSERT(is_optimizing()); 481 ASSERT(is_optimizing());
482 Environment* env = pending_deoptimization_env_;
483 if (input_count > 0) {
484 env = env->DeepCopy(env->Length() - input_count);
485 }
477 CompilerDeoptInfo* info = 486 CompilerDeoptInfo* info =
478 new CompilerDeoptInfo(deopt_id, 487 new CompilerDeoptInfo(deopt_id,
479 ICData::kDeoptAtCall, 488 ICData::kDeoptAtCall,
480 pending_deoptimization_env_); 489 env);
481 info->set_pc_offset(assembler()->CodeSize()); 490 info->set_pc_offset(assembler()->CodeSize());
482 deopt_infos_.Add(info); 491 deopt_infos_.Add(info);
483 } 492 }
484 493
485 494
486 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters 495 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters
487 // and FlowGraphCompiler::SlowPathEnvironmentFor. 496 // and FlowGraphCompiler::SlowPathEnvironmentFor.
488 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { 497 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) {
489 if (is_optimizing()) { 498 if (is_optimizing()) {
490 RegisterSet* registers = locs->live_registers(); 499 RegisterSet* registers = locs->live_registers();
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 1304
1296 for (int i = 0; i < len; i++) { 1305 for (int i = 0; i < len; i++) {
1297 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1306 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1298 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1307 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1299 ic_data.GetCountAt(i))); 1308 ic_data.GetCountAt(i)));
1300 } 1309 }
1301 sorted->Sort(HighestCountFirst); 1310 sorted->Sort(HighestCountFirst);
1302 } 1311 }
1303 1312
1304 } // namespace dart 1313 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698