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

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

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

Powered by Google App Engine
This is Rietveld 408576698