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

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

Issue 1867263002: [generators] Store the resume mode in the generator object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Other platforms Created 4 years, 8 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
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/mips/builtins-mips.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 // -- edx : the resume mode (tagged) 399 // -- edx : the resume mode (tagged)
400 // -- esp[0] : return address 400 // -- esp[0] : return address
401 // ----------------------------------- 401 // -----------------------------------
402 __ AssertGeneratorObject(ebx); 402 __ AssertGeneratorObject(ebx);
403 403
404 // Store input value into generator object. 404 // Store input value into generator object.
405 __ mov(FieldOperand(ebx, JSGeneratorObject::kInputOffset), eax); 405 __ mov(FieldOperand(ebx, JSGeneratorObject::kInputOffset), eax);
406 __ RecordWriteField(ebx, JSGeneratorObject::kInputOffset, eax, ecx, 406 __ RecordWriteField(ebx, JSGeneratorObject::kInputOffset, eax, ecx,
407 kDontSaveFPRegs); 407 kDontSaveFPRegs);
408 408
409 // Store resume mode into generator object.
410 __ mov(FieldOperand(ebx, JSGeneratorObject::kResumeModeOffset), edx);
411
409 // Load suspended function and context. 412 // Load suspended function and context.
410 __ mov(esi, FieldOperand(ebx, JSGeneratorObject::kContextOffset)); 413 __ mov(esi, FieldOperand(ebx, JSGeneratorObject::kContextOffset));
411 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); 414 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset));
412 415
413 // Flood function if we are stepping. 416 // Flood function if we are stepping.
414 Label skip_flooding; 417 Label skip_flooding;
415 ExternalReference step_in_enabled = 418 ExternalReference step_in_enabled =
416 ExternalReference::debug_step_in_enabled_address(masm->isolate()); 419 ExternalReference::debug_step_in_enabled_address(masm->isolate());
417 __ cmpb(Operand::StaticVariable(step_in_enabled), Immediate(0)); 420 __ cmpb(Operand::StaticVariable(step_in_enabled), Immediate(0));
418 __ j(equal, &skip_flooding); 421 __ j(equal, &skip_flooding);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 __ bind(&loop); 480 __ bind(&loop);
478 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset)); 481 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset));
479 __ j(equal, &done_loop, Label::kNear); 482 __ j(equal, &done_loop, Label::kNear);
480 __ Push(FieldOperand(eax, ecx, times_half_pointer_size, 483 __ Push(FieldOperand(eax, ecx, times_half_pointer_size,
481 FixedArray::kHeaderSize)); 484 FixedArray::kHeaderSize));
482 __ add(ecx, Immediate(Smi::FromInt(1))); 485 __ add(ecx, Immediate(Smi::FromInt(1)));
483 __ jmp(&loop); 486 __ jmp(&loop);
484 __ bind(&done_loop); 487 __ bind(&done_loop);
485 } 488 }
486 489
487 // Push resume mode (consumed in continuation).
488 __ Push(edx);
489
490 // Reset operand stack so we don't leak. 490 // Reset operand stack so we don't leak.
491 __ mov(FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset), 491 __ mov(FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset),
492 Immediate(masm->isolate()->factory()->empty_fixed_array())); 492 Immediate(masm->isolate()->factory()->empty_fixed_array()));
493 493
494 // Restore value.
495 __ mov(eax, FieldOperand(ebx, JSGeneratorObject::kInputOffset));
496
497 // Resume the generator function at the continuation. 494 // Resume the generator function at the continuation.
498 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 495 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
499 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); 496 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset));
500 __ mov(ecx, FieldOperand(ebx, JSGeneratorObject::kContinuationOffset)); 497 __ mov(ecx, FieldOperand(ebx, JSGeneratorObject::kContinuationOffset));
501 __ SmiUntag(ecx); 498 __ SmiUntag(ecx);
502 __ lea(edx, FieldOperand(edx, ecx, times_1, Code::kHeaderSize)); 499 __ lea(edx, FieldOperand(edx, ecx, times_1, Code::kHeaderSize));
503 __ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset), 500 __ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset),
504 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 501 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
502 __ mov(eax, ebx); // Continuation expects generator object in eax.
505 __ jmp(edx); 503 __ jmp(edx);
506 } 504 }
507 505
508 // Generate code for entering a JS function with the interpreter. 506 // Generate code for entering a JS function with the interpreter.
509 // On entry to the function the receiver and arguments have been pushed on the 507 // On entry to the function the receiver and arguments have been pushed on the
510 // stack left to right. The actual argument count matches the formal parameter 508 // stack left to right. The actual argument count matches the formal parameter
511 // count expected by the function. 509 // count expected by the function.
512 // 510 //
513 // The live registers are: 511 // The live registers are:
514 // o edi: the JS function object being called 512 // o edi: the JS function object being called
(...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 // And "return" to the OSR entry point of the function. 2722 // And "return" to the OSR entry point of the function.
2725 __ ret(0); 2723 __ ret(0);
2726 } 2724 }
2727 2725
2728 2726
2729 #undef __ 2727 #undef __
2730 } // namespace internal 2728 } // namespace internal
2731 } // namespace v8 2729 } // namespace v8
2732 2730
2733 #endif // V8_TARGET_ARCH_IA32 2731 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698