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

Side by Side Diff: src/compiler/code-generator.cc

Issue 534573002: Reland "Make FrameStates recursive (to be used for inlining).". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase. Created 6 years, 3 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/compiler/code-generator.h ('k') | src/compiler/graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 10
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 FrameStateDescriptor* CodeGenerator::GetFrameStateDescriptor( 295 FrameStateDescriptor* CodeGenerator::GetFrameStateDescriptor(
296 Instruction* instr, int frame_state_offset) { 296 Instruction* instr, int frame_state_offset) {
297 InstructionOperandConverter i(this, instr); 297 InstructionOperandConverter i(this, instr);
298 InstructionSequence::StateId state_id = 298 InstructionSequence::StateId state_id =
299 InstructionSequence::StateId::FromInt(i.InputInt32(frame_state_offset)); 299 InstructionSequence::StateId::FromInt(i.InputInt32(frame_state_offset));
300 return code()->GetFrameStateDescriptor(state_id); 300 return code()->GetFrameStateDescriptor(state_id);
301 } 301 }
302 302
303 303
304 int CodeGenerator::BuildTranslation(Instruction* instr, int frame_state_offset, 304 void CodeGenerator::BuildTranslationForFrameStateDescriptor(
305 OutputFrameStateCombine state_combine) { 305 FrameStateDescriptor* descriptor, Instruction* instr,
306 FrameStateDescriptor* descriptor = 306 Translation* translation, int frame_state_offset,
307 GetFrameStateDescriptor(instr, frame_state_offset); 307 OutputFrameStateCombine state_combine) {
308 frame_state_offset++; 308 // Outer-most state must be added to translation first.
309 if (descriptor->outer_state() != NULL) {
310 BuildTranslationForFrameStateDescriptor(
311 descriptor->outer_state(), instr, translation,
312 frame_state_offset + descriptor->size(), kIgnoreOutput);
313 }
309 314
310 int height = descriptor->size() - descriptor->parameters_count(); 315 int height = descriptor->size() - descriptor->parameters_count();
311 switch (state_combine) { 316 switch (state_combine) {
312 case kPushOutput: 317 case kPushOutput:
313 height++; 318 height++;
314 break; 319 break;
315 case kIgnoreOutput: 320 case kIgnoreOutput:
316 break; 321 break;
317 } 322 }
318 323
319 324 translation->BeginJSFrame(descriptor->bailout_id(),
320 Translation translation(&translations_, 1, 1, zone()); 325 Translation::kSelfLiteralId, height);
321 translation.BeginJSFrame(descriptor->bailout_id(),
322 Translation::kSelfLiteralId, height);
323 326
324 for (int i = 0; i < descriptor->size(); i++) { 327 for (int i = 0; i < descriptor->size(); i++) {
325 AddTranslationForOperand(&translation, instr, 328 AddTranslationForOperand(translation, instr,
326 instr->InputAt(i + frame_state_offset)); 329 instr->InputAt(i + frame_state_offset));
327 } 330 }
328 331
329 switch (state_combine) { 332 switch (state_combine) {
330 case kPushOutput: 333 case kPushOutput:
331 DCHECK(instr->OutputCount() == 1); 334 DCHECK(instr->OutputCount() == 1);
332 AddTranslationForOperand(&translation, instr, instr->OutputAt(0)); 335 AddTranslationForOperand(translation, instr, instr->OutputAt(0));
333 break; 336 break;
334 case kIgnoreOutput: 337 case kIgnoreOutput:
335 break; 338 break;
336 } 339 }
340 }
341
342
343 int CodeGenerator::BuildTranslation(Instruction* instr, int frame_state_offset,
344 OutputFrameStateCombine state_combine) {
345 FrameStateDescriptor* descriptor =
346 GetFrameStateDescriptor(instr, frame_state_offset);
347 frame_state_offset++;
348
349 int frame_count = descriptor->GetFrameCount();
350 Translation translation(&translations_, frame_count, frame_count, zone());
351 BuildTranslationForFrameStateDescriptor(descriptor, instr, &translation,
352 frame_state_offset, state_combine);
337 353
338 int deoptimization_id = static_cast<int>(deoptimization_states_.size()); 354 int deoptimization_id = static_cast<int>(deoptimization_states_.size());
339 355
340 deoptimization_states_.push_back(new (zone()) DeoptimizationState( 356 deoptimization_states_.push_back(new (zone()) DeoptimizationState(
341 descriptor->bailout_id(), translation.index())); 357 descriptor->bailout_id(), translation.index()));
342 358
343 return deoptimization_id; 359 return deoptimization_id;
344 } 360 }
345 361
346 362
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 441 }
426 442
427 443
428 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } 444 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); }
429 445
430 #endif // !V8_TURBOFAN_BACKEND 446 #endif // !V8_TURBOFAN_BACKEND
431 447
432 } // namespace compiler 448 } // namespace compiler
433 } // namespace internal 449 } // namespace internal
434 } // namespace v8 450 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698