OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } else if (FLAG_debug_code) { | 234 } else if (FLAG_debug_code) { |
235 Label done; | 235 Label done; |
236 __ JumpIfInNewSpace(cp, &done); | 236 __ JumpIfInNewSpace(cp, &done); |
237 __ Abort(kExpectedNewSpaceObject); | 237 __ Abort(kExpectedNewSpaceObject); |
238 __ bind(&done); | 238 __ bind(&done); |
239 } | 239 } |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
| 244 ArgumentsAccessStub::HasNewTarget has_new_target = |
| 245 IsSubclassConstructor(info->function()->kind()) |
| 246 ? ArgumentsAccessStub::HAS_NEW_TARGET |
| 247 : ArgumentsAccessStub::NO_NEW_TARGET; |
| 248 |
244 // Possibly allocate RestParameters | 249 // Possibly allocate RestParameters |
245 int rest_index; | 250 int rest_index; |
246 Variable* rest_param = scope()->rest_parameter(&rest_index); | 251 Variable* rest_param = scope()->rest_parameter(&rest_index); |
247 if (rest_param) { | 252 if (rest_param) { |
248 Comment cmnt(masm_, "[ Allocate rest parameter array"); | 253 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
249 | 254 |
250 int num_parameters = info->scope()->num_parameters(); | 255 int num_parameters = info->scope()->num_parameters(); |
251 int offset = num_parameters * kPointerSize; | 256 int offset = num_parameters * kPointerSize; |
| 257 if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) { |
| 258 --num_parameters; |
| 259 ++rest_index; |
| 260 } |
| 261 |
252 __ Add(x3, fp, StandardFrameConstants::kCallerSPOffset + offset); | 262 __ Add(x3, fp, StandardFrameConstants::kCallerSPOffset + offset); |
253 __ Mov(x2, Smi::FromInt(num_parameters)); | 263 __ Mov(x2, Smi::FromInt(num_parameters)); |
254 __ Mov(x1, Smi::FromInt(rest_index)); | 264 __ Mov(x1, Smi::FromInt(rest_index)); |
255 __ Push(x3, x2, x1); | 265 __ Push(x3, x2, x1); |
256 | 266 |
257 RestParamAccessStub stub(isolate()); | 267 RestParamAccessStub stub(isolate()); |
258 __ CallStub(&stub); | 268 __ CallStub(&stub); |
259 | 269 |
260 SetVar(rest_param, x0, x1, x2); | 270 SetVar(rest_param, x0, x1, x2); |
261 } | 271 } |
(...skipping 12 matching lines...) Expand all Loading... |
274 int num_parameters = info->scope()->num_parameters(); | 284 int num_parameters = info->scope()->num_parameters(); |
275 int offset = num_parameters * kPointerSize; | 285 int offset = num_parameters * kPointerSize; |
276 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset + offset); | 286 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset + offset); |
277 __ Mov(x1, Smi::FromInt(num_parameters)); | 287 __ Mov(x1, Smi::FromInt(num_parameters)); |
278 __ Push(x3, x2, x1); | 288 __ Push(x3, x2, x1); |
279 | 289 |
280 // Arguments to ArgumentsAccessStub: | 290 // Arguments to ArgumentsAccessStub: |
281 // function, receiver address, parameter count. | 291 // function, receiver address, parameter count. |
282 // The stub will rewrite receiver and parameter count if the previous | 292 // The stub will rewrite receiver and parameter count if the previous |
283 // stack frame was an arguments adapter frame. | 293 // stack frame was an arguments adapter frame. |
284 ArgumentsAccessStub::HasNewTarget has_new_target = | |
285 IsSubclassConstructor(info->function()->kind()) | |
286 ? ArgumentsAccessStub::HAS_NEW_TARGET | |
287 : ArgumentsAccessStub::NO_NEW_TARGET; | |
288 ArgumentsAccessStub::Type type; | 294 ArgumentsAccessStub::Type type; |
289 if (is_strict(language_mode()) || !is_simple_parameter_list()) { | 295 if (is_strict(language_mode()) || !is_simple_parameter_list()) { |
290 type = ArgumentsAccessStub::NEW_STRICT; | 296 type = ArgumentsAccessStub::NEW_STRICT; |
291 } else if (function()->has_duplicate_parameters()) { | 297 } else if (function()->has_duplicate_parameters()) { |
292 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 298 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
293 } else { | 299 } else { |
294 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 300 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
295 } | 301 } |
296 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 302 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
297 __ CallStub(&stub); | 303 __ CallStub(&stub); |
(...skipping 5197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5495 return previous_; | 5501 return previous_; |
5496 } | 5502 } |
5497 | 5503 |
5498 | 5504 |
5499 #undef __ | 5505 #undef __ |
5500 | 5506 |
5501 | 5507 |
5502 } } // namespace v8::internal | 5508 } } // namespace v8::internal |
5503 | 5509 |
5504 #endif // V8_TARGET_ARCH_ARM64 | 5510 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |