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

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

Issue 12507006: MIPS: Allocation Info Tracking, continued. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/lithium-codegen-mips.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 CodeStubInterfaceDescriptor* descriptor) { 67 CodeStubInterfaceDescriptor* descriptor) {
68 static Register registers[] = { a0, a1 }; 68 static Register registers[] = { a0, a1 };
69 descriptor->register_param_count_ = 2; 69 descriptor->register_param_count_ = 2;
70 descriptor->register_params_ = registers; 70 descriptor->register_params_ = registers;
71 Address entry = 71 Address entry =
72 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; 72 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
73 descriptor->deoptimization_handler_ = FUNCTION_ADDR(entry); 73 descriptor->deoptimization_handler_ = FUNCTION_ADDR(entry);
74 } 74 }
75 75
76 76
77 static void InitializeArrayConstructorDescriptor(Isolate* isolate,
78 CodeStubInterfaceDescriptor* descriptor) {
79 // register state
80 // a1 -- constructor function
81 // a2 -- type info cell with elements kind
82 // a0 -- number of arguments to the constructor function
83 static Register registers[] = { a1, a2 };
84 descriptor->register_param_count_ = 2;
85 // stack param count needs (constructor pointer, and single argument)
86 descriptor->stack_parameter_count_ = &a0;
87 descriptor->register_params_ = registers;
88 descriptor->extra_expression_stack_count_ = 1;
89 descriptor->deoptimization_handler_ =
90 FUNCTION_ADDR(ArrayConstructor_StubFailure);
91 }
92
93
94 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
95 Isolate* isolate,
96 CodeStubInterfaceDescriptor* descriptor) {
97 InitializeArrayConstructorDescriptor(isolate, descriptor);
98 }
99
100
101 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
102 Isolate* isolate,
103 CodeStubInterfaceDescriptor* descriptor) {
104 InitializeArrayConstructorDescriptor(isolate, descriptor);
105 }
106
107
108 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
109 Isolate* isolate,
110 CodeStubInterfaceDescriptor* descriptor) {
111 InitializeArrayConstructorDescriptor(isolate, descriptor);
112 }
113
114
77 #define __ ACCESS_MASM(masm) 115 #define __ ACCESS_MASM(masm)
78 116
79 static void EmitIdenticalObjectComparison(MacroAssembler* masm, 117 static void EmitIdenticalObjectComparison(MacroAssembler* masm,
80 Label* slow, 118 Label* slow,
81 Condition cc); 119 Condition cc);
82 static void EmitSmiNonsmiComparison(MacroAssembler* masm, 120 static void EmitSmiNonsmiComparison(MacroAssembler* masm,
83 Register lhs, 121 Register lhs,
84 Register rhs, 122 Register rhs,
85 Label* rhs_not_nan, 123 Label* rhs_not_nan,
86 Label* slow, 124 Label* slow,
(...skipping 5524 matching lines...) Expand 10 before | Expand all | Expand 10 after
5611 __ addiu(a3, a3, kPointerSize); // In branch delay slot. 5649 __ addiu(a3, a3, kPointerSize); // In branch delay slot.
5612 5650
5613 __ bind(&done); 5651 __ bind(&done);
5614 __ DropAndRet(3); 5652 __ DropAndRet(3);
5615 5653
5616 __ bind(&slowcase); 5654 __ bind(&slowcase);
5617 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1); 5655 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1);
5618 } 5656 }
5619 5657
5620 5658
5621 static void GenerateRecordCallTarget(MacroAssembler* masm) { 5659 static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) {
5622 // Cache the called function in a global property cell. Cache states 5660 // Cache the called function in a global property cell. Cache states
5623 // are uninitialized, monomorphic (indicated by a JSFunction), and 5661 // are uninitialized, monomorphic (indicated by a JSFunction), and
5624 // megamorphic. 5662 // megamorphic.
5625 // a1 : the function to call 5663 // a1 : the function to call
5626 // a2 : cache cell for call target 5664 // a2 : cache cell for call target
5665 ASSERT(!FLAG_optimize_constructed_arrays);
5627 Label done; 5666 Label done;
5628 5667
5629 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), 5668 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()),
5630 masm->isolate()->heap()->undefined_value()); 5669 masm->isolate()->heap()->undefined_value());
5631 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()), 5670 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()),
5632 masm->isolate()->heap()->the_hole_value()); 5671 masm->isolate()->heap()->the_hole_value());
5633 5672
5634 // Load the cache state into a3. 5673 // Load the cache state into a3.
5635 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); 5674 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
5636 5675
(...skipping 16 matching lines...) Expand all
5653 5692
5654 // MegamorphicSentinel is an immortal immovable object (undefined) so no 5693 // MegamorphicSentinel is an immortal immovable object (undefined) so no
5655 // write-barrier is needed. 5694 // write-barrier is needed.
5656 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 5695 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5657 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); 5696 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
5658 5697
5659 __ bind(&done); 5698 __ bind(&done);
5660 } 5699 }
5661 5700
5662 5701
5702 static void GenerateRecordCallTarget(MacroAssembler* masm) {
5703 // Cache the called function in a global property cell. Cache states
5704 // are uninitialized, monomorphic (indicated by a JSFunction), and
5705 // megamorphic.
5706 // a1 : the function to call
5707 // a2 : cache cell for call target
5708 ASSERT(FLAG_optimize_constructed_arrays);
5709 Label initialize, done, miss, megamorphic, not_array_function;
5710
5711 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()),
5712 masm->isolate()->heap()->undefined_value());
5713 ASSERT_EQ(*TypeFeedbackCells::UninitializedSentinel(masm->isolate()),
5714 masm->isolate()->heap()->the_hole_value());
5715
5716 // Load the cache state into a3.
5717 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
5718
5719 // A monomorphic cache hit or an already megamorphic state: invoke the
5720 // function without changing the state.
5721 __ Branch(&done, eq, a3, Operand(a1));
5722 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5723 __ Branch(&done, eq, a3, Operand(at));
5724
5725 // Special handling of the Array() function, which caches not only the
5726 // monomorphic Array function but the initial ElementsKind with special
5727 // sentinels
5728 Handle<Object> terminal_kind_sentinel =
5729 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
5730 LAST_FAST_ELEMENTS_KIND);
5731 __ Branch(&miss, ne, a3, Operand(terminal_kind_sentinel));
5732 // Make sure the function is the Array() function
5733 __ LoadArrayFunction(a3);
5734 __ Branch(&megamorphic, ne, a1, Operand(a3));
5735 __ jmp(&done);
5736
5737 __ bind(&miss);
5738
5739 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
5740 // megamorphic.
5741 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5742 __ Branch(&initialize, eq, a3, Operand(at));
5743 // MegamorphicSentinel is an immortal immovable object (undefined) so no
5744 // write-barrier is needed.
5745 __ bind(&megamorphic);
5746 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5747 __ sw(at, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
5748
5749 // An uninitialized cache is patched with the function or sentinel to
5750 // indicate the ElementsKind if function is the Array constructor.
5751 __ bind(&initialize);
5752 // Make sure the function is the Array() function
5753 __ LoadArrayFunction(a3);
5754 __ Branch(&not_array_function, ne, a1, Operand(a3));
5755
5756 // The target function is the Array constructor, install a sentinel value in
5757 // the constructor's type info cell that will track the initial ElementsKind
5758 // that should be used for the array when its constructed.
5759 Handle<Object> initial_kind_sentinel =
5760 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
5761 GetInitialFastElementsKind());
5762 __ li(a3, Operand(initial_kind_sentinel));
5763 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
5764 __ Branch(&done);
5765
5766 __ bind(&not_array_function);
5767 __ sw(a1, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
5768 // No need for a write barrier here - cells are rescanned.
5769
5770 __ bind(&done);
5771 }
5772
5773
5663 void CallFunctionStub::Generate(MacroAssembler* masm) { 5774 void CallFunctionStub::Generate(MacroAssembler* masm) {
5664 // a1 : the function to call 5775 // a1 : the function to call
5665 // a2 : cache cell for call target 5776 // a2 : cache cell for call target
5666 Label slow, non_function; 5777 Label slow, non_function;
5667 5778
5668 // The receiver might implicitly be the global object. This is 5779 // The receiver might implicitly be the global object. This is
5669 // indicated by passing the hole as the receiver to the call 5780 // indicated by passing the hole as the receiver to the call
5670 // function stub. 5781 // function stub.
5671 if (ReceiverMightBeImplicit()) { 5782 if (ReceiverMightBeImplicit()) {
5672 Label call; 5783 Label call;
(...skipping 12 matching lines...) Expand all
5685 } 5796 }
5686 5797
5687 // Check that the function is really a JavaScript function. 5798 // Check that the function is really a JavaScript function.
5688 // a1: pushed function (to be verified) 5799 // a1: pushed function (to be verified)
5689 __ JumpIfSmi(a1, &non_function); 5800 __ JumpIfSmi(a1, &non_function);
5690 // Get the map of the function object. 5801 // Get the map of the function object.
5691 __ GetObjectType(a1, a3, a3); 5802 __ GetObjectType(a1, a3, a3);
5692 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE)); 5803 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
5693 5804
5694 if (RecordCallTarget()) { 5805 if (RecordCallTarget()) {
5695 GenerateRecordCallTarget(masm); 5806 if (FLAG_optimize_constructed_arrays) {
5807 GenerateRecordCallTarget(masm);
5808 } else {
5809 GenerateRecordCallTargetNoArray(masm);
5810 }
5696 } 5811 }
5697 5812
5698 // Fast-case: Invoke the function now. 5813 // Fast-case: Invoke the function now.
5699 // a1: pushed function 5814 // a1: pushed function
5700 ParameterCount actual(argc_); 5815 ParameterCount actual(argc_);
5701 5816
5702 if (ReceiverMightBeImplicit()) { 5817 if (ReceiverMightBeImplicit()) {
5703 Label call_as_function; 5818 Label call_as_function;
5704 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 5819 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
5705 __ Branch(&call_as_function, eq, t0, Operand(at)); 5820 __ Branch(&call_as_function, eq, t0, Operand(at));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5759 // a2 : cache cell for call target 5874 // a2 : cache cell for call target
5760 Label slow, non_function_call; 5875 Label slow, non_function_call;
5761 5876
5762 // Check that the function is not a smi. 5877 // Check that the function is not a smi.
5763 __ JumpIfSmi(a1, &non_function_call); 5878 __ JumpIfSmi(a1, &non_function_call);
5764 // Check that the function is a JSFunction. 5879 // Check that the function is a JSFunction.
5765 __ GetObjectType(a1, a3, a3); 5880 __ GetObjectType(a1, a3, a3);
5766 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE)); 5881 __ Branch(&slow, ne, a3, Operand(JS_FUNCTION_TYPE));
5767 5882
5768 if (RecordCallTarget()) { 5883 if (RecordCallTarget()) {
5769 GenerateRecordCallTarget(masm); 5884 if (FLAG_optimize_constructed_arrays) {
5885 GenerateRecordCallTarget(masm);
5886 } else {
5887 GenerateRecordCallTargetNoArray(masm);
5888 }
5770 } 5889 }
5771 5890
5772 // Jump to the function-specific construct stub. 5891 // Jump to the function-specific construct stub.
5773 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 5892 Register jmp_reg = FLAG_optimize_constructed_arrays ? a3 : a2;
5774 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kConstructStubOffset)); 5893 __ lw(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
5775 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 5894 __ lw(jmp_reg, FieldMemOperand(jmp_reg,
5895 SharedFunctionInfo::kConstructStubOffset));
5896 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
5776 __ Jump(at); 5897 __ Jump(at);
5777 5898
5778 // a0: number of arguments 5899 // a0: number of arguments
5779 // a1: called object 5900 // a1: called object
5780 // a3: object type 5901 // a3: object type
5781 Label do_call; 5902 Label do_call;
5782 __ bind(&slow); 5903 __ bind(&slow);
5783 __ Branch(&non_function_call, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE)); 5904 __ Branch(&non_function_call, ne, a3, Operand(JS_FUNCTION_PROXY_TYPE));
5784 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 5905 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
5785 __ jmp(&do_call); 5906 __ jmp(&do_call);
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after
8022 __ Pop(ra, t1, a1); 8143 __ Pop(ra, t1, a1);
8023 __ Ret(); 8144 __ Ret();
8024 } 8145 }
8025 8146
8026 8147
8027 #undef __ 8148 #undef __
8028 8149
8029 } } // namespace v8::internal 8150 } } // namespace v8::internal
8030 8151
8031 #endif // V8_TARGET_ARCH_MIPS 8152 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698