| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (strlen(FLAG_stop_at) > 0 && | 123 if (strlen(FLAG_stop_at) > 0 && |
| 124 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 124 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 125 __ int3(); | 125 __ int3(); |
| 126 } | 126 } |
| 127 #endif | 127 #endif |
| 128 | 128 |
| 129 // Sloppy mode functions need to replace the receiver with the global proxy | 129 // Sloppy mode functions need to replace the receiver with the global proxy |
| 130 // when called as functions (without an explicit receiver object). | 130 // when called as functions (without an explicit receiver object). |
| 131 if (info_->this_has_uses() && | 131 if (info_->this_has_uses() && |
| 132 info_->strict_mode() == SLOPPY && | 132 info_->strict_mode() == SLOPPY && |
| 133 !info_->is_native()) { | 133 !info_->is_native() && |
| 134 info_->scope()->has_this_declaration()) { |
| 134 Label ok; | 135 Label ok; |
| 135 StackArgumentsAccessor args(rsp, scope()->num_parameters()); | 136 StackArgumentsAccessor args(rsp, scope()->num_parameters()); |
| 136 __ movp(rcx, args.GetReceiverOperand()); | 137 __ movp(rcx, args.GetReceiverOperand()); |
| 137 | 138 |
| 138 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); | 139 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); |
| 139 __ j(not_equal, &ok, Label::kNear); | 140 __ j(not_equal, &ok, Label::kNear); |
| 140 | 141 |
| 141 __ movp(rcx, GlobalObjectOperand()); | 142 __ movp(rcx, GlobalObjectOperand()); |
| 142 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalProxyOffset)); | 143 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalProxyOffset)); |
| 143 | 144 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 206 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 206 } | 207 } |
| 207 RecordSafepoint(Safepoint::kNoLazyDeopt); | 208 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 208 // Context is returned in rax. It replaces the context passed to us. | 209 // Context is returned in rax. It replaces the context passed to us. |
| 209 // It's saved in the stack and kept live in rsi. | 210 // It's saved in the stack and kept live in rsi. |
| 210 __ movp(rsi, rax); | 211 __ movp(rsi, rax); |
| 211 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 212 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
| 212 | 213 |
| 213 // Copy any necessary parameters into the context. | 214 // Copy any necessary parameters into the context. |
| 214 int num_parameters = scope()->num_parameters(); | 215 int num_parameters = scope()->num_parameters(); |
| 215 for (int i = 0; i < num_parameters; i++) { | 216 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
| 216 Variable* var = scope()->parameter(i); | 217 for (int i = first_parameter; i < num_parameters; i++) { |
| 218 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
| 217 if (var->IsContextSlot()) { | 219 if (var->IsContextSlot()) { |
| 218 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 220 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 219 (num_parameters - 1 - i) * kPointerSize; | 221 (num_parameters - 1 - i) * kPointerSize; |
| 220 // Load parameter from stack. | 222 // Load parameter from stack. |
| 221 __ movp(rax, Operand(rbp, parameter_offset)); | 223 __ movp(rax, Operand(rbp, parameter_offset)); |
| 222 // Store it in the context. | 224 // Store it in the context. |
| 223 int context_offset = Context::SlotOffset(var->index()); | 225 int context_offset = Context::SlotOffset(var->index()); |
| 224 __ movp(Operand(rsi, context_offset), rax); | 226 __ movp(Operand(rsi, context_offset), rax); |
| 225 // Update the write barrier. This clobbers rax and rbx. | 227 // Update the write barrier. This clobbers rax and rbx. |
| 226 if (need_write_barrier) { | 228 if (need_write_barrier) { |
| (...skipping 5681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5908 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5910 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5909 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5911 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5910 } | 5912 } |
| 5911 | 5913 |
| 5912 | 5914 |
| 5913 #undef __ | 5915 #undef __ |
| 5914 | 5916 |
| 5915 } } // namespace v8::internal | 5917 } } // namespace v8::internal |
| 5916 | 5918 |
| 5917 #endif // V8_TARGET_ARCH_X64 | 5919 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |