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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #ifdef DEBUG | 103 #ifdef DEBUG |
104 if (strlen(FLAG_stop_at) > 0 && | 104 if (strlen(FLAG_stop_at) > 0 && |
105 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 105 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
106 __ int3(); | 106 __ int3(); |
107 } | 107 } |
108 #endif | 108 #endif |
109 | 109 |
110 // Sloppy mode functions and builtins need to replace the receiver with the | 110 // Sloppy mode functions and builtins need to replace the receiver with the |
111 // global proxy when called as functions (without an explicit receiver | 111 // global proxy when called as functions (without an explicit receiver |
112 // object). | 112 // object). |
113 if (is_sloppy(info()->language_mode()) && info()->MayUseThis() && | 113 if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && |
114 !info()->is_native() && info()->scope()->has_this_declaration()) { | 114 !info_->is_native()) { |
115 Label ok; | 115 Label ok; |
116 // +1 for return address. | 116 // +1 for return address. |
117 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 117 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
118 __ mov(ecx, Operand(esp, receiver_offset)); | 118 __ mov(ecx, Operand(esp, receiver_offset)); |
119 | 119 |
120 __ cmp(ecx, isolate()->factory()->undefined_value()); | 120 __ cmp(ecx, isolate()->factory()->undefined_value()); |
121 __ j(not_equal, &ok, Label::kNear); | 121 __ j(not_equal, &ok, Label::kNear); |
122 | 122 |
123 __ mov(ecx, GlobalObjectOperand()); | 123 __ mov(ecx, GlobalObjectOperand()); |
124 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset)); | 124 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalProxyOffset)); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 235 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
236 } | 236 } |
237 RecordSafepoint(Safepoint::kNoLazyDeopt); | 237 RecordSafepoint(Safepoint::kNoLazyDeopt); |
238 // Context is returned in eax. It replaces the context passed to us. | 238 // Context is returned in eax. It replaces the context passed to us. |
239 // It's saved in the stack and kept live in esi. | 239 // It's saved in the stack and kept live in esi. |
240 __ mov(esi, eax); | 240 __ mov(esi, eax); |
241 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); | 241 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
242 | 242 |
243 // Copy parameters into context if necessary. | 243 // Copy parameters into context if necessary. |
244 int num_parameters = scope()->num_parameters(); | 244 int num_parameters = scope()->num_parameters(); |
245 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 245 for (int i = 0; i < num_parameters; i++) { |
246 for (int i = first_parameter; i < num_parameters; i++) { | 246 Variable* var = scope()->parameter(i); |
247 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | |
248 if (var->IsContextSlot()) { | 247 if (var->IsContextSlot()) { |
249 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 248 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
250 (num_parameters - 1 - i) * kPointerSize; | 249 (num_parameters - 1 - i) * kPointerSize; |
251 // Load parameter from stack. | 250 // Load parameter from stack. |
252 __ mov(eax, Operand(ebp, parameter_offset)); | 251 __ mov(eax, Operand(ebp, parameter_offset)); |
253 // Store it in the context. | 252 // Store it in the context. |
254 int context_offset = Context::SlotOffset(var->index()); | 253 int context_offset = Context::SlotOffset(var->index()); |
255 __ mov(Operand(esi, context_offset), eax); | 254 __ mov(Operand(esi, context_offset), eax); |
256 // Update the write barrier. This clobbers eax and ebx. | 255 // Update the write barrier. This clobbers eax and ebx. |
257 if (need_write_barrier) { | 256 if (need_write_barrier) { |
(...skipping 6217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6475 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6474 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6476 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6475 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6477 } | 6476 } |
6478 | 6477 |
6479 | 6478 |
6480 #undef __ | 6479 #undef __ |
6481 | 6480 |
6482 } } // namespace v8::internal | 6481 } } // namespace v8::internal |
6483 | 6482 |
6484 #endif // V8_TARGET_ARCH_X87 | 6483 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |