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

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 5992011: Fix a bug in deoptimization environments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 last_environment->SetValueAt(block->deleted_phis()->at(i), 1009 last_environment->SetValueAt(block->deleted_phis()->at(i),
1010 graph_->GetConstantUndefined()); 1010 graph_->GetConstantUndefined());
1011 } 1011 }
1012 block->UpdateEnvironment(last_environment); 1012 block->UpdateEnvironment(last_environment);
1013 // Pick up the outgoing argument count of one of the predecessors. 1013 // Pick up the outgoing argument count of one of the predecessors.
1014 argument_count_ = pred->argument_count(); 1014 argument_count_ = pred->argument_count();
1015 } 1015 }
1016 HInstruction* current = block->first(); 1016 HInstruction* current = block->first();
1017 int start = chunk_->instructions()->length(); 1017 int start = chunk_->instructions()->length();
1018 while (current != NULL && !is_aborted()) { 1018 while (current != NULL && !is_aborted()) {
1019 if (FLAG_trace_environment) {
1020 PrintF("Process instruction %d\n", current->id());
1021 }
1022 // Code for constants in registers is generated lazily. 1019 // Code for constants in registers is generated lazily.
1023 if (!current->EmitAtUses()) { 1020 if (!current->EmitAtUses()) {
1024 VisitInstruction(current); 1021 VisitInstruction(current);
1025 } 1022 }
1026 current = current->next(); 1023 current = current->next();
1027 } 1024 }
1028 int end = chunk_->instructions()->length() - 1; 1025 int end = chunk_->instructions()->length() - 1;
1029 if (end >= start) { 1026 if (end >= start) {
1030 block->set_first_instruction_index(start); 1027 block->set_first_instruction_index(start);
1031 block->set_last_instruction_index(end); 1028 block->set_last_instruction_index(end);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 stream->Add("]"); 1115 stream->Add("]");
1119 } 1116 }
1120 1117
1121 1118
1122 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { 1119 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
1123 if (hydrogen_env == NULL) return NULL; 1120 if (hydrogen_env == NULL) return NULL;
1124 1121
1125 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer()); 1122 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer());
1126 int ast_id = hydrogen_env->ast_id(); 1123 int ast_id = hydrogen_env->ast_id();
1127 ASSERT(ast_id != AstNode::kNoNumber); 1124 ASSERT(ast_id != AstNode::kNoNumber);
1128 int value_count = hydrogen_env->values()->length(); 1125 int value_count = hydrogen_env->length();
1129 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), 1126 LEnvironment* result = new LEnvironment(hydrogen_env->closure(),
1130 ast_id, 1127 ast_id,
1131 hydrogen_env->parameter_count(), 1128 hydrogen_env->parameter_count(),
1132 argument_count_, 1129 argument_count_,
1133 value_count, 1130 value_count,
1134 outer); 1131 outer);
1135 int argument_index = 0; 1132 int argument_index = 0;
1136 for (int i = 0; i < value_count; ++i) { 1133 for (int i = 0; i < value_count; ++i) {
1137 HValue* value = hydrogen_env->values()->at(i); 1134 HValue* value = hydrogen_env->values()->at(i);
1138 LOperand* op = NULL; 1135 LOperand* op = NULL;
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 2053
2057 env->Drop(instr->pop_count()); 2054 env->Drop(instr->pop_count());
2058 for (int i = 0; i < instr->values()->length(); ++i) { 2055 for (int i = 0; i < instr->values()->length(); ++i) {
2059 HValue* value = instr->values()->at(i); 2056 HValue* value = instr->values()->at(i);
2060 if (instr->HasAssignedIndexAt(i)) { 2057 if (instr->HasAssignedIndexAt(i)) {
2061 env->Bind(instr->GetAssignedIndexAt(i), value); 2058 env->Bind(instr->GetAssignedIndexAt(i), value);
2062 } else { 2059 } else {
2063 env->Push(value); 2060 env->Push(value);
2064 } 2061 }
2065 } 2062 }
2066 2063 ASSERT(env->length() == instr->environment_length());
2067 if (FLAG_trace_environment) {
2068 PrintF("Reconstructed environment ast_id=%d, instr_id=%d\n",
2069 instr->ast_id(),
2070 instr->id());
2071 env->PrintToStd();
2072 }
2073 ASSERT(env->values()->length() == instr->environment_height());
2074 2064
2075 // If there is an instruction pending deoptimization environment create a 2065 // If there is an instruction pending deoptimization environment create a
2076 // lazy bailout instruction to capture the environment. 2066 // lazy bailout instruction to capture the environment.
2077 if (pending_deoptimization_ast_id_ == instr->ast_id()) { 2067 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2078 LInstruction* result = new LLazyBailout; 2068 LInstruction* result = new LLazyBailout;
2079 result = AssignEnvironment(result); 2069 result = AssignEnvironment(result);
2080 instructions_pending_deoptimization_environment_-> 2070 instructions_pending_deoptimization_environment_->
2081 set_deoptimization_environment(result->environment()); 2071 set_deoptimization_environment(result->environment());
2082 ClearInstructionPendingDeoptimizationEnvironment(); 2072 ClearInstructionPendingDeoptimizationEnvironment();
2083 return result; 2073 return result;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 void LPointerMap::PrintTo(StringStream* stream) const { 2113 void LPointerMap::PrintTo(StringStream* stream) const {
2124 stream->Add("{"); 2114 stream->Add("{");
2125 for (int i = 0; i < pointer_operands_.length(); ++i) { 2115 for (int i = 0; i < pointer_operands_.length(); ++i) {
2126 if (i != 0) stream->Add(";"); 2116 if (i != 0) stream->Add(";");
2127 pointer_operands_[i]->PrintTo(stream); 2117 pointer_operands_[i]->PrintTo(stream);
2128 } 2118 }
2129 stream->Add("} @%d", position()); 2119 stream->Add("} @%d", position());
2130 } 2120 }
2131 2121
2132 } } // namespace v8::internal 2122 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698