OLD | NEW |
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 kDontSaveFPRegs); | 400 kDontSaveFPRegs); |
401 | 401 |
402 // Store resume mode into generator object. | 402 // Store resume mode into generator object. |
403 __ mov(FieldOperand(ebx, JSGeneratorObject::kResumeModeOffset), edx); | 403 __ mov(FieldOperand(ebx, JSGeneratorObject::kResumeModeOffset), edx); |
404 | 404 |
405 // Load suspended function and context. | 405 // Load suspended function and context. |
406 __ mov(esi, FieldOperand(ebx, JSGeneratorObject::kContextOffset)); | 406 __ mov(esi, FieldOperand(ebx, JSGeneratorObject::kContextOffset)); |
407 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); | 407 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); |
408 | 408 |
409 // Flood function if we are stepping. | 409 // Flood function if we are stepping. |
410 Label skip_flooding; | 410 Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; |
| 411 Label stepping_prepared; |
411 ExternalReference step_in_enabled = | 412 ExternalReference step_in_enabled = |
412 ExternalReference::debug_step_in_enabled_address(masm->isolate()); | 413 ExternalReference::debug_step_in_enabled_address(masm->isolate()); |
413 __ cmpb(Operand::StaticVariable(step_in_enabled), Immediate(0)); | 414 __ cmpb(Operand::StaticVariable(step_in_enabled), Immediate(0)); |
414 __ j(equal, &skip_flooding); | 415 __ j(not_equal, &prepare_step_in_if_stepping); |
415 { | 416 |
416 FrameScope scope(masm, StackFrame::INTERNAL); | 417 // Flood function if we need to continue stepping in the suspended generator. |
417 __ Push(ebx); | 418 ExternalReference debug_suspended_generator = |
418 __ Push(edx); | 419 ExternalReference::debug_suspended_generator_address(masm->isolate()); |
419 __ Push(edi); | 420 __ cmp(ebx, Operand::StaticVariable(debug_suspended_generator)); |
420 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 421 __ j(equal, &prepare_step_in_suspended_generator); |
421 __ Pop(edx); | 422 __ bind(&stepping_prepared); |
422 __ Pop(ebx); | |
423 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); | |
424 } | |
425 __ bind(&skip_flooding); | |
426 | 423 |
427 // Pop return address. | 424 // Pop return address. |
428 __ PopReturnAddressTo(eax); | 425 __ PopReturnAddressTo(eax); |
429 | 426 |
430 // Push receiver. | 427 // Push receiver. |
431 __ Push(FieldOperand(ebx, JSGeneratorObject::kReceiverOffset)); | 428 __ Push(FieldOperand(ebx, JSGeneratorObject::kReceiverOffset)); |
432 | 429 |
433 // ----------- S t a t e ------------- | 430 // ----------- S t a t e ------------- |
434 // -- eax : return address | 431 // -- eax : return address |
435 // -- ebx : the JSGeneratorObject to resume | 432 // -- ebx : the JSGeneratorObject to resume |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 508 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
512 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); | 509 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); |
513 __ mov(ecx, FieldOperand(ebx, JSGeneratorObject::kContinuationOffset)); | 510 __ mov(ecx, FieldOperand(ebx, JSGeneratorObject::kContinuationOffset)); |
514 __ SmiUntag(ecx); | 511 __ SmiUntag(ecx); |
515 __ lea(edx, FieldOperand(edx, ecx, times_1, Code::kHeaderSize)); | 512 __ lea(edx, FieldOperand(edx, ecx, times_1, Code::kHeaderSize)); |
516 __ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset), | 513 __ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset), |
517 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 514 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
518 __ mov(eax, ebx); // Continuation expects generator object in eax. | 515 __ mov(eax, ebx); // Continuation expects generator object in eax. |
519 __ jmp(edx); | 516 __ jmp(edx); |
520 } | 517 } |
| 518 |
| 519 __ bind(&prepare_step_in_if_stepping); |
| 520 { |
| 521 FrameScope scope(masm, StackFrame::INTERNAL); |
| 522 __ Push(ebx); |
| 523 __ Push(edx); |
| 524 __ Push(edi); |
| 525 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 526 __ Pop(edx); |
| 527 __ Pop(ebx); |
| 528 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); |
| 529 } |
| 530 __ jmp(&stepping_prepared); |
| 531 |
| 532 __ bind(&prepare_step_in_suspended_generator); |
| 533 { |
| 534 FrameScope scope(masm, StackFrame::INTERNAL); |
| 535 __ Push(ebx); |
| 536 __ Push(edx); |
| 537 __ CallRuntime(Runtime::kDebugPrepareStepInSuspendedGenerator); |
| 538 __ Pop(edx); |
| 539 __ Pop(ebx); |
| 540 __ mov(edi, FieldOperand(ebx, JSGeneratorObject::kFunctionOffset)); |
| 541 } |
| 542 __ jmp(&stepping_prepared); |
521 } | 543 } |
522 | 544 |
523 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1, | 545 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1, |
524 Register scratch2) { | 546 Register scratch2) { |
525 Register args_count = scratch1; | 547 Register args_count = scratch1; |
526 Register return_pc = scratch2; | 548 Register return_pc = scratch2; |
527 | 549 |
528 // Get the arguments + reciever count. | 550 // Get the arguments + reciever count. |
529 __ mov(args_count, | 551 __ mov(args_count, |
530 Operand(ebp, InterpreterFrameConstants::kBytecodeArrayFromFp)); | 552 Operand(ebp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
(...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 // And "return" to the OSR entry point of the function. | 2882 // And "return" to the OSR entry point of the function. |
2861 __ ret(0); | 2883 __ ret(0); |
2862 } | 2884 } |
2863 | 2885 |
2864 | 2886 |
2865 #undef __ | 2887 #undef __ |
2866 } // namespace internal | 2888 } // namespace internal |
2867 } // namespace v8 | 2889 } // namespace v8 |
2868 | 2890 |
2869 #endif // V8_TARGET_ARCH_IA32 | 2891 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |