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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 1359583002: [builtins] Add support for NewTarget to Execution::New. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Merge mips and mips64 ports. Created 5 years, 3 months 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/mips/builtins-mips.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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); 2592 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
2593 } 2593 }
2594 2594
2595 2595
2596 void CallConstructStub::Generate(MacroAssembler* masm) { 2596 void CallConstructStub::Generate(MacroAssembler* masm) {
2597 // a0 : number of arguments 2597 // a0 : number of arguments
2598 // a1 : the function to call 2598 // a1 : the function to call
2599 // a2 : feedback vector 2599 // a2 : feedback vector
2600 // a3 : slot in feedback vector (Smi, for RecordCallTarget) 2600 // a3 : slot in feedback vector (Smi, for RecordCallTarget)
2601 // t0 : original constructor (for IsSuperConstructorCall) 2601 // t0 : original constructor (for IsSuperConstructorCall)
2602 Label slow, non_function_call;
2603 2602
2603 Label non_function;
2604 // Check that the function is not a smi. 2604 // Check that the function is not a smi.
2605 __ JumpIfSmi(a1, &non_function_call); 2605 __ JumpIfSmi(a1, &non_function);
2606 // Check that the function is a JSFunction. 2606 // Check that the function is a JSFunction.
2607 __ GetObjectType(a1, t1, t1); 2607 __ GetObjectType(a1, t1, t1);
2608 __ Branch(&slow, ne, t1, Operand(JS_FUNCTION_TYPE)); 2608 __ Branch(&non_function, ne, t1, Operand(JS_FUNCTION_TYPE));
2609 2609
2610 if (RecordCallTarget()) { 2610 if (RecordCallTarget()) {
2611 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); 2611 GenerateRecordCallTarget(masm, IsSuperConstructorCall());
2612 2612
2613 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); 2613 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize);
2614 __ Addu(t1, a2, at); 2614 __ Addu(t1, a2, at);
2615 Label feedback_register_initialized; 2615 Label feedback_register_initialized;
2616 // Put the AllocationSite from the feedback vector into a2, or undefined. 2616 // Put the AllocationSite from the feedback vector into a2, or undefined.
2617 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize)); 2617 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize));
2618 __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset)); 2618 __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset));
2619 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 2619 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
2620 __ Branch(&feedback_register_initialized, eq, t1, Operand(at)); 2620 __ Branch(&feedback_register_initialized, eq, t1, Operand(at));
2621 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 2621 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
2622 __ bind(&feedback_register_initialized); 2622 __ bind(&feedback_register_initialized);
2623 2623
2624 __ AssertUndefinedOrAllocationSite(a2, t1); 2624 __ AssertUndefinedOrAllocationSite(a2, t1);
2625 } 2625 }
2626 2626
2627 // Pass function as original constructor. 2627 // Pass function as original constructor.
2628 if (IsSuperConstructorCall()) { 2628 if (IsSuperConstructorCall()) {
2629 __ mov(a3, t0); 2629 __ mov(a3, t0);
2630 } else { 2630 } else {
2631 __ mov(a3, a1); 2631 __ mov(a3, a1);
2632 } 2632 }
2633 2633
2634 // Jump to the function-specific construct stub. 2634 // Tail call to the function-specific construct stub (still in the caller
2635 Register jmp_reg = t0; 2635 // context at this point).
2636 __ lw(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2636 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2637 __ lw(jmp_reg, FieldMemOperand(jmp_reg, 2637 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset));
2638 SharedFunctionInfo::kConstructStubOffset)); 2638 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag));
2639 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
2640 __ Jump(at); 2639 __ Jump(at);
2641 2640
2642 // a0: number of arguments 2641 __ bind(&non_function);
2643 // a1: called object 2642 __ mov(a3, a1);
2644 // t1: object type 2643 __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2645 __ bind(&slow);
2646 {
2647 __ Branch(&non_function_call, ne, t1, Operand(JS_FUNCTION_PROXY_TYPE));
2648 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
2649 __ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
2650 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2651
2652 __ bind(&non_function_call);
2653 {
2654 // Determine the delegate for the target (if any).
2655 FrameScope scope(masm, StackFrame::INTERNAL);
2656 __ SmiTag(a0);
2657 __ Push(a0, a1);
2658 __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
2659 __ mov(a1, v0);
2660 __ Pop(a0);
2661 __ SmiUntag(a0);
2662 }
2663 // The delegate is always a regular function.
2664 __ AssertFunction(a1);
2665 __ Jump(masm->isolate()->builtins()->CallFunction(),
2666 RelocInfo::CODE_TARGET);
2667 }
2668 } 2644 }
2669 2645
2670 2646
2671 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2647 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2672 __ lw(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2648 __ lw(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2673 __ lw(vector, FieldMemOperand(vector, 2649 __ lw(vector, FieldMemOperand(vector,
2674 JSFunction::kSharedFunctionInfoOffset)); 2650 JSFunction::kSharedFunctionInfoOffset));
2675 __ lw(vector, FieldMemOperand(vector, 2651 __ lw(vector, FieldMemOperand(vector,
2676 SharedFunctionInfo::kFeedbackVectorOffset)); 2652 SharedFunctionInfo::kFeedbackVectorOffset));
2677 } 2653 }
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after
5748 MemOperand(fp, 6 * kPointerSize), NULL); 5724 MemOperand(fp, 6 * kPointerSize), NULL);
5749 } 5725 }
5750 5726
5751 5727
5752 #undef __ 5728 #undef __
5753 5729
5754 } // namespace internal 5730 } // namespace internal
5755 } // namespace v8 5731 } // namespace v8
5756 5732
5757 #endif // V8_TARGET_ARCH_MIPS 5733 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698