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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // Receiver for constructor call allocated. | 481 // Receiver for constructor call allocated. |
482 // a1: constructor function | 482 // a1: constructor function |
483 // a3: new target | 483 // a3: new target |
484 // t0: JSObject | 484 // t0: JSObject |
485 __ bind(&allocated); | 485 __ bind(&allocated); |
486 | 486 |
487 __ ld(a0, MemOperand(sp)); | 487 __ ld(a0, MemOperand(sp)); |
488 } | 488 } |
489 __ SmiUntag(a0); | 489 __ SmiUntag(a0); |
490 | 490 |
491 // Push new.target onto the construct frame. This is stored just below the | |
492 // receiver on the stack. | |
493 if (create_implicit_receiver) { | 491 if (create_implicit_receiver) { |
494 // Push the allocated receiver to the stack. We need two copies | 492 // Push the allocated receiver to the stack. We need two copies |
495 // because we may have to return the original one and the calling | 493 // because we may have to return the original one and the calling |
496 // conventions dictate that the called function pops the receiver. | 494 // conventions dictate that the called function pops the receiver. |
497 __ Push(a3, t0, t0); | 495 __ Push(t0, t0); |
498 } else { | 496 } else { |
499 __ push(a3); | |
500 __ PushRoot(Heap::kTheHoleValueRootIndex); | 497 __ PushRoot(Heap::kTheHoleValueRootIndex); |
501 } | 498 } |
502 | 499 |
503 // Set up pointer to last argument. | 500 // Set up pointer to last argument. |
504 __ Daddu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 501 __ Daddu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
505 | 502 |
506 // Copy arguments and receiver to the expression stack. | 503 // Copy arguments and receiver to the expression stack. |
507 // a0: number of arguments | 504 // a0: number of arguments |
508 // a1: constructor function | 505 // a1: constructor function |
509 // a2: address of last argument (caller sp) | 506 // a2: address of last argument (caller sp) |
510 // a3: new target | 507 // a3: new target |
511 // t0: number of arguments (smi-tagged) | 508 // t0: number of arguments (smi-tagged) |
512 // sp[0]: receiver | 509 // sp[0]: receiver |
513 // sp[1]: receiver | 510 // sp[1]: receiver |
514 // sp[2]: new.target | 511 // sp[2]: number of arguments (smi-tagged) |
515 // sp[3]: number of arguments (smi-tagged) | |
516 Label loop, entry; | 512 Label loop, entry; |
517 __ mov(t0, a0); | 513 __ mov(t0, a0); |
518 __ jmp(&entry); | 514 __ jmp(&entry); |
519 __ bind(&loop); | 515 __ bind(&loop); |
520 __ dsll(a4, t0, kPointerSizeLog2); | 516 __ dsll(a4, t0, kPointerSizeLog2); |
521 __ Daddu(a4, a2, Operand(a4)); | 517 __ Daddu(a4, a2, Operand(a4)); |
522 __ ld(a5, MemOperand(a4)); | 518 __ ld(a5, MemOperand(a4)); |
523 __ push(a5); | 519 __ push(a5); |
524 __ bind(&entry); | 520 __ bind(&entry); |
525 __ Daddu(t0, t0, Operand(-1)); | 521 __ Daddu(t0, t0, Operand(-1)); |
(...skipping 24 matching lines...) Expand all Loading... |
550 | 546 |
551 if (create_implicit_receiver) { | 547 if (create_implicit_receiver) { |
552 // If the result is an object (in the ECMA sense), we should get rid | 548 // If the result is an object (in the ECMA sense), we should get rid |
553 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 549 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
554 // on page 74. | 550 // on page 74. |
555 Label use_receiver, exit; | 551 Label use_receiver, exit; |
556 | 552 |
557 // If the result is a smi, it is *not* an object in the ECMA sense. | 553 // If the result is a smi, it is *not* an object in the ECMA sense. |
558 // v0: result | 554 // v0: result |
559 // sp[0]: receiver (newly allocated object) | 555 // sp[0]: receiver (newly allocated object) |
560 // sp[1]: new.target | 556 // sp[1]: number of arguments (smi-tagged) |
561 // sp[2]: number of arguments (smi-tagged) | |
562 __ JumpIfSmi(v0, &use_receiver); | 557 __ JumpIfSmi(v0, &use_receiver); |
563 | 558 |
564 // If the type of the result (stored in its map) is less than | 559 // If the type of the result (stored in its map) is less than |
565 // FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense. | 560 // FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense. |
566 __ GetObjectType(v0, a1, a3); | 561 __ GetObjectType(v0, a1, a3); |
567 __ Branch(&exit, greater_equal, a3, Operand(FIRST_JS_RECEIVER_TYPE)); | 562 __ Branch(&exit, greater_equal, a3, Operand(FIRST_JS_RECEIVER_TYPE)); |
568 | 563 |
569 // Throw away the result of the constructor invocation and use the | 564 // Throw away the result of the constructor invocation and use the |
570 // on-stack receiver as the result. | 565 // on-stack receiver as the result. |
571 __ bind(&use_receiver); | 566 __ bind(&use_receiver); |
572 __ ld(v0, MemOperand(sp)); | 567 __ ld(v0, MemOperand(sp)); |
573 | 568 |
574 // Remove receiver from the stack, remove caller arguments, and | 569 // Remove receiver from the stack, remove caller arguments, and |
575 // return. | 570 // return. |
576 __ bind(&exit); | 571 __ bind(&exit); |
577 // v0: result | 572 // v0: result |
578 // sp[0]: receiver (newly allocated object) | 573 // sp[0]: receiver (newly allocated object) |
579 // sp[1]: new target | 574 // sp[1]: number of arguments (smi-tagged) |
580 // sp[2]: number of arguments (smi-tagged) | 575 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); |
581 __ ld(a1, MemOperand(sp, 2 * kPointerSize)); | |
582 } else { | 576 } else { |
583 __ ld(a1, MemOperand(sp, kPointerSize)); | 577 __ ld(a1, MemOperand(sp)); |
584 } | 578 } |
585 | 579 |
586 // Leave construct frame. | 580 // Leave construct frame. |
587 } | 581 } |
588 | 582 |
589 __ SmiScale(a4, a1, kPointerSizeLog2); | 583 __ SmiScale(a4, a1, kPointerSizeLog2); |
590 __ Daddu(sp, sp, a4); | 584 __ Daddu(sp, sp, a4); |
591 __ Daddu(sp, sp, kPointerSize); | 585 __ Daddu(sp, sp, kPointerSize); |
592 if (create_implicit_receiver) { | 586 if (create_implicit_receiver) { |
593 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); | 587 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 } | 1951 } |
1958 } | 1952 } |
1959 | 1953 |
1960 | 1954 |
1961 #undef __ | 1955 #undef __ |
1962 | 1956 |
1963 } // namespace internal | 1957 } // namespace internal |
1964 } // namespace v8 | 1958 } // namespace v8 |
1965 | 1959 |
1966 #endif // V8_TARGET_ARCH_MIPS64 | 1960 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |