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

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

Issue 2796283003: VM: [Kernel] Implement CatchBlockEntryInstr::should_restore_closure_context on all platforms. (Closed)
Patch Set: Address Zach's comment Created 3 years, 8 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
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language_arm.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_DBC. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC.
6 #if defined(TARGET_ARCH_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 ASSERT(num_locals > 0); // There is always at least context_var. 393 ASSERT(num_locals > 0); // There is always at least context_var.
394 __ Frame(num_locals); // Reserve space for locals. 394 __ Frame(num_locals); // Reserve space for locals.
395 } else if (flow_graph_.graph_entry()->spill_slot_count() > 395 } else if (flow_graph_.graph_entry()->spill_slot_count() >
396 flow_graph_.num_copied_params()) { 396 flow_graph_.num_copied_params()) {
397 __ Frame(flow_graph_.graph_entry()->spill_slot_count() - 397 __ Frame(flow_graph_.graph_entry()->spill_slot_count() -
398 flow_graph_.num_copied_params()); 398 flow_graph_.num_copied_params());
399 } 399 }
400 } 400 }
401 401
402 if (function.IsClosureFunction()) { 402 if (function.IsClosureFunction()) {
403 Register reg = 403 // In optimized mode the register allocator expects CurrentContext in the
404 // flow_graph_.num_copied_params() register at function entry.
405 // (see FlowGraphAllocator::ProcessInitialDefinition)
406 Register context_reg =
404 is_optimizing() ? flow_graph_.num_copied_params() : context_index; 407 is_optimizing() ? flow_graph_.num_copied_params() : context_index;
405 Register closure_reg = reg;
406 LocalScope* scope = parsed_function().node_sequence()->scope(); 408 LocalScope* scope = parsed_function().node_sequence()->scope();
407 LocalVariable* local = scope->VariableAt(0); 409 LocalVariable* local = scope->VariableAt(0);
410
411 Register closure_reg;
408 if (local->index() > 0) { 412 if (local->index() > 0) {
409 __ Move(reg, -local->index()); 413 __ Move(context_reg, -local->index());
414 closure_reg = context_reg;
410 } else { 415 } else {
411 closure_reg = -local->index() - 1; 416 closure_reg = -local->index() - 1;
412 } 417 }
413 __ LoadField(reg, closure_reg, Closure::context_offset() / kWordSize); 418 __ LoadField(context_reg, closure_reg,
419 Closure::context_offset() / kWordSize);
414 } else if (has_optional_params && !is_optimizing()) { 420 } else if (has_optional_params && !is_optimizing()) {
415 __ LoadConstant(context_index, Object::empty_context()); 421 __ LoadConstant(context_index, Object::empty_context());
416 } 422 }
417 } 423 }
418 424
419 425
420 void FlowGraphCompiler::CompileGraph() { 426 void FlowGraphCompiler::CompileGraph() {
421 InitCompiler(); 427 InitCompiler();
422 428
423 if (TryIntrinsify()) { 429 if (TryIntrinsify()) {
424 // Skip regular code generation. 430 // Skip regular code generation.
425 return; 431 return;
426 } 432 }
427 433
428 EmitFrameEntry(); 434 EmitFrameEntry();
429 VisitBlocks(); 435 VisitBlocks();
430 } 436 }
431 437
432 438
433 uint16_t FlowGraphCompiler::ToEmbeddableCid(intptr_t cid, 439 uint16_t FlowGraphCompiler::ToEmbeddableCid(intptr_t cid,
434 Instruction* instruction) { 440 Instruction* instruction) {
435 if (!Utils::IsUint(16, cid)) { 441 if (!Utils::IsUint(16, cid)) {
436 instruction->Unsupported(this); 442 instruction->Unsupported(this);
437 UNREACHABLE(); 443 UNREACHABLE();
438 } 444 }
439 return static_cast<uint16_t>(cid); 445 return static_cast<uint16_t>(cid);
440 } 446 }
441 447
442 448
449 intptr_t FlowGraphCompiler::CatchEntryRegForVariable(const LocalVariable& var) {
450 ASSERT(is_optimizing());
451 ASSERT(var.index() <= 0);
452 return kNumberOfCpuRegisters -
453 (flow_graph().num_non_copied_params() - var.index());
454 }
455
456
443 #undef __ 457 #undef __
444 #define __ compiler_->assembler()-> 458 #define __ compiler_->assembler()->
445 459
446 460
447 void ParallelMoveResolver::EmitMove(int index) { 461 void ParallelMoveResolver::EmitMove(int index) {
448 MoveOperands* move = moves_[index]; 462 MoveOperands* move = moves_[index];
449 const Location source = move->src(); 463 const Location source = move->src();
450 const Location destination = move->dest(); 464 const Location destination = move->dest();
451 if (source.IsStackSlot() && destination.IsRegister()) { 465 if (source.IsStackSlot() && destination.IsRegister()) {
452 // Only allow access to the arguments. 466 // Only allow access to the arguments.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 574 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
561 UNIMPLEMENTED(); 575 UNIMPLEMENTED();
562 } 576 }
563 577
564 578
565 #undef __ 579 #undef __
566 580
567 } // namespace dart 581 } // namespace dart
568 582
569 #endif // defined TARGET_ARCH_DBC 583 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698