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

Unified Diff: src/compiler/code-generator.cc

Issue 517323002: Make FrameStates recursive (to be used for inlining). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bug in GetParentCount Created 6 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
Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index edfdaa79caa440022756e017347eda6c750a7b98..689588ea74f75ec3b640ffbf1df72f1b7a81087c 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -310,6 +310,27 @@ int CodeGenerator::DefineDeoptimizationLiteral(Handle<Object> literal) {
}
+void CodeGenerator::BuildTranslationForFrameStateDescriptor(
+ FrameStateDescriptor* descriptor, Instruction* instr,
+ Translation* translation, int frame_state_offset) {
+ // Oldest parent must be added to translation first.
+ if (descriptor->parent() != NULL) {
+ BuildTranslationForFrameStateDescriptor(
+ descriptor->parent(), instr, translation,
+ frame_state_offset + descriptor->size());
+ }
+
+ translation->BeginJSFrame(
+ descriptor->bailout_id(), Translation::kSelfLiteralId,
+ descriptor->size() - descriptor->parameters_count());
+
+ for (int i = 0; i < descriptor->size(); i++) {
+ AddTranslationForOperand(translation, instr,
+ instr->InputAt(i + frame_state_offset));
+ }
+}
+
+
int CodeGenerator::BuildTranslation(Instruction* instr,
int frame_state_offset) {
InstructionOperandConverter i(this, instr);
@@ -321,15 +342,10 @@ int CodeGenerator::BuildTranslation(Instruction* instr,
FrameStateDescriptor* descriptor =
code()->GetDeoptimizationEntry(deoptimization_id);
- Translation translation(&translations_, 1, 1, zone());
- translation.BeginJSFrame(descriptor->bailout_id(),
- Translation::kSelfLiteralId,
- descriptor->size() - descriptor->parameters_count());
-
- for (int i = 0; i < descriptor->size(); i++) {
- AddTranslationForOperand(&translation, instr,
- instr->InputAt(i + frame_state_offset));
- }
+ int frame_count = descriptor->GetFrameCount();
+ Translation translation(&translations_, frame_count, frame_count, zone());
+ BuildTranslationForFrameStateDescriptor(descriptor, instr, &translation,
+ frame_state_offset);
deoptimization_states_[deoptimization_id] =
new (zone()) DeoptimizationState(translation.index());

Powered by Google App Engine
This is Rietveld 408576698