OLD | NEW |
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 Loading... |
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 Loading... |
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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 env->Drop(instr->pop_count()); | 2048 env->Drop(instr->pop_count()); |
2052 for (int i = 0; i < instr->values()->length(); ++i) { | 2049 for (int i = 0; i < instr->values()->length(); ++i) { |
2053 HValue* value = instr->values()->at(i); | 2050 HValue* value = instr->values()->at(i); |
2054 if (instr->HasAssignedIndexAt(i)) { | 2051 if (instr->HasAssignedIndexAt(i)) { |
2055 env->Bind(instr->GetAssignedIndexAt(i), value); | 2052 env->Bind(instr->GetAssignedIndexAt(i), value); |
2056 } else { | 2053 } else { |
2057 env->Push(value); | 2054 env->Push(value); |
2058 } | 2055 } |
2059 } | 2056 } |
2060 | 2057 |
2061 if (FLAG_trace_environment) { | 2058 ASSERT(env->length() == instr->environment_length()); |
2062 PrintF("Reconstructed environment ast_id=%d, instr_id=%d\n", | |
2063 instr->ast_id(), | |
2064 instr->id()); | |
2065 env->PrintToStd(); | |
2066 } | |
2067 ASSERT(env->values()->length() == instr->environment_height()); | |
2068 | 2059 |
2069 // If there is an instruction pending deoptimization environment create a | 2060 // If there is an instruction pending deoptimization environment create a |
2070 // lazy bailout instruction to capture the environment. | 2061 // lazy bailout instruction to capture the environment. |
2071 if (pending_deoptimization_ast_id_ == instr->ast_id()) { | 2062 if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
2072 LInstruction* result = new LLazyBailout; | 2063 LInstruction* result = new LLazyBailout; |
2073 result = AssignEnvironment(result); | 2064 result = AssignEnvironment(result); |
2074 instructions_pending_deoptimization_environment_-> | 2065 instructions_pending_deoptimization_environment_-> |
2075 set_deoptimization_environment(result->environment()); | 2066 set_deoptimization_environment(result->environment()); |
2076 ClearInstructionPendingDeoptimizationEnvironment(); | 2067 ClearInstructionPendingDeoptimizationEnvironment(); |
2077 return result; | 2068 return result; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 void LPointerMap::PrintTo(StringStream* stream) const { | 2108 void LPointerMap::PrintTo(StringStream* stream) const { |
2118 stream->Add("{"); | 2109 stream->Add("{"); |
2119 for (int i = 0; i < pointer_operands_.length(); ++i) { | 2110 for (int i = 0; i < pointer_operands_.length(); ++i) { |
2120 if (i != 0) stream->Add(";"); | 2111 if (i != 0) stream->Add(";"); |
2121 pointer_operands_[i]->PrintTo(stream); | 2112 pointer_operands_[i]->PrintTo(stream); |
2122 } | 2113 } |
2123 stream->Add("} @%d", position()); | 2114 stream->Add("} @%d", position()); |
2124 } | 2115 } |
2125 | 2116 |
2126 } } // namespace v8::internal | 2117 } } // namespace v8::internal |
OLD | NEW |