OLD | NEW |
---|---|
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 Loading... | |
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, ©_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, ©_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 __ Mov(result, receiver); |
jbramley
2014/04/14 08:59:53
You can skip this move now, and do __ B(ge, ©_
ulan
2014/04/14 11:12:53
Done.
| |
5850 __ B(ge, &done); | 5850 __ B(ge, &done); |
5851 Deoptimize(instr->environment()); | 5851 Deoptimize(instr->environment()); |
5852 | 5852 |
5853 __ Bind(&global_object); | 5853 __ Bind(&global_object); |
5854 __ Ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 5854 __ Ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
5855 __ Ldr(result, ContextMemOperand(result, Context::GLOBAL_OBJECT_INDEX)); | 5855 __ Ldr(result, ContextMemOperand(result, Context::GLOBAL_OBJECT_INDEX)); |
5856 __ Ldr(result, FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); | 5856 __ Ldr(result, FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); |
5857 __ B(&done); | |
5857 | 5858 |
5859 __ Bind(©_receiver); | |
5860 __ Mov(result, receiver); | |
5858 __ Bind(&done); | 5861 __ Bind(&done); |
5859 } | 5862 } |
5860 | 5863 |
5861 | 5864 |
5862 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr, | 5865 void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr, |
5863 Register result, | 5866 Register result, |
5864 Register object, | 5867 Register object, |
5865 Register index) { | 5868 Register index) { |
5866 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 5869 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
5867 __ Push(object); | 5870 __ Push(object); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5927 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5930 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5928 // Index is equal to negated out of object property index plus 1. | 5931 // Index is equal to negated out of object property index plus 1. |
5929 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5932 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5930 __ Ldr(result, FieldMemOperand(result, | 5933 __ Ldr(result, FieldMemOperand(result, |
5931 FixedArray::kHeaderSize - kPointerSize)); | 5934 FixedArray::kHeaderSize - kPointerSize)); |
5932 __ Bind(deferred->exit()); | 5935 __ Bind(deferred->exit()); |
5933 __ Bind(&done); | 5936 __ Bind(&done); |
5934 } | 5937 } |
5935 | 5938 |
5936 } } // namespace v8::internal | 5939 } } // namespace v8::internal |
OLD | NEW |