| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 135 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 136 __ int3(); | 136 __ int3(); |
| 137 } | 137 } |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 // Sloppy mode functions and builtins need to replace the receiver with the | 140 // Sloppy mode functions and builtins need to replace the receiver with the |
| 141 // global proxy when called as functions (without an explicit receiver | 141 // global proxy when called as functions (without an explicit receiver |
| 142 // object). | 142 // object). |
| 143 if (info_->this_has_uses() && | 143 if (info_->this_has_uses() && |
| 144 info_->strict_mode() == SLOPPY && | 144 info_->strict_mode() == SLOPPY && |
| 145 !info_->is_native()) { | 145 !info_->is_native() && |
| 146 info_->scope()->has_this_declaration()) { |
| 146 Label ok; | 147 Label ok; |
| 147 // +1 for return address. | 148 // +1 for return address. |
| 148 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 149 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
| 149 __ mov(ecx, Operand(esp, receiver_offset)); | 150 __ mov(ecx, Operand(esp, receiver_offset)); |
| 150 | 151 |
| 151 __ cmp(ecx, isolate()->factory()->undefined_value()); | 152 __ cmp(ecx, isolate()->factory()->undefined_value()); |
| 152 __ j(not_equal, &ok, Label::kNear); | 153 __ j(not_equal, &ok, Label::kNear); |
| 153 | 154 |
| 154 __ mov(ecx, GlobalObjectOperand()); | 155 __ mov(ecx, GlobalObjectOperand()); |
| 155 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset)); | 156 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 268 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 268 } | 269 } |
| 269 RecordSafepoint(Safepoint::kNoLazyDeopt); | 270 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 270 // Context is returned in eax. It replaces the context passed to us. | 271 // Context is returned in eax. It replaces the context passed to us. |
| 271 // It's saved in the stack and kept live in esi. | 272 // It's saved in the stack and kept live in esi. |
| 272 __ mov(esi, eax); | 273 __ mov(esi, eax); |
| 273 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); | 274 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
| 274 | 275 |
| 275 // Copy parameters into context if necessary. | 276 // Copy parameters into context if necessary. |
| 276 int num_parameters = scope()->num_parameters(); | 277 int num_parameters = scope()->num_parameters(); |
| 277 for (int i = 0; i < num_parameters; i++) { | 278 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
| 278 Variable* var = scope()->parameter(i); | 279 for (int i = first_parameter; i < num_parameters; i++) { |
| 280 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
| 279 if (var->IsContextSlot()) { | 281 if (var->IsContextSlot()) { |
| 280 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 282 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 281 (num_parameters - 1 - i) * kPointerSize; | 283 (num_parameters - 1 - i) * kPointerSize; |
| 282 // Load parameter from stack. | 284 // Load parameter from stack. |
| 283 __ mov(eax, Operand(ebp, parameter_offset)); | 285 __ mov(eax, Operand(ebp, parameter_offset)); |
| 284 // Store it in the context. | 286 // Store it in the context. |
| 285 int context_offset = Context::SlotOffset(var->index()); | 287 int context_offset = Context::SlotOffset(var->index()); |
| 286 __ mov(Operand(esi, context_offset), eax); | 288 __ mov(Operand(esi, context_offset), eax); |
| 287 // Update the write barrier. This clobbers eax and ebx. | 289 // Update the write barrier. This clobbers eax and ebx. |
| 288 if (need_write_barrier) { | 290 if (need_write_barrier) { |
| (...skipping 5483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5772 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5774 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5773 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5775 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5774 } | 5776 } |
| 5775 | 5777 |
| 5776 | 5778 |
| 5777 #undef __ | 5779 #undef __ |
| 5778 | 5780 |
| 5779 } } // namespace v8::internal | 5781 } } // namespace v8::internal |
| 5780 | 5782 |
| 5781 #endif // V8_TARGET_ARCH_IA32 | 5783 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |