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

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

Issue 2257143002: [interpreter] Fix self-healing with preserved bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added ports and test. Created 4 years, 4 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/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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // it is present) and load it into kInterpreterBytecodeArrayRegister. 577 // it is present) and load it into kInterpreterBytecodeArrayRegister.
578 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 578 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
579 Label load_debug_bytecode_array, bytecode_array_loaded; 579 Label load_debug_bytecode_array, bytecode_array_loaded;
580 __ cmp(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset), 580 __ cmp(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset),
581 Immediate(DebugInfo::uninitialized())); 581 Immediate(DebugInfo::uninitialized()));
582 __ j(not_equal, &load_debug_bytecode_array); 582 __ j(not_equal, &load_debug_bytecode_array);
583 __ mov(kInterpreterBytecodeArrayRegister, 583 __ mov(kInterpreterBytecodeArrayRegister,
584 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); 584 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset));
585 __ bind(&bytecode_array_loaded); 585 __ bind(&bytecode_array_loaded);
586 586
587 // Check whether we should continue to use the interpreter.
588 Label switch_to_different_code_kind;
589 __ Move(ecx, masm->CodeObject()); // Self-reference to this code.
590 __ cmp(ecx, FieldOperand(eax, SharedFunctionInfo::kCodeOffset));
591 __ j(not_equal, &switch_to_different_code_kind);
592
587 // Check function data field is actually a BytecodeArray object. 593 // Check function data field is actually a BytecodeArray object.
588 Label bytecode_array_not_present;
589 __ CompareRoot(kInterpreterBytecodeArrayRegister,
590 Heap::kUndefinedValueRootIndex);
591 __ j(equal, &bytecode_array_not_present);
592 if (FLAG_debug_code) { 594 if (FLAG_debug_code) {
593 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 595 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
594 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 596 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
595 eax); 597 eax);
596 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 598 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
597 } 599 }
598 600
599 // Push bytecode array. 601 // Push bytecode array.
600 __ push(kInterpreterBytecodeArrayRegister); 602 __ push(kInterpreterBytecodeArrayRegister);
601 // Push Smi tagged initial bytecode array offset. 603 // Push Smi tagged initial bytecode array offset.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 __ ret(0); 655 __ ret(0);
654 656
655 // Load debug copy of the bytecode array. 657 // Load debug copy of the bytecode array.
656 __ bind(&load_debug_bytecode_array); 658 __ bind(&load_debug_bytecode_array);
657 Register debug_info = kInterpreterBytecodeArrayRegister; 659 Register debug_info = kInterpreterBytecodeArrayRegister;
658 __ mov(debug_info, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset)); 660 __ mov(debug_info, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset));
659 __ mov(kInterpreterBytecodeArrayRegister, 661 __ mov(kInterpreterBytecodeArrayRegister,
660 FieldOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); 662 FieldOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex));
661 __ jmp(&bytecode_array_loaded); 663 __ jmp(&bytecode_array_loaded);
662 664
663 // If the bytecode array is no longer present, then the underlying function 665 // If the shared code is no longer this entry trampoline, then the underlying
664 // has been switched to a different kind of code and we heal the closure by 666 // function has been switched to a different kind of code and we heal the
665 // switching the code entry field over to the new code object as well. 667 // closure by switching the code entry field over to the new code as well.
666 __ bind(&bytecode_array_not_present); 668 __ bind(&switch_to_different_code_kind);
667 __ pop(edx); // Callee's new target. 669 __ pop(edx); // Callee's new target.
668 __ pop(edi); // Callee's JS function. 670 __ pop(edi); // Callee's JS function.
669 __ pop(esi); // Callee's context. 671 __ pop(esi); // Callee's context.
670 __ leave(); // Leave the frame so we can tail call. 672 __ leave(); // Leave the frame so we can tail call.
671 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 673 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
672 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kCodeOffset)); 674 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kCodeOffset));
673 __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize)); 675 __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize));
674 __ mov(FieldOperand(edi, JSFunction::kCodeEntryOffset), ecx); 676 __ mov(FieldOperand(edi, JSFunction::kCodeEntryOffset), ecx);
675 __ RecordWriteCodeEntryField(edi, ecx, ebx); 677 __ RecordWriteCodeEntryField(edi, ecx, ebx);
676 __ jmp(ecx); 678 __ jmp(ecx);
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 3030
3029 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3031 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3030 Generate_OnStackReplacementHelper(masm, true); 3032 Generate_OnStackReplacementHelper(masm, true);
3031 } 3033 }
3032 3034
3033 #undef __ 3035 #undef __
3034 } // namespace internal 3036 } // namespace internal
3035 } // namespace v8 3037 } // namespace v8
3036 3038
3037 #endif // V8_TARGET_ARCH_IA32 3039 #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