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

Unified Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 10877011: Do not clear the spill slots in optimized code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | runtime/vm/flow_graph_compiler_x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler_ia32.cc
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index 02db7e296a901b1e2f4fab0cd35ecf858e677c4a..97ea922c5e41a2a580510549de0d7efe09d2cbd4 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -764,12 +764,15 @@ void FlowGraphCompiler::CopyParameters() {
// stack.
__ addl(ESP, Immediate(StackSize() * kWordSize));
}
+ // The calls below have empty stackmaps because we have just dropped the
+ // spill slots.
+ BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
if (function.IsClosureFunction()) {
GenerateCallRuntime(Isolate::kNoDeoptId,
0,
CatchClauseNode::kInvalidTryIndex,
kClosureArgumentMismatchRuntimeEntry,
- NULL);
+ empty_stack_bitmap);
} else {
ASSERT(!IsLeaf());
// Invoke noSuchMethod function.
@@ -788,6 +791,10 @@ void FlowGraphCompiler::CopyParameters() {
// ECX : ic-data.
// EDX : arguments descriptor array.
__ call(&StubCode::CallNoSuchMethodFunctionLabel());
+ if (is_optimizing()) {
+ stackmap_table_builder_->AddEntry(assembler()->CodeSize(),
+ empty_stack_bitmap);
+ }
}
if (FLAG_trace_functions) {
@@ -797,7 +804,7 @@ void FlowGraphCompiler::CopyParameters() {
0,
CatchClauseNode::kInvalidTryIndex,
kTraceFunctionExitRuntimeEntry,
- NULL);
+ empty_stack_bitmap);
__ popl(EAX); // Remove argument.
__ popl(EAX); // Restore result.
}
@@ -898,6 +905,16 @@ void FlowGraphCompiler::CompileGraph() {
} else {
AssemblerMacros::EnterDartFrame(assembler(), (StackSize() * kWordSize));
}
+
+ // For optimized code, keep a bitmap of the frame in order to build
+ // stackmaps for GC safepoints in the prologue.
+ BitmapBuilder* stack_bitmap = NULL;
+ if (is_optimizing()) {
+ // Spill slots are allocated but not initialized.
+ stack_bitmap = new BitmapBuilder();
+ stack_bitmap->SetLength(StackSize());
+ }
+
// We check the number of passed arguments when we have to copy them due to
// the presence of optional named parameters.
// No such checking code is generated if only fixed parameters are declared,
@@ -921,7 +938,7 @@ void FlowGraphCompiler::CompileGraph() {
function.token_pos(),
CatchClauseNode::kInvalidTryIndex,
kClosureArgumentMismatchRuntimeEntry,
- NULL);
+ stack_bitmap);
} else {
__ Stop("Wrong number of arguments");
}
@@ -931,26 +948,15 @@ void FlowGraphCompiler::CompileGraph() {
CopyParameters();
}
- // Initialize (non-argument) stack allocated slots to null.
- //
- // TODO(vegorov): introduce stack maps and stop initializing all spill slots
- // with null.
- intptr_t uninitialized_slot_count;
- if (is_optimizing()) {
- GraphEntryInstr* entry = block_order_[0]->AsGraphEntry();
- uninitialized_slot_count =
- entry->spill_slot_count() - copied_parameter_count;
- } else {
- uninitialized_slot_count = local_count;
- }
- const intptr_t slot_base = parsed_function().first_stack_local_index();
-
- if (uninitialized_slot_count > 0) {
+ // In unoptimized code, initialize (non-argument) stack allocated slots to
+ // null.
+ if (!is_optimizing() && (local_count > 0)) {
__ Comment("Initialize spill slots");
Vyacheslav Egorov (Google) 2012/08/22 13:22:08 "Initialize locals"
+ const intptr_t slot_base = parsed_function().first_stack_local_index();
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ movl(EAX, raw_null);
- for (intptr_t i = 0; i < uninitialized_slot_count; ++i) {
+ for (intptr_t i = 0; i < local_count; ++i) {
// Subtract index i (locals lie at lower addresses than EBP).
__ movl(Address(EBP, (slot_base - i) * kWordSize), EAX);
}
@@ -1001,8 +1007,9 @@ void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id,
const RuntimeEntry& entry,
BitmapBuilder* stack_bitmap) {
ASSERT(!IsLeaf());
+ ASSERT(!is_optimizing() || (stack_bitmap != NULL));
__ CallRuntime(entry);
- if (is_optimizing() && (stack_bitmap != NULL)) {
+ if (is_optimizing()) {
stackmap_table_builder_->AddEntry(assembler()->CodeSize(), stack_bitmap);
}
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos, try_index);
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | runtime/vm/flow_graph_compiler_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698