Chromium Code Reviews

Side by Side 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 whitespace. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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...)
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(),
313 descriptor->outer_state()->state_combine());
Jarin 2014/09/02 10:28:38 I think we will have to ignore the output for the
sigurds 2014/09/02 10:43:58 Done.
314 }
309 315
310 int height = descriptor->size() - descriptor->parameters_count(); 316 int height = descriptor->size() - descriptor->parameters_count();
311 switch (state_combine) { 317 switch (state_combine) {
312 case kPushOutput: 318 case kPushOutput:
313 height++; 319 height++;
314 break; 320 break;
315 case kIgnoreOutput: 321 case kIgnoreOutput:
316 break; 322 break;
317 } 323 }
318 324
319 325 translation->BeginJSFrame(descriptor->bailout_id(),
320 Translation translation(&translations_, 1, 1, zone()); 326 Translation::kSelfLiteralId, height);
321 translation.BeginJSFrame(descriptor->bailout_id(),
322 Translation::kSelfLiteralId, height);
323 327
324 for (int i = 0; i < descriptor->size(); i++) { 328 for (int i = 0; i < descriptor->size(); i++) {
325 AddTranslationForOperand(&translation, instr, 329 AddTranslationForOperand(translation, instr,
326 instr->InputAt(i + frame_state_offset)); 330 instr->InputAt(i + frame_state_offset));
327 } 331 }
328 332
329 switch (state_combine) { 333 switch (state_combine) {
330 case kPushOutput: 334 case kPushOutput:
331 DCHECK(instr->OutputCount() == 1); 335 DCHECK(instr->OutputCount() == 1);
332 AddTranslationForOperand(&translation, instr, instr->OutputAt(0)); 336 AddTranslationForOperand(translation, instr, instr->OutputAt(0));
333 break; 337 break;
334 case kIgnoreOutput: 338 case kIgnoreOutput:
335 break; 339 break;
336 } 340 }
341 }
342
343
344 int CodeGenerator::BuildTranslation(Instruction* instr, int frame_state_offset,
345 OutputFrameStateCombine state_combine) {
346 FrameStateDescriptor* descriptor =
347 GetFrameStateDescriptor(instr, frame_state_offset);
348 frame_state_offset++;
349
350 int frame_count = descriptor->GetFrameCount();
351 Translation translation(&translations_, frame_count, frame_count, zone());
352 BuildTranslationForFrameStateDescriptor(descriptor, instr, &translation,
353 frame_state_offset, state_combine);
337 354
338 int deoptimization_id = static_cast<int>(deoptimization_states_.size()); 355 int deoptimization_id = static_cast<int>(deoptimization_states_.size());
339 356
340 deoptimization_states_.push_back(new (zone()) DeoptimizationState( 357 deoptimization_states_.push_back(new (zone()) DeoptimizationState(
341 descriptor->bailout_id(), translation.index())); 358 descriptor->bailout_id(), translation.index()));
342 359
343 return deoptimization_id; 360 return deoptimization_id;
344 } 361 }
345 362
346 363
(...skipping 78 matching lines...)
425 } 442 }
426 443
427 444
428 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } 445 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); }
429 446
430 #endif // !V8_TURBOFAN_BACKEND 447 #endif // !V8_TURBOFAN_BACKEND
431 448
432 } // namespace compiler 449 } // namespace compiler
433 } // namespace internal 450 } // namespace internal
434 } // namespace v8 451 } // 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