Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(965)

Side by Side Diff: src/mips/builtins-mips.cc

Issue 1489353004: Remove new.target value from construct stub frames. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_turbofan-pass-new-target-9
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // a3: new target 484 // a3: new target
485 // t4: JSObject 485 // t4: JSObject
486 __ bind(&allocated); 486 __ bind(&allocated);
487 487
488 // Retrieve smi-tagged arguments count from the stack. 488 // Retrieve smi-tagged arguments count from the stack.
489 __ lw(a0, MemOperand(sp)); 489 __ lw(a0, MemOperand(sp));
490 } 490 }
491 491
492 __ SmiUntag(a0); 492 __ SmiUntag(a0);
493 493
494 // Push new.target onto the construct frame. This is stored just below the
495 // receiver on the stack.
496 if (create_implicit_receiver) { 494 if (create_implicit_receiver) {
497 // Push the allocated receiver to the stack. We need two copies 495 // Push the allocated receiver to the stack. We need two copies
498 // because we may have to return the original one and the calling 496 // because we may have to return the original one and the calling
499 // conventions dictate that the called function pops the receiver. 497 // conventions dictate that the called function pops the receiver.
500 __ Push(a3, t4, t4); 498 __ Push(t4, t4);
501 } else { 499 } else {
502 __ push(a3);
503 __ PushRoot(Heap::kTheHoleValueRootIndex); 500 __ PushRoot(Heap::kTheHoleValueRootIndex);
504 } 501 }
505 502
506 // Set up pointer to last argument. 503 // Set up pointer to last argument.
507 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 504 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
508 505
509 // Copy arguments and receiver to the expression stack. 506 // Copy arguments and receiver to the expression stack.
510 // a0: number of arguments 507 // a0: number of arguments
511 // a1: constructor function 508 // a1: constructor function
512 // a2: address of last argument (caller sp) 509 // a2: address of last argument (caller sp)
513 // a3: new target 510 // a3: new target
514 // t4: number of arguments (smi-tagged) 511 // t4: number of arguments (smi-tagged)
515 // sp[0]: receiver 512 // sp[0]: receiver
516 // sp[1]: receiver 513 // sp[1]: receiver
517 // sp[2]: new.target 514 // sp[2]: number of arguments (smi-tagged)
518 // sp[3]: number of arguments (smi-tagged)
519 Label loop, entry; 515 Label loop, entry;
520 __ SmiTag(t4, a0); 516 __ SmiTag(t4, a0);
521 __ jmp(&entry); 517 __ jmp(&entry);
522 __ bind(&loop); 518 __ bind(&loop);
523 __ sll(t0, t4, kPointerSizeLog2 - kSmiTagSize); 519 __ sll(t0, t4, kPointerSizeLog2 - kSmiTagSize);
524 __ Addu(t0, a2, Operand(t0)); 520 __ Addu(t0, a2, Operand(t0));
525 __ lw(t1, MemOperand(t0)); 521 __ lw(t1, MemOperand(t0));
526 __ push(t1); 522 __ push(t1);
527 __ bind(&entry); 523 __ bind(&entry);
528 __ Addu(t4, t4, Operand(-2)); 524 __ Addu(t4, t4, Operand(-2));
(...skipping 24 matching lines...) Expand all
553 549
554 if (create_implicit_receiver) { 550 if (create_implicit_receiver) {
555 // If the result is an object (in the ECMA sense), we should get rid 551 // If the result is an object (in the ECMA sense), we should get rid
556 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 552 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
557 // on page 74. 553 // on page 74.
558 Label use_receiver, exit; 554 Label use_receiver, exit;
559 555
560 // If the result is a smi, it is *not* an object in the ECMA sense. 556 // If the result is a smi, it is *not* an object in the ECMA sense.
561 // v0: result 557 // v0: result
562 // sp[0]: receiver (newly allocated object) 558 // sp[0]: receiver (newly allocated object)
563 // sp[1]: new.target 559 // sp[1]: number of arguments (smi-tagged)
564 // sp[2]: number of arguments (smi-tagged)
565 __ JumpIfSmi(v0, &use_receiver); 560 __ JumpIfSmi(v0, &use_receiver);
566 561
567 // If the type of the result (stored in its map) is less than 562 // If the type of the result (stored in its map) is less than
568 // FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense. 563 // FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense.
569 __ GetObjectType(v0, a1, a3); 564 __ GetObjectType(v0, a1, a3);
570 __ Branch(&exit, greater_equal, a3, Operand(FIRST_JS_RECEIVER_TYPE)); 565 __ Branch(&exit, greater_equal, a3, Operand(FIRST_JS_RECEIVER_TYPE));
571 566
572 // Throw away the result of the constructor invocation and use the 567 // Throw away the result of the constructor invocation and use the
573 // on-stack receiver as the result. 568 // on-stack receiver as the result.
574 __ bind(&use_receiver); 569 __ bind(&use_receiver);
575 __ lw(v0, MemOperand(sp)); 570 __ lw(v0, MemOperand(sp));
576 571
577 // Remove receiver from the stack, remove caller arguments, and 572 // Remove receiver from the stack, remove caller arguments, and
578 // return. 573 // return.
579 __ bind(&exit); 574 __ bind(&exit);
580 // v0: result 575 // v0: result
581 // sp[0]: receiver (newly allocated object) 576 // sp[0]: receiver (newly allocated object)
582 // sp[1]: new target 577 // sp[1]: number of arguments (smi-tagged)
583 // sp[2]: number of arguments (smi-tagged) 578 __ lw(a1, MemOperand(sp, 1 * kPointerSize));
584 __ lw(a1, MemOperand(sp, 2 * kPointerSize));
585 } else { 579 } else {
586 __ lw(a1, MemOperand(sp, kPointerSize)); 580 __ lw(a1, MemOperand(sp));
587 } 581 }
588 582
589 // Leave construct frame. 583 // Leave construct frame.
590 } 584 }
591 585
592 __ sll(t0, a1, kPointerSizeLog2 - 1); 586 __ sll(t0, a1, kPointerSizeLog2 - 1);
593 __ Addu(sp, sp, t0); 587 __ Addu(sp, sp, t0);
594 __ Addu(sp, sp, kPointerSize); 588 __ Addu(sp, sp, kPointerSize);
595 if (create_implicit_receiver) { 589 if (create_implicit_receiver) {
596 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); 590 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2);
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 } 1957 }
1964 } 1958 }
1965 1959
1966 1960
1967 #undef __ 1961 #undef __
1968 1962
1969 } // namespace internal 1963 } // namespace internal
1970 } // namespace v8 1964 } // namespace v8
1971 1965
1972 #endif // V8_TARGET_ARCH_MIPS 1966 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698