OLD | NEW |
---|---|
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 __ Frame(num_locals); // Reserve space for locals. | 376 __ Frame(num_locals); // Reserve space for locals. |
377 } else if (flow_graph_.graph_entry()->spill_slot_count() > | 377 } else if (flow_graph_.graph_entry()->spill_slot_count() > |
378 flow_graph_.num_copied_params()) { | 378 flow_graph_.num_copied_params()) { |
379 __ Frame(flow_graph_.graph_entry()->spill_slot_count() - | 379 __ Frame(flow_graph_.graph_entry()->spill_slot_count() - |
380 flow_graph_.num_copied_params()); | 380 flow_graph_.num_copied_params()); |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 if (function.IsClosureFunction()) { | 384 if (function.IsClosureFunction()) { |
385 // In optimized mode the register allocator expects CurrentContext in the | 385 // In optimized mode the register allocator expects CurrentContext in the |
386 // flow_graph_.num_copied_params() register at function entry. | 386 // flow_graph_.num_copied_params() register at function entry, unless that |
387 // register is used for function type arguments, either as their | |
388 // permanent location or as their temporary location when captured. | |
389 // In that case, the next register holds CurrentContext. | |
387 // (see FlowGraphAllocator::ProcessInitialDefinition) | 390 // (see FlowGraphAllocator::ProcessInitialDefinition) |
388 Register context_reg = | 391 Register context_reg = |
389 is_optimizing() ? flow_graph_.num_copied_params() : context_index; | 392 is_optimizing() ? ((parsed_function().function_type_arguments() != NULL) |
Vyacheslav Egorov (Google)
2017/08/16 05:27:36
The code below uses FLAG_reify_generic_functions &
regis
2017/08/16 17:47:48
Done.
I also unified with the code in FlowGraphAll
| |
393 ? flow_graph_.num_copied_params() + 1 | |
394 : flow_graph_.num_copied_params()) | |
395 : context_index; | |
390 LocalScope* scope = parsed_function().node_sequence()->scope(); | 396 LocalScope* scope = parsed_function().node_sequence()->scope(); |
391 LocalVariable* local = scope->VariableAt(0); | 397 LocalVariable* local = scope->VariableAt(0); // Closure instance receiver. |
392 | 398 |
393 Register closure_reg; | 399 Register closure_reg; |
394 if (local->index() > 0) { | 400 if (local->index() > 0) { |
395 __ Move(context_reg, -local->index()); | 401 __ Move(context_reg, -local->index()); |
396 closure_reg = context_reg; | 402 closure_reg = context_reg; |
397 } else { | 403 } else { |
398 closure_reg = -local->index() - 1; | 404 closure_reg = -local->index() - 1; |
399 } | 405 } |
400 __ LoadField(context_reg, closure_reg, | 406 __ LoadField(context_reg, closure_reg, |
401 Closure::context_offset() / kWordSize); | 407 Closure::context_offset() / kWordSize); |
402 } else if (has_optional_params && !is_optimizing()) { | 408 } else if (has_optional_params && !is_optimizing()) { |
403 __ LoadConstant(context_index, Object::empty_context()); | 409 __ LoadConstant(context_index, Object::empty_context()); |
404 } | 410 } |
405 | 411 |
406 // Check for a passed type argument vector if the function is generic. | 412 // Check for a passed type argument vector if the function is generic. |
407 if (FLAG_reify_generic_functions && function.IsGeneric() && | 413 if (FLAG_reify_generic_functions && function.IsGeneric() && |
408 !flow_graph().IsCompiledForOsr()) { | 414 !flow_graph().IsCompiledForOsr()) { |
409 __ Comment("Check passed-in type args"); | 415 ASSERT(-parsed_function().first_stack_local_index() - 1 == |
410 UNIMPLEMENTED(); // TODO(regis): Not yet supported. | 416 flow_graph_.num_copied_params()); |
417 __ CheckFunctionTypeArgs(function.NumTypeParameters(), | |
418 flow_graph_.num_copied_params()); | |
411 } | 419 } |
420 | |
421 // TODO(regis): Verify that no vector is passed if not generic, unless already | |
422 // checked during resolution. | |
412 } | 423 } |
413 | 424 |
414 void FlowGraphCompiler::CompileGraph() { | 425 void FlowGraphCompiler::CompileGraph() { |
415 InitCompiler(); | 426 InitCompiler(); |
416 | 427 |
417 if (TryIntrinsify()) { | 428 if (TryIntrinsify()) { |
418 // Skip regular code generation. | 429 // Skip regular code generation. |
419 return; | 430 return; |
420 } | 431 } |
421 | 432 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 | 557 |
547 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 558 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
548 UNIMPLEMENTED(); | 559 UNIMPLEMENTED(); |
549 } | 560 } |
550 | 561 |
551 #undef __ | 562 #undef __ |
552 | 563 |
553 } // namespace dart | 564 } // namespace dart |
554 | 565 |
555 #endif // defined TARGET_ARCH_DBC | 566 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |