| 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/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 202 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 203 } | 203 } |
| 204 function_in_register = false; | 204 function_in_register = false; |
| 205 // Context is returned in eax. It replaces the context passed to us. | 205 // Context is returned in eax. It replaces the context passed to us. |
| 206 // It's saved in the stack and kept live in esi. | 206 // It's saved in the stack and kept live in esi. |
| 207 __ mov(esi, eax); | 207 __ mov(esi, eax); |
| 208 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); | 208 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
| 209 | 209 |
| 210 // Copy parameters into context if necessary. | 210 // Copy parameters into context if necessary. |
| 211 int num_parameters = info->scope()->num_parameters(); | 211 int num_parameters = info->scope()->num_parameters(); |
| 212 for (int i = 0; i < num_parameters; i++) { | 212 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; |
| 213 Variable* var = scope()->parameter(i); | 213 for (int i = first_parameter; i < num_parameters; i++) { |
| 214 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
| 214 if (var->IsContextSlot()) { | 215 if (var->IsContextSlot()) { |
| 215 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 216 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 216 (num_parameters - 1 - i) * kPointerSize; | 217 (num_parameters - 1 - i) * kPointerSize; |
| 217 // Load parameter from stack. | 218 // Load parameter from stack. |
| 218 __ mov(eax, Operand(ebp, parameter_offset)); | 219 __ mov(eax, Operand(ebp, parameter_offset)); |
| 219 // Store it in the context. | 220 // Store it in the context. |
| 220 int context_offset = Context::SlotOffset(var->index()); | 221 int context_offset = Context::SlotOffset(var->index()); |
| 221 __ mov(Operand(esi, context_offset), eax); | 222 __ mov(Operand(esi, context_offset), eax); |
| 222 // Update the write barrier. This clobbers eax and ebx. | 223 // Update the write barrier. This clobbers eax and ebx. |
| 223 if (need_write_barrier) { | 224 if (need_write_barrier) { |
| (...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 // Push copy of the first argument or undefined if it doesn't exist. | 2983 // Push copy of the first argument or undefined if it doesn't exist. |
| 2983 if (arg_count > 0) { | 2984 if (arg_count > 0) { |
| 2984 __ push(Operand(esp, arg_count * kPointerSize)); | 2985 __ push(Operand(esp, arg_count * kPointerSize)); |
| 2985 } else { | 2986 } else { |
| 2986 __ push(Immediate(isolate()->factory()->undefined_value())); | 2987 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 2987 } | 2988 } |
| 2988 | 2989 |
| 2989 // Push the enclosing function. | 2990 // Push the enclosing function. |
| 2990 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 2991 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2991 // Push the receiver of the enclosing function. | 2992 // Push the receiver of the enclosing function. |
| 2992 __ push(Operand(ebp, (2 + info_->scope()->num_parameters()) * kPointerSize)); | 2993 Variable* this_var = scope()->LookupThis(); |
| 2994 DCHECK_NOT_NULL(this_var); |
| 2995 __ push(VarOperand(this_var, ecx)); |
| 2993 // Push the language mode. | 2996 // Push the language mode. |
| 2994 __ push(Immediate(Smi::FromInt(language_mode()))); | 2997 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 2995 | 2998 |
| 2996 // Push the start position of the scope the calls resides in. | 2999 // Push the start position of the scope the calls resides in. |
| 2997 __ push(Immediate(Smi::FromInt(scope()->start_position()))); | 3000 __ push(Immediate(Smi::FromInt(scope()->start_position()))); |
| 2998 | 3001 |
| 2999 // Do the runtime call. | 3002 // Do the runtime call. |
| 3000 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); | 3003 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
| 3001 } | 3004 } |
| 3002 | 3005 |
| (...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5399 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5402 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5400 Assembler::target_address_at(call_target_address, | 5403 Assembler::target_address_at(call_target_address, |
| 5401 unoptimized_code)); | 5404 unoptimized_code)); |
| 5402 return OSR_AFTER_STACK_CHECK; | 5405 return OSR_AFTER_STACK_CHECK; |
| 5403 } | 5406 } |
| 5404 | 5407 |
| 5405 | 5408 |
| 5406 } } // namespace v8::internal | 5409 } } // namespace v8::internal |
| 5407 | 5410 |
| 5408 #endif // V8_TARGET_ARCH_IA32 | 5411 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |