OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 #endif | 134 #endif |
135 | 135 |
136 // a1: Callee's JS function. | 136 // a1: Callee's JS function. |
137 // cp: Callee's context. | 137 // cp: Callee's context. |
138 // fp: Caller's frame pointer. | 138 // fp: Caller's frame pointer. |
139 // lr: Caller's pc. | 139 // lr: Caller's pc. |
140 | 140 |
141 // Sloppy mode functions and builtins need to replace the receiver with the | 141 // Sloppy mode functions and builtins need to replace the receiver with the |
142 // global proxy when called as functions (without an explicit receiver | 142 // global proxy when called as functions (without an explicit receiver |
143 // object). | 143 // object). |
144 if (is_sloppy(info()->language_mode()) && info()->MayUseThis() && | 144 if (info()->MustReplaceUndefinedReceiverWithGlobalProxy()) { |
145 !info()->is_native() && info()->scope()->has_this_declaration()) { | |
146 Label ok; | 145 Label ok; |
147 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; | 146 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; |
148 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 147 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
149 __ lw(a2, MemOperand(sp, receiver_offset)); | 148 __ lw(a2, MemOperand(sp, receiver_offset)); |
150 __ Branch(&ok, ne, a2, Operand(at)); | 149 __ Branch(&ok, ne, a2, Operand(at)); |
151 | 150 |
152 __ lw(a2, GlobalObjectOperand()); | 151 __ lw(a2, GlobalObjectOperand()); |
153 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); | 152 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); |
154 | 153 |
155 __ sw(a2, MemOperand(sp, receiver_offset)); | 154 __ sw(a2, MemOperand(sp, receiver_offset)); |
(...skipping 5771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5927 __ Push(at, ToRegister(instr->function())); | 5926 __ Push(at, ToRegister(instr->function())); |
5928 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5927 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5929 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5928 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5930 } | 5929 } |
5931 | 5930 |
5932 | 5931 |
5933 #undef __ | 5932 #undef __ |
5934 | 5933 |
5935 } // namespace internal | 5934 } // namespace internal |
5936 } // namespace v8 | 5935 } // namespace v8 |
OLD | NEW |