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

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

Issue 678763004: Make CTX allocatable by the register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 // The noSuchMethod call may return to the caller, but not here. 1067 // The noSuchMethod call may return to the caller, but not here.
1068 } else { 1068 } else {
1069 __ Stop("Wrong number of arguments"); 1069 __ Stop("Wrong number of arguments");
1070 } 1070 }
1071 __ Bind(&correct_num_arguments); 1071 __ Bind(&correct_num_arguments);
1072 } 1072 }
1073 } else if (!flow_graph().IsCompiledForOsr()) { 1073 } else if (!flow_graph().IsCompiledForOsr()) {
1074 CopyParameters(); 1074 CopyParameters();
1075 } 1075 }
1076 1076
1077 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
Vyacheslav Egorov (Google) 2014/10/28 13:44:58 It seems closure calling sequence now has a redund
Florian Schneider 2014/10/28 19:04:31 Done. This was only done for now to make inlining
1078 // Load context from the closure object (first argument).
1079 LocalScope* scope = parsed_function().node_sequence()->scope();
1080 LocalVariable* closure_parameter = scope->VariableAt(0);
1081 __ movl(CTX, Address(EBP, closure_parameter->index() * kWordSize));
1082 __ movl(CTX, FieldAddress(CTX, Closure::context_offset()));
1083 #ifdef dEBUG
1084 Label ok;
1085 __ LoadClassId(EBX, CTX);
1086 __ cmpl(EBX, Immediate(kContextCid));
1087 __ j(EQUAL, &ok, Assembler::kNearJump);
1088 __ Stop("Incorrect context at entry");
1089 __ Bind(&ok);
1090 #endif
1091 }
1092
1077 // In unoptimized code, initialize (non-argument) stack allocated slots to 1093 // In unoptimized code, initialize (non-argument) stack allocated slots to
1078 // null. 1094 // null.
1079 if (!is_optimizing() && (num_locals > 0)) { 1095 if (!is_optimizing()) {
1096 ASSERT(num_locals > 0); // There is always at least context_var.
1080 __ Comment("Initialize spill slots"); 1097 __ Comment("Initialize spill slots");
1081 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1098 const intptr_t slot_base = parsed_function().first_stack_local_index();
1099 const intptr_t context_index =
1100 parsed_function().saved_current_context_var()->index();
1082 const Immediate& raw_null = 1101 const Immediate& raw_null =
1083 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1102 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1084 __ movl(EAX, raw_null); 1103 __ movl(EAX, raw_null);
1085 for (intptr_t i = 0; i < num_locals; ++i) { 1104 for (intptr_t i = 0; i < num_locals; ++i) {
1086 // Subtract index i (locals lie at lower addresses than EBP). 1105 // Subtract index i (locals lie at lower addresses than EBP).
1087 __ movl(Address(EBP, (slot_base - i) * kWordSize), EAX); 1106 if (((slot_base - i) == context_index)) {
1107 if (function.IsClosureFunction()) {
1108 __ movl(Address(EBP, (slot_base - i) * kWordSize), CTX);
1109 } else {
1110 const Immediate& raw_empty_context =
1111 Immediate(reinterpret_cast<intptr_t>(
1112 isolate()->object_store()->empty_context()));
1113 __ movl(Address(EBP, (slot_base - i) * kWordSize), raw_empty_context);
1114 }
1115 } else {
1116 __ movl(Address(EBP, (slot_base - i) * kWordSize), EAX);
1117 }
1088 } 1118 }
1089 } 1119 }
1090 1120
1091 ASSERT(!block_order().is_empty()); 1121 ASSERT(!block_order().is_empty());
1092 VisitBlocks(); 1122 VisitBlocks();
1093 1123
1094 __ int3(); 1124 __ int3();
1095 GenerateDeferredCode(); 1125 GenerateDeferredCode();
1096 // Emit function patching code. This will be swapped with the first 5 bytes 1126 // Emit function patching code. This will be swapped with the first 5 bytes
1097 // at entry point. 1127 // at entry point.
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 __ movups(reg, Address(ESP, 0)); 1798 __ movups(reg, Address(ESP, 0));
1769 __ addl(ESP, Immediate(kFpuRegisterSize)); 1799 __ addl(ESP, Immediate(kFpuRegisterSize));
1770 } 1800 }
1771 1801
1772 1802
1773 #undef __ 1803 #undef __
1774 1804
1775 } // namespace dart 1805 } // namespace dart
1776 1806
1777 #endif // defined TARGET_ARCH_IA32 1807 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698