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

Side by Side Diff: src/arm64/lithium-codegen-arm64.cc

Issue 226363007: Fix result of LCodeGen::DoWrapReceiver for strict functions and builtins. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-362128.js » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5804 matching lines...) Expand 10 before | Expand all | Expand 10 after
5815 5815
5816 5816
5817 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { 5817 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
5818 Register receiver = ToRegister(instr->receiver()); 5818 Register receiver = ToRegister(instr->receiver());
5819 Register function = ToRegister(instr->function()); 5819 Register function = ToRegister(instr->function());
5820 Register result = ToRegister(instr->result()); 5820 Register result = ToRegister(instr->result());
5821 5821
5822 // If the receiver is null or undefined, we have to pass the global object as 5822 // If the receiver is null or undefined, we have to pass the global object as
5823 // a receiver to normal functions. Values have to be passed unchanged to 5823 // a receiver to normal functions. Values have to be passed unchanged to
5824 // builtins and strict-mode functions. 5824 // builtins and strict-mode functions.
5825 Label global_object, done; 5825 Label global_object, done, copy_receiver;
5826 5826
5827 if (!instr->hydrogen()->known_function()) { 5827 if (!instr->hydrogen()->known_function()) {
5828 __ Ldr(result, FieldMemOperand(function, 5828 __ Ldr(result, FieldMemOperand(function,
5829 JSFunction::kSharedFunctionInfoOffset)); 5829 JSFunction::kSharedFunctionInfoOffset));
5830 5830
5831 // CompilerHints is an int32 field. See objects.h. 5831 // CompilerHints is an int32 field. See objects.h.
5832 __ Ldr(result.W(), 5832 __ Ldr(result.W(),
5833 FieldMemOperand(result, SharedFunctionInfo::kCompilerHintsOffset)); 5833 FieldMemOperand(result, SharedFunctionInfo::kCompilerHintsOffset));
5834 5834
5835 // Do not transform the receiver to object for strict mode functions. 5835 // Do not transform the receiver to object for strict mode functions.
5836 __ Tbnz(result, SharedFunctionInfo::kStrictModeFunction, &done); 5836 __ Tbnz(result, SharedFunctionInfo::kStrictModeFunction, &copy_receiver);
5837 5837
5838 // Do not transform the receiver to object for builtins. 5838 // Do not transform the receiver to object for builtins.
5839 __ Tbnz(result, SharedFunctionInfo::kNative, &done); 5839 __ Tbnz(result, SharedFunctionInfo::kNative, &copy_receiver);
5840 } 5840 }
5841 5841
5842 // Normal function. Replace undefined or null with global receiver. 5842 // Normal function. Replace undefined or null with global receiver.
5843 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, &global_object); 5843 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, &global_object);
5844 __ JumpIfRoot(receiver, Heap::kUndefinedValueRootIndex, &global_object); 5844 __ JumpIfRoot(receiver, Heap::kUndefinedValueRootIndex, &global_object);
5845 5845
5846 // Deoptimize if the receiver is not a JS object. 5846 // Deoptimize if the receiver is not a JS object.
5847 DeoptimizeIfSmi(receiver, instr->environment()); 5847 DeoptimizeIfSmi(receiver, instr->environment());
5848 __ CompareObjectType(receiver, result, result, FIRST_SPEC_OBJECT_TYPE); 5848 __ CompareObjectType(receiver, result, result, FIRST_SPEC_OBJECT_TYPE);
5849 __ Mov(result, receiver); 5849 __ B(ge, &copy_receiver);
5850 __ B(ge, &done);
5851 Deoptimize(instr->environment()); 5850 Deoptimize(instr->environment());
5852 5851
5853 __ Bind(&global_object); 5852 __ Bind(&global_object);
5854 __ Ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); 5853 __ Ldr(result, FieldMemOperand(function, JSFunction::kContextOffset));
5855 __ Ldr(result, ContextMemOperand(result, Context::GLOBAL_OBJECT_INDEX)); 5854 __ Ldr(result, ContextMemOperand(result, Context::GLOBAL_OBJECT_INDEX));
5856 __ Ldr(result, FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); 5855 __ Ldr(result, FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset));
5856 __ B(&done);
5857 5857
5858 __ Bind(&copy_receiver);
5859 __ Mov(result, receiver);
5858 __ Bind(&done); 5860 __ Bind(&done);
5859 } 5861 }
5860 5862
5861 5863
5862 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr, 5864 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr,
5863 Register result, 5865 Register result,
5864 Register object, 5866 Register object,
5865 Register index) { 5867 Register index) {
5866 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 5868 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
5867 __ Push(object); 5869 __ Push(object);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
5927 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5929 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5928 // Index is equal to negated out of object property index plus 1. 5930 // Index is equal to negated out of object property index plus 1.
5929 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5931 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5930 __ Ldr(result, FieldMemOperand(result, 5932 __ Ldr(result, FieldMemOperand(result,
5931 FixedArray::kHeaderSize - kPointerSize)); 5933 FixedArray::kHeaderSize - kPointerSize));
5932 __ Bind(deferred->exit()); 5934 __ Bind(deferred->exit());
5933 __ Bind(&done); 5935 __ Bind(&done);
5934 } 5936 }
5935 5937
5936 } } // namespace v8::internal 5938 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-362128.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698