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

Side by Side Diff: src/ic/arm64/handler-compiler-arm64.cc

Issue 877343003: Fix register aliasing after r26306, r26275. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Assertions Created 5 years, 10 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/ic/call-optimization.h" 9 #include "src/ic/call-optimization.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 __ Mov(api_function_address, ref); 214 __ Mov(api_function_address, ref);
215 215
216 // Jump to stub. 216 // Jump to stub.
217 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); 217 CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
218 __ TailCallStub(&stub); 218 __ TailCallStub(&stub);
219 } 219 }
220 220
221 221
222 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( 222 void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
223 MacroAssembler* masm, Handle<HeapType> type, Register receiver, 223 MacroAssembler* masm, Handle<HeapType> type, Register receiver,
224 Register holder, int accessor_index, int expected_arguments) { 224 Register holder, int accessor_index, int expected_arguments,
225 Register scratch) {
225 // ----------- S t a t e ------------- 226 // ----------- S t a t e -------------
226 // -- lr : return address 227 // -- lr : return address
227 // ----------------------------------- 228 // -----------------------------------
228 Label miss; 229 Label miss;
229
230 { 230 {
231 FrameScope scope(masm, StackFrame::INTERNAL); 231 FrameScope scope(masm, StackFrame::INTERNAL);
232 232
233 // Save value register, so we can restore it later. 233 // Save value register, so we can restore it later.
234 __ Push(value()); 234 __ Push(value());
235 235
236 if (accessor_index >= 0) { 236 if (accessor_index >= 0) {
237 DCHECK(!AreAliased(holder, scratch));
238 DCHECK(!AreAliased(receiver, scratch));
239 DCHECK(!AreAliased(value(), scratch));
237 // Call the JavaScript setter with receiver and value on the stack. 240 // Call the JavaScript setter with receiver and value on the stack.
238 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { 241 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
239 // Swap in the global receiver. 242 // Swap in the global receiver.
240 __ Ldr(receiver, 243 // Do overwrite receiver register, it can alias to holder register.
244 __ Ldr(scratch,
241 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); 245 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
246 receiver = scratch;
242 } 247 }
243 __ Push(receiver, value()); 248 __ Push(receiver, value());
244 ParameterCount actual(1); 249 ParameterCount actual(1);
245 ParameterCount expected(expected_arguments); 250 ParameterCount expected(expected_arguments);
246 __ LoadAccessor(x1, holder, accessor_index, ACCESSOR_SETTER); 251 __ LoadAccessor(x1, holder, accessor_index, ACCESSOR_SETTER);
247 __ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper()); 252 __ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper());
248 } else { 253 } else {
249 // If we generate a global code snippet for deoptimization only, remember 254 // If we generate a global code snippet for deoptimization only, remember
250 // the place to continue after deoptimization. 255 // the place to continue after deoptimization.
251 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); 256 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset());
252 } 257 }
253 258
254 // We have to return the passed value, not the return value of the setter. 259 // We have to return the passed value, not the return value of the setter.
255 __ Pop(x0); 260 __ Pop(x0);
256 261
257 // Restore context register. 262 // Restore context register.
258 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 263 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
259 } 264 }
260 __ Ret(); 265 __ Ret();
261 } 266 }
262 267
263 268
264 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( 269 void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
265 MacroAssembler* masm, Handle<HeapType> type, Register receiver, 270 MacroAssembler* masm, Handle<HeapType> type, Register receiver,
266 Register holder, int accessor_index, int expected_arguments) { 271 Register holder, int accessor_index, int expected_arguments,
272 Register scratch) {
267 { 273 {
268 FrameScope scope(masm, StackFrame::INTERNAL); 274 FrameScope scope(masm, StackFrame::INTERNAL);
269 275
270 if (accessor_index >= 0) { 276 if (accessor_index >= 0) {
277 DCHECK(!AreAliased(holder, scratch));
278 DCHECK(!AreAliased(receiver, scratch));
271 // Call the JavaScript getter with the receiver on the stack. 279 // Call the JavaScript getter with the receiver on the stack.
272 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { 280 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
273 // Swap in the global receiver. 281 // Swap in the global receiver.
274 __ Ldr(receiver, 282 // Do not overwrite receiver register, it can alias to holder register.
283 __ Ldr(scratch,
275 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); 284 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
285 receiver = scratch;
276 } 286 }
277 __ Push(receiver); 287 __ Push(receiver);
278 ParameterCount actual(0); 288 ParameterCount actual(0);
279 ParameterCount expected(expected_arguments); 289 ParameterCount expected(expected_arguments);
280 __ LoadAccessor(x1, holder, accessor_index, ACCESSOR_GETTER); 290 __ LoadAccessor(x1, holder, accessor_index, ACCESSOR_GETTER);
281 __ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper()); 291 __ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper());
282 } else { 292 } else {
283 // If we generate a global code snippet for deoptimization only, remember 293 // If we generate a global code snippet for deoptimization only, remember
284 // the place to continue after deoptimization. 294 // the place to continue after deoptimization.
285 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); 295 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset());
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 // Return the generated code. 756 // Return the generated code.
747 return GetCode(kind(), Code::FAST, name); 757 return GetCode(kind(), Code::FAST, name);
748 } 758 }
749 759
750 760
751 #undef __ 761 #undef __
752 } 762 }
753 } // namespace v8::internal 763 } // namespace v8::internal
754 764
755 #endif // V8_TARGET_ARCH_IA32 765 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698