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

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

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

Powered by Google App Engine
This is Rietveld 408576698