| OLD | NEW |
| 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 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // cp: Callee's context. | 112 // cp: Callee's context. |
| 113 // pp: Callee's constant pool pointer (if FLAG_enable_ool_constant_pool) | 113 // pp: Callee's constant pool pointer (if FLAG_enable_ool_constant_pool) |
| 114 // fp: Caller's frame pointer. | 114 // fp: Caller's frame pointer. |
| 115 // lr: Caller's pc. | 115 // lr: Caller's pc. |
| 116 // ip: Our own function entry (required by the prologue) | 116 // ip: Our own function entry (required by the prologue) |
| 117 | 117 |
| 118 // Sloppy mode functions and builtins need to replace the receiver with the | 118 // Sloppy mode functions and builtins need to replace the receiver with the |
| 119 // global proxy when called as functions (without an explicit receiver | 119 // global proxy when called as functions (without an explicit receiver |
| 120 // object). | 120 // object). |
| 121 if (info_->this_has_uses() && info_->strict_mode() == SLOPPY && | 121 if (info_->this_has_uses() && info_->strict_mode() == SLOPPY && |
| 122 !info_->is_native()) { | 122 !info_->is_native() && info_->scope()->has_this_declaration()) { |
| 123 Label ok; | 123 Label ok; |
| 124 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; | 124 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; |
| 125 __ LoadP(r5, MemOperand(sp, receiver_offset)); | 125 __ LoadP(r5, MemOperand(sp, receiver_offset)); |
| 126 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); | 126 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); |
| 127 __ bne(&ok); | 127 __ bne(&ok); |
| 128 | 128 |
| 129 __ LoadP(r5, GlobalObjectOperand()); | 129 __ LoadP(r5, GlobalObjectOperand()); |
| 130 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); | 130 __ LoadP(r5, FieldMemOperand(r5, GlobalObject::kGlobalProxyOffset)); |
| 131 | 131 |
| 132 __ StoreP(r5, MemOperand(sp, receiver_offset)); | 132 __ StoreP(r5, MemOperand(sp, receiver_offset)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 __ push(r4); | 191 __ push(r4); |
| 192 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 192 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 193 } | 193 } |
| 194 RecordSafepoint(Safepoint::kNoLazyDeopt); | 194 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 195 // Context is returned in both r3 and cp. It replaces the context | 195 // Context is returned in both r3 and cp. It replaces the context |
| 196 // passed to us. It's saved in the stack and kept live in cp. | 196 // passed to us. It's saved in the stack and kept live in cp. |
| 197 __ mr(cp, r3); | 197 __ mr(cp, r3); |
| 198 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 198 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 199 // Copy any necessary parameters into the context. | 199 // Copy any necessary parameters into the context. |
| 200 int num_parameters = scope()->num_parameters(); | 200 int num_parameters = scope()->num_parameters(); |
| 201 for (int i = 0; i < num_parameters; i++) { | 201 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
| 202 Variable* var = scope()->parameter(i); | 202 for (int i = first_parameter; i < num_parameters; i++) { |
| 203 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
| 203 if (var->IsContextSlot()) { | 204 if (var->IsContextSlot()) { |
| 204 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 205 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 205 (num_parameters - 1 - i) * kPointerSize; | 206 (num_parameters - 1 - i) * kPointerSize; |
| 206 // Load parameter from stack. | 207 // Load parameter from stack. |
| 207 __ LoadP(r3, MemOperand(fp, parameter_offset)); | 208 __ LoadP(r3, MemOperand(fp, parameter_offset)); |
| 208 // Store it in the context. | 209 // Store it in the context. |
| 209 MemOperand target = ContextOperand(cp, var->index()); | 210 MemOperand target = ContextOperand(cp, var->index()); |
| 210 __ StoreP(r3, target, r0); | 211 __ StoreP(r3, target, r0); |
| 211 // Update the write barrier. This clobbers r6 and r3. | 212 // Update the write barrier. This clobbers r6 and r3. |
| 212 if (need_write_barrier) { | 213 if (need_write_barrier) { |
| (...skipping 5914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6127 __ Push(scope_info); | 6128 __ Push(scope_info); |
| 6128 __ push(ToRegister(instr->function())); | 6129 __ push(ToRegister(instr->function())); |
| 6129 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6130 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6130 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6131 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6131 } | 6132 } |
| 6132 | 6133 |
| 6133 | 6134 |
| 6134 #undef __ | 6135 #undef __ |
| 6135 } | 6136 } |
| 6136 } // namespace v8::internal | 6137 } // namespace v8::internal |
| OLD | NEW |