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/x87/builtins-x87.cc

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

Powered by Google App Engine
This is Rietveld 408576698