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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 261953002: Fix for 3303 MultithreadedParallelIsolates has a race condition. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 7 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 | Annotate | Revision Log
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 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "codegen.h" 9 #include "codegen.h"
10 #include "macro-assembler.h" 10 #include "macro-assembler.h"
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 __ bind(&done); 815 __ bind(&done);
816 } 816 }
817 817
818 #undef __ 818 #undef __
819 819
820 #ifdef DEBUG 820 #ifdef DEBUG
821 // add(r0, pc, Operand(-8)) 821 // add(r0, pc, Operand(-8))
822 static const uint32_t kCodeAgePatchFirstInstruction = 0xe24f0008; 822 static const uint32_t kCodeAgePatchFirstInstruction = 0xe24f0008;
823 #endif 823 #endif
824 824
825 static byte* GetNoCodeAgeSequence(uint32_t* length) { 825 NoCodeAgeSequence::NoCodeAgeSequence() {
826 // The sequence of instructions that is patched out for aging code is the 826 ASSERT(sequence_.length() == kNoCodeAgeSequenceLength);
827 // following boilerplate stack-building prologue that is found in FUNCTIONS 827 // Since patcher is a large object, allocate it dynamically when needed,
828 static bool initialized = false; 828 // to avoid overloading the stack in stress conditions.
829 static uint32_t sequence[kNoCodeAgeSequenceLength]; 829 SmartPointer<CodePatcher>
830 byte* byte_sequence = reinterpret_cast<byte*>(sequence); 830 patcher(new CodePatcher(sequence_.start(),
831 *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize; 831 sequence_.length() / Assembler::kInstrSize));
832 if (!initialized) { 832 PredictableCodeSizeScope scope(patcher->masm(), sequence_.length());
833 // Since patcher is a large object, allocate it dynamically when needed, 833 patcher->masm()->PushFixedFrame(r1);
834 // to avoid overloading the stack in stress conditions. 834 patcher->masm()->nop(ip.code());
835 SmartPointer<CodePatcher> 835 patcher->masm()->add(
836 patcher(new CodePatcher(byte_sequence, kNoCodeAgeSequenceLength)); 836 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
837 PredictableCodeSizeScope scope(patcher->masm(), *length);
838 patcher->masm()->PushFixedFrame(r1);
839 patcher->masm()->nop(ip.code());
840 patcher->masm()->add(
841 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
842 initialized = true;
843 }
844 return byte_sequence;
845 } 837 }
846 838
847 839
848 bool Code::IsYoungSequence(byte* sequence) { 840 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) {
849 uint32_t young_length; 841 bool result = isolate->no_code_age_sequence()->Match(sequence);
850 byte* young_sequence = GetNoCodeAgeSequence(&young_length);
851 bool result = !memcmp(sequence, young_sequence, young_length);
852 ASSERT(result || 842 ASSERT(result ||
853 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); 843 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction);
854 return result; 844 return result;
855 } 845 }
856 846
857 847
858 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, 848 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age,
859 MarkingParity* parity) { 849 MarkingParity* parity) {
860 if (IsYoungSequence(sequence)) { 850 if (IsYoungSequence(isolate, sequence)) {
861 *age = kNoAgeCodeAge; 851 *age = kNoAgeCodeAge;
862 *parity = NO_MARKING_PARITY; 852 *parity = NO_MARKING_PARITY;
863 } else { 853 } else {
864 Address target_address = Memory::Address_at( 854 Address target_address = Memory::Address_at(
865 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); 855 sequence + (kNoCodeAgeSequenceLength - Assembler::kInstrSize));
866 Code* stub = GetCodeFromTargetAddress(target_address); 856 Code* stub = GetCodeFromTargetAddress(target_address);
867 GetCodeAgeAndParity(stub, age, parity); 857 GetCodeAgeAndParity(stub, age, parity);
868 } 858 }
869 } 859 }
870 860
871 861
872 void Code::PatchPlatformCodeAge(Isolate* isolate, 862 void Code::PatchPlatformCodeAge(Isolate* isolate,
873 byte* sequence, 863 byte* sequence,
874 Code::Age age, 864 Code::Age age,
875 MarkingParity parity) { 865 MarkingParity parity) {
876 uint32_t young_length; 866 uint32_t young_length = isolate->no_code_age_sequence()->length();
877 byte* young_sequence = GetNoCodeAgeSequence(&young_length);
878 if (age == kNoAgeCodeAge) { 867 if (age == kNoAgeCodeAge) {
879 CopyBytes(sequence, young_sequence, young_length); 868 isolate->no_code_age_sequence()->CopyTo(sequence);
880 CPU::FlushICache(sequence, young_length); 869 CPU::FlushICache(sequence, young_length);
881 } else { 870 } else {
882 Code* stub = GetCodeAgeStub(isolate, age, parity); 871 Code* stub = GetCodeAgeStub(isolate, age, parity);
883 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); 872 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
884 patcher.masm()->add(r0, pc, Operand(-8)); 873 patcher.masm()->add(r0, pc, Operand(-8));
885 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 874 patcher.masm()->ldr(pc, MemOperand(pc, -4));
886 patcher.masm()->emit_code_stub_address(stub); 875 patcher.masm()->emit_code_stub_address(stub);
887 } 876 }
888 } 877 }
889 878
890 879
891 } } // namespace v8::internal 880 } } // namespace v8::internal
892 881
893 #endif // V8_TARGET_ARCH_ARM 882 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/deoptimizer-arm.cc » ('j') | src/arm/simulator-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698