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