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

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

Issue 261953002: Fix for 3303 MultithreadedParallelIsolates has a race condition. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed ICache arm simulator issue. 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
« no previous file with comments | « src/codegen.h ('k') | src/isolate.h » ('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 #include "v8.h" 5 #include "v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "codegen.h" 9 #include "codegen.h"
10 #include "heap.h" 10 #include "heap.h"
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 __ movsd(double_scratch, Operand::StaticArray( 1043 __ movsd(double_scratch, Operand::StaticArray(
1044 temp2, times_8, ExternalReference::math_exp_log_table())); 1044 temp2, times_8, ExternalReference::math_exp_log_table()));
1045 __ orps(input, double_scratch); 1045 __ orps(input, double_scratch);
1046 __ mulsd(result, input); 1046 __ mulsd(result, input);
1047 __ bind(&done); 1047 __ bind(&done);
1048 } 1048 }
1049 1049
1050 #undef __ 1050 #undef __
1051 1051
1052 1052
1053 static byte* GetNoCodeAgeSequence(uint32_t* length) { 1053 CodeAgingHelper::CodeAgingHelper() {
1054 static bool initialized = false; 1054 ASSERT(young_sequence_.length() == kNoCodeAgeSequenceLength);
1055 static byte sequence[kNoCodeAgeSequenceLength]; 1055 CodePatcher patcher(young_sequence_.start(), young_sequence_.length());
1056 *length = kNoCodeAgeSequenceLength; 1056 patcher.masm()->push(ebp);
1057 if (!initialized) { 1057 patcher.masm()->mov(ebp, esp);
1058 // The sequence of instructions that is patched out for aging code is the 1058 patcher.masm()->push(esi);
1059 // following boilerplate stack-building prologue that is found both in 1059 patcher.masm()->push(edi);
1060 // FUNCTION and OPTIMIZED_FUNCTION code:
1061 CodePatcher patcher(sequence, kNoCodeAgeSequenceLength);
1062 patcher.masm()->push(ebp);
1063 patcher.masm()->mov(ebp, esp);
1064 patcher.masm()->push(esi);
1065 patcher.masm()->push(edi);
1066 initialized = true;
1067 }
1068 return sequence;
1069 } 1060 }
1070 1061
1071 1062
1072 bool Code::IsYoungSequence(byte* sequence) { 1063 #ifdef DEBUG
1073 uint32_t young_length; 1064 bool CodeAgingHelper::IsOld(byte* candidate) const {
1074 byte* young_sequence = GetNoCodeAgeSequence(&young_length); 1065 return *candidate == kCallOpcode;
1075 bool result = (!memcmp(sequence, young_sequence, young_length)); 1066 }
1076 ASSERT(result || *sequence == kCallOpcode); 1067 #endif
1068
1069
1070 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) {
1071 bool result = isolate->code_aging_helper()->IsYoung(sequence);
1072 ASSERT(result || isolate->code_aging_helper()->IsOld(sequence));
1077 return result; 1073 return result;
1078 } 1074 }
1079 1075
1080 1076
1081 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, 1077 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age,
1082 MarkingParity* parity) { 1078 MarkingParity* parity) {
1083 if (IsYoungSequence(sequence)) { 1079 if (IsYoungSequence(isolate, sequence)) {
1084 *age = kNoAgeCodeAge; 1080 *age = kNoAgeCodeAge;
1085 *parity = NO_MARKING_PARITY; 1081 *parity = NO_MARKING_PARITY;
1086 } else { 1082 } else {
1087 sequence++; // Skip the kCallOpcode byte 1083 sequence++; // Skip the kCallOpcode byte
1088 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + 1084 Address target_address = sequence + *reinterpret_cast<int*>(sequence) +
1089 Assembler::kCallTargetAddressOffset; 1085 Assembler::kCallTargetAddressOffset;
1090 Code* stub = GetCodeFromTargetAddress(target_address); 1086 Code* stub = GetCodeFromTargetAddress(target_address);
1091 GetCodeAgeAndParity(stub, age, parity); 1087 GetCodeAgeAndParity(stub, age, parity);
1092 } 1088 }
1093 } 1089 }
1094 1090
1095 1091
1096 void Code::PatchPlatformCodeAge(Isolate* isolate, 1092 void Code::PatchPlatformCodeAge(Isolate* isolate,
1097 byte* sequence, 1093 byte* sequence,
1098 Code::Age age, 1094 Code::Age age,
1099 MarkingParity parity) { 1095 MarkingParity parity) {
1100 uint32_t young_length; 1096 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length();
1101 byte* young_sequence = GetNoCodeAgeSequence(&young_length);
1102 if (age == kNoAgeCodeAge) { 1097 if (age == kNoAgeCodeAge) {
1103 CopyBytes(sequence, young_sequence, young_length); 1098 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence);
1104 CPU::FlushICache(sequence, young_length); 1099 CPU::FlushICache(sequence, young_length);
1105 } else { 1100 } else {
1106 Code* stub = GetCodeAgeStub(isolate, age, parity); 1101 Code* stub = GetCodeAgeStub(isolate, age, parity);
1107 CodePatcher patcher(sequence, young_length); 1102 CodePatcher patcher(sequence, young_length);
1108 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); 1103 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32);
1109 } 1104 }
1110 } 1105 }
1111 1106
1112 1107
1113 } } // namespace v8::internal 1108 } } // namespace v8::internal
1114 1109
1115 #endif // V8_TARGET_ARCH_IA32 1110 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/codegen.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698