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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (strlen(FLAG_stop_at) > 0 && | 128 if (strlen(FLAG_stop_at) > 0 && |
129 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 129 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
130 __ stop("stop-at"); | 130 __ stop("stop-at"); |
131 } | 131 } |
132 #endif | 132 #endif |
133 | 133 |
134 // Sloppy mode functions and builtins need to replace the receiver with the | 134 // Sloppy mode functions and builtins need to replace the receiver with the |
135 // global proxy when called as functions (without an explicit receiver | 135 // global proxy when called as functions (without an explicit receiver |
136 // object). | 136 // object). |
137 if (is_sloppy(info->language_mode()) && !info->is_native() && | 137 if (is_sloppy(info->language_mode()) && !info->is_native() && |
138 info->MayUseThis()) { | 138 info->MayUseThis() && info->scope()->has_this_declaration()) { |
139 Label ok; | 139 Label ok; |
140 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 140 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
141 __ ld(at, MemOperand(sp, receiver_offset)); | 141 __ ld(at, MemOperand(sp, receiver_offset)); |
142 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 142 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
143 __ Branch(&ok, ne, a2, Operand(at)); | 143 __ Branch(&ok, ne, a2, Operand(at)); |
144 | 144 |
145 __ ld(a2, GlobalObjectOperand()); | 145 __ ld(a2, GlobalObjectOperand()); |
146 __ ld(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); | 146 __ ld(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); |
147 | 147 |
148 __ sd(a2, MemOperand(sp, receiver_offset)); | 148 __ sd(a2, MemOperand(sp, receiver_offset)); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 __ push(a1); | 215 __ push(a1); |
216 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 216 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
217 } | 217 } |
218 function_in_register = false; | 218 function_in_register = false; |
219 // Context is returned in v0. It replaces the context passed to us. | 219 // Context is returned in v0. It replaces the context passed to us. |
220 // It's saved in the stack and kept live in cp. | 220 // It's saved in the stack and kept live in cp. |
221 __ mov(cp, v0); | 221 __ mov(cp, v0); |
222 __ sd(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 222 __ sd(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
223 // Copy any necessary parameters into the context. | 223 // Copy any necessary parameters into the context. |
224 int num_parameters = info->scope()->num_parameters(); | 224 int num_parameters = info->scope()->num_parameters(); |
225 for (int i = 0; i < num_parameters; i++) { | 225 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; |
226 Variable* var = scope()->parameter(i); | 226 for (int i = first_parameter; i < num_parameters; i++) { |
| 227 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
227 if (var->IsContextSlot()) { | 228 if (var->IsContextSlot()) { |
228 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 229 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
229 (num_parameters - 1 - i) * kPointerSize; | 230 (num_parameters - 1 - i) * kPointerSize; |
230 // Load parameter from stack. | 231 // Load parameter from stack. |
231 __ ld(a0, MemOperand(fp, parameter_offset)); | 232 __ ld(a0, MemOperand(fp, parameter_offset)); |
232 // Store it in the context. | 233 // Store it in the context. |
233 MemOperand target = ContextOperand(cp, var->index()); | 234 MemOperand target = ContextOperand(cp, var->index()); |
234 __ sd(a0, target); | 235 __ sd(a0, target); |
235 | 236 |
236 // Update the write barrier. | 237 // Update the write barrier. |
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 if (arg_count > 0) { | 3012 if (arg_count > 0) { |
3012 __ ld(a7, MemOperand(sp, arg_count * kPointerSize)); | 3013 __ ld(a7, MemOperand(sp, arg_count * kPointerSize)); |
3013 } else { | 3014 } else { |
3014 __ LoadRoot(a7, Heap::kUndefinedValueRootIndex); | 3015 __ LoadRoot(a7, Heap::kUndefinedValueRootIndex); |
3015 } | 3016 } |
3016 | 3017 |
3017 // a6: the receiver of the enclosing function. | 3018 // a6: the receiver of the enclosing function. |
3018 __ ld(a6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 3019 __ ld(a6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
3019 | 3020 |
3020 // a5: the receiver of the enclosing function. | 3021 // a5: the receiver of the enclosing function. |
3021 int receiver_offset = 2 + info_->scope()->num_parameters(); | 3022 Variable* this_var = scope()->LookupThis(); |
3022 __ ld(a5, MemOperand(fp, receiver_offset * kPointerSize)); | 3023 DCHECK_NOT_NULL(this_var); |
| 3024 __ ld(a5, VarOperand(this_var, a5)); |
3023 | 3025 |
3024 // a4: the language mode. | 3026 // a4: the language mode. |
3025 __ li(a4, Operand(Smi::FromInt(language_mode()))); | 3027 __ li(a4, Operand(Smi::FromInt(language_mode()))); |
3026 | 3028 |
3027 // a1: the start position of the scope the calls resides in. | 3029 // a1: the start position of the scope the calls resides in. |
3028 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); | 3030 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); |
3029 | 3031 |
3030 // Do the runtime call. | 3032 // Do the runtime call. |
3031 __ Push(a7); | 3033 __ Push(a7); |
3032 __ Push(a6, a5, a4, a1); | 3034 __ Push(a6, a5, a4, a1); |
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5428 Assembler::target_address_at(pc_immediate_load_address)) == | 5430 Assembler::target_address_at(pc_immediate_load_address)) == |
5429 reinterpret_cast<uint64_t>( | 5431 reinterpret_cast<uint64_t>( |
5430 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5432 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5431 return OSR_AFTER_STACK_CHECK; | 5433 return OSR_AFTER_STACK_CHECK; |
5432 } | 5434 } |
5433 | 5435 |
5434 | 5436 |
5435 } } // namespace v8::internal | 5437 } } // namespace v8::internal |
5436 | 5438 |
5437 #endif // V8_TARGET_ARCH_MIPS64 | 5439 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |