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

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

Issue 678763004: Make CTX allocatable by the register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: incorporated latest comments Created 6 years, 1 month 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 // The noSuchMethod call may return to the caller, but not here. 1095 // The noSuchMethod call may return to the caller, but not here.
1096 } else { 1096 } else {
1097 __ Stop("Wrong number of arguments"); 1097 __ Stop("Wrong number of arguments");
1098 } 1098 }
1099 __ Bind(&correct_num_arguments); 1099 __ Bind(&correct_num_arguments);
1100 } 1100 }
1101 } else if (!flow_graph().IsCompiledForOsr()) { 1101 } else if (!flow_graph().IsCompiledForOsr()) {
1102 CopyParameters(); 1102 CopyParameters();
1103 } 1103 }
1104 1104
1105 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
1106 // Load context from the closure object (first argument).
1107 LocalScope* scope = parsed_function().node_sequence()->scope();
1108 LocalVariable* closure_parameter = scope->VariableAt(0);
1109 __ lw(CTX, Address(FP, closure_parameter->index() * kWordSize));
1110 __ lw(CTX, FieldAddress(CTX, Closure::context_offset()));
1111 }
1112
1105 // In unoptimized code, initialize (non-argument) stack allocated slots to 1113 // In unoptimized code, initialize (non-argument) stack allocated slots to
1106 // null. 1114 // null.
1107 if (!is_optimizing() && (num_locals > 0)) { 1115 if (!is_optimizing()) {
1116 ASSERT(num_locals > 0); // There is always at least context_var.
1108 __ TraceSimMsg("Initialize spill slots"); 1117 __ TraceSimMsg("Initialize spill slots");
1109 __ Comment("Initialize spill slots"); 1118 __ Comment("Initialize spill slots");
1110 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1119 const intptr_t slot_base = parsed_function().first_stack_local_index();
1120 const intptr_t context_index =
1121 parsed_function().current_context_var()->index();
1122 if (num_locals > 1) {
1123 __ LoadImmediate(V0, reinterpret_cast<int32_t>(Object::null()));
1124 }
1111 for (intptr_t i = 0; i < num_locals; ++i) { 1125 for (intptr_t i = 0; i < num_locals; ++i) {
1112 // Subtract index i (locals lie at lower addresses than FP). 1126 // Subtract index i (locals lie at lower addresses than FP).
1113 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); 1127 if (((slot_base - i) == context_index)) {
1114 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); 1128 if (function.IsClosureFunction()) {
1129 __ sw(CTX, Address(FP, (slot_base - i) * kWordSize));
1130 } else {
1131 const Context& empty_context = Context::ZoneHandle(
1132 isolate(), isolate()->object_store()->empty_context());
1133 __ LoadObject(V1, empty_context);
1134 __ sw(V1, Address(FP, (slot_base - i) * kWordSize));
1135 }
1136 } else {
1137 ASSERT(num_locals > 1);
1138 __ sw(V0, Address(FP, (slot_base - i) * kWordSize));
1139 }
1115 } 1140 }
1116 } 1141 }
1117 1142
1118 VisitBlocks(); 1143 VisitBlocks();
1119 1144
1120 __ break_(0); 1145 __ break_(0);
1121 GenerateDeferredCode(); 1146 GenerateDeferredCode();
1122 // Emit function patching code. This will be swapped with the first 5 bytes 1147 // Emit function patching code. This will be swapped with the first 5 bytes
1123 // at entry point. 1148 // at entry point.
1124 patch_code_pc_offset_ = assembler()->CodeSize(); 1149 patch_code_pc_offset_ = assembler()->CodeSize();
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 __ AddImmediate(SP, kDoubleSize); 1821 __ AddImmediate(SP, kDoubleSize);
1797 } 1822 }
1798 1823
1799 1824
1800 #undef __ 1825 #undef __
1801 1826
1802 1827
1803 } // namespace dart 1828 } // namespace dart
1804 1829
1805 #endif // defined TARGET_ARCH_MIPS 1830 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698