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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 240193002: Serializer enable/disable flags need thread safety. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 8 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
« src/arm/assembler-arm.cc ('K') | « src/x64/assembler-x64.cc ('k') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 reinterpret_cast<Address>(isolate()->heap()->roots_array_start()); 67 reinterpret_cast<Address>(isolate()->heap()->roots_array_start());
68 intptr_t delta = other.address() - roots_register_value; 68 intptr_t delta = other.address() - roots_register_value;
69 return delta; 69 return delta;
70 } 70 }
71 71
72 72
73 Operand MacroAssembler::ExternalOperand(ExternalReference target, 73 Operand MacroAssembler::ExternalOperand(ExternalReference target,
74 Register scratch) { 74 Register scratch) {
75 if (root_array_available_ && !Serializer::enabled()) { 75 if (root_array_available_ && !Serializer::enabled()) {
76 intptr_t delta = RootRegisterDelta(target); 76 intptr_t delta = RootRegisterDelta(target);
77 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { 77 if (delta != kInvalidRootRegisterDelta && is_int32(delta) &&
78 Serializer::TooLateToEnableNow(); 78 Serializer::TrySetPermanentlyDisabled()) {
79 return Operand(kRootRegister, static_cast<int32_t>(delta)); 79 return Operand(kRootRegister, static_cast<int32_t>(delta));
80 } 80 }
81 } 81 }
82 Move(scratch, target); 82 Move(scratch, target);
83 return Operand(scratch, 0); 83 return Operand(scratch, 0);
84 } 84 }
85 85
86 86
87 void MacroAssembler::Load(Register destination, ExternalReference source) { 87 void MacroAssembler::Load(Register destination, ExternalReference source) {
88 if (root_array_available_ && !Serializer::enabled()) { 88 if (root_array_available_ && !Serializer::enabled()) {
89 intptr_t delta = RootRegisterDelta(source); 89 intptr_t delta = RootRegisterDelta(source);
90 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { 90 if (delta != kInvalidRootRegisterDelta && is_int32(delta) &&
91 Serializer::TooLateToEnableNow(); 91 Serializer::TrySetPermanentlyDisabled()) {
92 movp(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); 92 movp(destination, Operand(kRootRegister, static_cast<int32_t>(delta)));
93 return; 93 return;
94 } 94 }
95 } 95 }
96 // Safe code. 96 // Safe code.
97 if (destination.is(rax)) { 97 if (destination.is(rax)) {
98 load_rax(source); 98 load_rax(source);
99 } else { 99 } else {
100 Move(kScratchRegister, source); 100 Move(kScratchRegister, source);
101 movp(destination, Operand(kScratchRegister, 0)); 101 movp(destination, Operand(kScratchRegister, 0));
102 } 102 }
103 } 103 }
104 104
105 105
106 void MacroAssembler::Store(ExternalReference destination, Register source) { 106 void MacroAssembler::Store(ExternalReference destination, Register source) {
107 if (root_array_available_ && !Serializer::enabled()) { 107 if (root_array_available_ && !Serializer::enabled()) {
108 intptr_t delta = RootRegisterDelta(destination); 108 intptr_t delta = RootRegisterDelta(destination);
109 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { 109 if (delta != kInvalidRootRegisterDelta && is_int32(delta) &&
110 Serializer::TooLateToEnableNow(); 110 Serializer::TrySetPermanentlyDisabled()) {
111 movp(Operand(kRootRegister, static_cast<int32_t>(delta)), source); 111 movp(Operand(kRootRegister, static_cast<int32_t>(delta)), source);
112 return; 112 return;
113 } 113 }
114 } 114 }
115 // Safe code. 115 // Safe code.
116 if (source.is(rax)) { 116 if (source.is(rax)) {
117 store_rax(destination); 117 store_rax(destination);
118 } else { 118 } else {
119 Move(kScratchRegister, destination); 119 Move(kScratchRegister, destination);
120 movp(Operand(kScratchRegister, 0), source); 120 movp(Operand(kScratchRegister, 0), source);
121 } 121 }
122 } 122 }
123 123
124 124
125 void MacroAssembler::LoadAddress(Register destination, 125 void MacroAssembler::LoadAddress(Register destination,
126 ExternalReference source) { 126 ExternalReference source) {
127 if (root_array_available_ && !Serializer::enabled()) { 127 if (root_array_available_ && !Serializer::enabled()) {
128 intptr_t delta = RootRegisterDelta(source); 128 intptr_t delta = RootRegisterDelta(source);
129 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { 129 if (delta != kInvalidRootRegisterDelta && is_int32(delta) &&
130 Serializer::TooLateToEnableNow(); 130 Serializer::TrySetPermanentlyDisabled()) {
131 leap(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); 131 leap(destination, Operand(kRootRegister, static_cast<int32_t>(delta)));
132 return; 132 return;
133 } 133 }
134 } 134 }
135 // Safe code. 135 // Safe code.
136 Move(destination, source); 136 Move(destination, source);
137 } 137 }
138 138
139 139
140 int MacroAssembler::LoadAddressSize(ExternalReference source) { 140 int MacroAssembler::LoadAddressSize(ExternalReference source) {
141 if (root_array_available_ && !Serializer::enabled()) { 141 if (root_array_available_ && !Serializer::enabled()) {
142 // This calculation depends on the internals of LoadAddress. 142 // This calculation depends on the internals of LoadAddress.
143 // It's correctness is ensured by the asserts in the Call 143 // It's correctness is ensured by the asserts in the Call
144 // instruction below. 144 // instruction below.
145 intptr_t delta = RootRegisterDelta(source); 145 intptr_t delta = RootRegisterDelta(source);
146 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { 146 if (delta != kInvalidRootRegisterDelta && is_int32(delta) &&
147 Serializer::TooLateToEnableNow(); 147 Serializer::TrySetPermanentlyDisabled()) {
148 // Operand is leap(scratch, Operand(kRootRegister, delta)); 148 // Operand is leap(scratch, Operand(kRootRegister, delta));
149 // Opcodes : REX.W 8D ModRM Disp8/Disp32 - 4 or 7. 149 // Opcodes : REX.W 8D ModRM Disp8/Disp32 - 4 or 7.
150 int size = 4; 150 int size = 4;
151 if (!is_int8(static_cast<int32_t>(delta))) { 151 if (!is_int8(static_cast<int32_t>(delta))) {
152 size += 3; // Need full four-byte displacement in lea. 152 size += 3; // Need full four-byte displacement in lea.
153 } 153 }
154 return size; 154 return size;
155 } 155 }
156 } 156 }
157 // Size of movp(destination, src); 157 // Size of movp(destination, src);
(...skipping 4997 matching lines...) Expand 10 before | Expand all | Expand 10 after
5155 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); 5155 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift()));
5156 movl(rax, dividend); 5156 movl(rax, dividend);
5157 shrl(rax, Immediate(31)); 5157 shrl(rax, Immediate(31));
5158 addl(rdx, rax); 5158 addl(rdx, rax);
5159 } 5159 }
5160 5160
5161 5161
5162 } } // namespace v8::internal 5162 } } // namespace v8::internal
5163 5163
5164 #endif // V8_TARGET_ARCH_X64 5164 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/arm/assembler-arm.cc ('K') | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698