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 5629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5640 __ Tbnz(result, SharedFunctionInfo::kNative, &done); | 5640 __ Tbnz(result, SharedFunctionInfo::kNative, &done); |
5641 } | 5641 } |
5642 | 5642 |
5643 // Normal function. Replace undefined or null with global receiver. | 5643 // Normal function. Replace undefined or null with global receiver. |
5644 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, &global_object); | 5644 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, &global_object); |
5645 __ JumpIfRoot(receiver, Heap::kUndefinedValueRootIndex, &global_object); | 5645 __ JumpIfRoot(receiver, Heap::kUndefinedValueRootIndex, &global_object); |
5646 | 5646 |
5647 // Deoptimize if the receiver is not a JS object. | 5647 // Deoptimize if the receiver is not a JS object. |
5648 __ JumpIfSmi(receiver, &deopt); | 5648 __ JumpIfSmi(receiver, &deopt); |
5649 __ CompareObjectType(receiver, result, result, FIRST_SPEC_OBJECT_TYPE); | 5649 __ CompareObjectType(receiver, result, result, FIRST_SPEC_OBJECT_TYPE); |
| 5650 __ Mov(result, receiver); |
5650 __ B(ge, &done); | 5651 __ B(ge, &done); |
5651 // Otherwise, fall through to deopt. | 5652 // Otherwise, fall through to deopt. |
5652 | 5653 |
5653 __ Bind(&deopt); | 5654 __ Bind(&deopt); |
5654 Deoptimize(instr->environment()); | 5655 Deoptimize(instr->environment()); |
5655 | 5656 |
5656 __ Bind(&global_object); | 5657 __ Bind(&global_object); |
5657 // We could load directly into the result register here, but the additional | 5658 __ Ldr(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
5658 // branches required are likely to be more time consuming than one additional | 5659 __ Ldr(result, ContextMemOperand(result, Context::GLOBAL_OBJECT_INDEX)); |
5659 // move. | 5660 __ Ldr(result, FieldMemOperand(result, GlobalObject::kGlobalReceiverOffset)); |
5660 __ Ldr(receiver, FieldMemOperand(function, JSFunction::kContextOffset)); | |
5661 __ Ldr(receiver, ContextMemOperand(receiver, Context::GLOBAL_OBJECT_INDEX)); | |
5662 __ Ldr(receiver, | |
5663 FieldMemOperand(receiver, GlobalObject::kGlobalReceiverOffset)); | |
5664 | 5661 |
5665 __ Bind(&done); | 5662 __ Bind(&done); |
5666 __ Mov(result, receiver); | |
5667 } | 5663 } |
5668 | 5664 |
5669 | 5665 |
5670 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5666 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
5671 Register object = ToRegister(instr->object()); | 5667 Register object = ToRegister(instr->object()); |
5672 Register index = ToRegister(instr->index()); | 5668 Register index = ToRegister(instr->index()); |
5673 Register result = ToRegister(instr->result()); | 5669 Register result = ToRegister(instr->result()); |
5674 | 5670 |
5675 __ AssertSmi(index); | 5671 __ AssertSmi(index); |
5676 | 5672 |
(...skipping 10 matching lines...) Expand all Loading... |
5687 __ Bind(&out_of_object); | 5683 __ Bind(&out_of_object); |
5688 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5684 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5689 // Index is equal to negated out of object property index plus 1. | 5685 // Index is equal to negated out of object property index plus 1. |
5690 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5686 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5691 __ Ldr(result, FieldMemOperand(result, | 5687 __ Ldr(result, FieldMemOperand(result, |
5692 FixedArray::kHeaderSize - kPointerSize)); | 5688 FixedArray::kHeaderSize - kPointerSize)); |
5693 __ Bind(&done); | 5689 __ Bind(&done); |
5694 } | 5690 } |
5695 | 5691 |
5696 } } // namespace v8::internal | 5692 } } // namespace v8::internal |
OLD | NEW |