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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } else if (FLAG_debug_code) { | 225 } else if (FLAG_debug_code) { |
226 Label done; | 226 Label done; |
227 __ JumpIfInNewSpace(rsi, rax, &done, Label::kNear); | 227 __ JumpIfInNewSpace(rsi, rax, &done, Label::kNear); |
228 __ Abort(kExpectedNewSpaceObject); | 228 __ Abort(kExpectedNewSpaceObject); |
229 __ bind(&done); | 229 __ bind(&done); |
230 } | 230 } |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
| 235 // Possibly allocate RestParameters |
| 236 int rest_index; |
| 237 Variable* rest_param = scope()->rest_parameter(&rest_index); |
| 238 if (rest_param) { |
| 239 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
| 240 |
| 241 int num_parameters = info->scope()->num_parameters(); |
| 242 int offset = num_parameters * kPointerSize; |
| 243 __ leap(rdx, |
| 244 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 245 __ Push(rdx); |
| 246 __ Push(Smi::FromInt(num_parameters)); |
| 247 __ Push(Smi::FromInt(rest_index)); |
| 248 |
| 249 RestParamAccessStub stub(isolate()); |
| 250 __ CallStub(&stub); |
| 251 |
| 252 SetVar(rest_param, rax, rbx, rdx); |
| 253 } |
| 254 |
235 // Possibly allocate an arguments object. | 255 // Possibly allocate an arguments object. |
236 Variable* arguments = scope()->arguments(); | 256 Variable* arguments = scope()->arguments(); |
237 if (arguments != NULL) { | 257 if (arguments != NULL) { |
238 // Arguments object must be allocated after the context object, in | 258 // Arguments object must be allocated after the context object, in |
239 // case the "arguments" or ".arguments" variables are in the context. | 259 // case the "arguments" or ".arguments" variables are in the context. |
240 Comment cmnt(masm_, "[ Allocate arguments object"); | 260 Comment cmnt(masm_, "[ Allocate arguments object"); |
241 if (function_in_register) { | 261 if (function_in_register) { |
242 __ Push(rdi); | 262 __ Push(rdi); |
243 } else { | 263 } else { |
244 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 264 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
245 } | 265 } |
246 // The receiver is just before the parameters on the caller's stack. | 266 // The receiver is just before the parameters on the caller's stack. |
247 int num_parameters = info->scope()->num_parameters(); | 267 int num_parameters = info->scope()->num_parameters(); |
248 int offset = num_parameters * kPointerSize; | 268 int offset = num_parameters * kPointerSize; |
249 __ leap(rdx, | 269 __ leap(rdx, |
250 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); | 270 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
251 __ Push(rdx); | 271 __ Push(rdx); |
252 __ Push(Smi::FromInt(num_parameters)); | 272 __ Push(Smi::FromInt(num_parameters)); |
253 // Arguments to ArgumentsAccessStub: | 273 // Arguments to ArgumentsAccessStub: |
254 // function, receiver address, parameter count. | 274 // function, receiver address, parameter count. |
255 // The stub will rewrite receiver and parameter count if the previous | 275 // The stub will rewrite receiver and parameter count if the previous |
256 // stack frame was an arguments adapter frame. | 276 // stack frame was an arguments adapter frame. |
257 ArgumentsAccessStub::Type type; | 277 ArgumentsAccessStub::Type type; |
258 if (is_strict(language_mode())) { | 278 if (is_strict(language_mode()) || !is_simple_parameter_list()) { |
259 type = ArgumentsAccessStub::NEW_STRICT; | 279 type = ArgumentsAccessStub::NEW_STRICT; |
260 } else if (function()->has_duplicate_parameters()) { | 280 } else if (function()->has_duplicate_parameters()) { |
261 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 281 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
262 } else { | 282 } else { |
263 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 283 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
264 } | 284 } |
265 ArgumentsAccessStub stub(isolate(), type); | 285 ArgumentsAccessStub stub(isolate(), type); |
266 __ CallStub(&stub); | 286 __ CallStub(&stub); |
267 | 287 |
268 SetVar(arguments, rax, rbx, rdx); | 288 SetVar(arguments, rax, rbx, rdx); |
(...skipping 5046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5315 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5335 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5316 Assembler::target_address_at(call_target_address, | 5336 Assembler::target_address_at(call_target_address, |
5317 unoptimized_code)); | 5337 unoptimized_code)); |
5318 return OSR_AFTER_STACK_CHECK; | 5338 return OSR_AFTER_STACK_CHECK; |
5319 } | 5339 } |
5320 | 5340 |
5321 | 5341 |
5322 } } // namespace v8::internal | 5342 } } // namespace v8::internal |
5323 | 5343 |
5324 #endif // V8_TARGET_ARCH_X64 | 5344 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |