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

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

Issue 2504223002: [fullcodegen] Remove deprecated generator implementation. (Closed)
Patch Set: Rebased. Created 4 years 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/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 { 430 {
431 Label done_loop, loop; 431 Label done_loop, loop;
432 __ bind(&loop); 432 __ bind(&loop);
433 __ sub(ecx, Immediate(Smi::FromInt(1))); 433 __ sub(ecx, Immediate(Smi::FromInt(1)));
434 __ j(carry, &done_loop, Label::kNear); 434 __ j(carry, &done_loop, Label::kNear);
435 __ PushRoot(Heap::kTheHoleValueRootIndex); 435 __ PushRoot(Heap::kTheHoleValueRootIndex);
436 __ jmp(&loop); 436 __ jmp(&loop);
437 __ bind(&done_loop); 437 __ bind(&done_loop);
438 } 438 }
439 439
440 // Dispatch on the kind of generator object. 440 // Underlying function needs to have bytecode available.
441 Label old_generator; 441 if (FLAG_debug_code) {
442 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 442 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
443 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kFunctionDataOffset)); 443 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kFunctionDataOffset));
444 __ CmpObjectType(ecx, BYTECODE_ARRAY_TYPE, ecx); 444 __ CmpObjectType(ecx, BYTECODE_ARRAY_TYPE, ecx);
445 __ j(not_equal, &old_generator); 445 __ Assert(equal, kMissingBytecodeArray);
446 }
446 447
447 // New-style (ignition/turbofan) generator object 448 // Resume (Ignition/TurboFan) generator object.
448 { 449 {
449 __ PushReturnAddressFrom(eax); 450 __ PushReturnAddressFrom(eax);
450 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 451 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
451 __ mov(eax, 452 __ mov(eax,
452 FieldOperand(ecx, SharedFunctionInfo::kFormalParameterCountOffset)); 453 FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset));
453 // We abuse new.target both to indicate that this is a resume call and to 454 // We abuse new.target both to indicate that this is a resume call and to
454 // pass in the generator object. In ordinary calls, new.target is always 455 // pass in the generator object. In ordinary calls, new.target is always
455 // undefined because generator functions are non-constructable. 456 // undefined because generator functions are non-constructable.
456 __ mov(edx, ebx); 457 __ mov(edx, ebx);
457 __ jmp(FieldOperand(edi, JSFunction::kCodeEntryOffset)); 458 __ jmp(FieldOperand(edi, JSFunction::kCodeEntryOffset));
458 } 459 }
459 460
460 // Old-style (full-codegen) generator object
461 __ bind(&old_generator);
462 {
463 // Enter a new JavaScript frame, and initialize its slots as they were when
464 // the generator was suspended.
465 FrameScope scope(masm, StackFrame::MANUAL);
466 __ PushReturnAddressFrom(eax); // Return address.
467 __ Push(ebp); // Caller's frame pointer.
468 __ Move(ebp, esp);
469 __ Push(esi); // Callee's context.
470 __ Push(edi); // Callee's JS Function.
471
472 // Restore the operand stack.
473 __ mov(eax, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset));
474 {
475 Label done_loop, loop;
476 __ Move(ecx, Smi::kZero);
477 __ bind(&loop);
478 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset));
479 __ j(equal, &done_loop, Label::kNear);
480 __ Push(FieldOperand(eax, ecx, times_half_pointer_size,
481 FixedArray::kHeaderSize));
482 __ add(ecx, Immediate(Smi::FromInt(1)));
483 __ jmp(&loop);
484 __ bind(&done_loop);
485 }
486
487 // Reset operand stack so we don't leak.
488 __ mov(FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset),
489 Immediate(masm->isolate()->factory()->empty_fixed_array()));
490
491 // Resume the generator function at the continuation.
492 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
493 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset));
494 __ mov(ecx, FieldOperand(ebx, JSGeneratorObject::kContinuationOffset));
495 __ SmiUntag(ecx);
496 __ lea(edx, FieldOperand(edx, ecx, times_1, Code::kHeaderSize));
497 __ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset),
498 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
499 __ mov(eax, ebx); // Continuation expects generator object in eax.
500 __ jmp(edx);
501 }
502
503 __ bind(&prepare_step_in_if_stepping); 461 __ bind(&prepare_step_in_if_stepping);
504 { 462 {
505 FrameScope scope(masm, StackFrame::INTERNAL); 463 FrameScope scope(masm, StackFrame::INTERNAL);
506 __ Push(ebx); 464 __ Push(ebx);
507 __ Push(edx); 465 __ Push(edx);
508 __ Push(edi); 466 __ Push(edi);
509 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); 467 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping);
510 __ Pop(edx); 468 __ Pop(edx);
511 __ Pop(ebx); 469 __ Pop(ebx);
512 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); 470 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset));
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
3157 3115
3158 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3116 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3159 Generate_OnStackReplacementHelper(masm, true); 3117 Generate_OnStackReplacementHelper(masm, true);
3160 } 3118 }
3161 3119
3162 #undef __ 3120 #undef __
3163 } // namespace internal 3121 } // namespace internal
3164 } // namespace v8 3122 } // namespace v8
3165 3123
3166 #endif // V8_TARGET_ARCH_IA32 3124 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698