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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
11 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
13 #include "src/ic/handler-compiler.h" | 13 #include "src/ic/handler-compiler.h" |
14 #include "src/isolate.h" | 14 #include "src/isolate.h" |
15 #include "src/jsregexp.h" | 15 #include "src/jsregexp.h" |
16 #include "src/regexp-macro-assembler.h" | 16 #include "src/regexp-macro-assembler.h" |
17 #include "src/runtime.h" | 17 #include "src/runtime.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 | 22 |
23 static void InitializeArrayConstructorDescriptor( | 23 static void InitializeArrayConstructorDescriptor( |
24 Isolate* isolate, CodeStub::Major major, | 24 Isolate* isolate, CodeStubDescriptor* descriptor, |
25 CodeStubInterfaceDescriptor* descriptor, | |
26 int constant_stack_parameter_count) { | 25 int constant_stack_parameter_count) { |
27 Address deopt_handler = Runtime::FunctionForId( | 26 Address deopt_handler = Runtime::FunctionForId( |
28 Runtime::kArrayConstructor)->entry; | 27 Runtime::kArrayConstructor)->entry; |
29 | 28 |
30 if (constant_stack_parameter_count == 0) { | 29 if (constant_stack_parameter_count == 0) { |
31 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 30 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
32 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
33 constant_stack_parameter_count, | |
34 JS_FUNCTION_STUB_MODE); | 31 JS_FUNCTION_STUB_MODE); |
35 } else { | 32 } else { |
36 ArrayConstructorDescriptor call_descriptor(isolate); | 33 descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count, |
37 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, | |
38 constant_stack_parameter_count, | |
39 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 34 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
40 } | 35 } |
41 } | 36 } |
42 | 37 |
43 | 38 |
44 static void InitializeInternalArrayConstructorDescriptor( | 39 static void InitializeInternalArrayConstructorDescriptor( |
45 Isolate* isolate, CodeStub::Major major, | 40 Isolate* isolate, CodeStubDescriptor* descriptor, |
46 CodeStubInterfaceDescriptor* descriptor, | |
47 int constant_stack_parameter_count) { | 41 int constant_stack_parameter_count) { |
48 Address deopt_handler = Runtime::FunctionForId( | 42 Address deopt_handler = Runtime::FunctionForId( |
49 Runtime::kInternalArrayConstructor)->entry; | 43 Runtime::kInternalArrayConstructor)->entry; |
50 | 44 |
51 if (constant_stack_parameter_count == 0) { | 45 if (constant_stack_parameter_count == 0) { |
52 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 46 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
53 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
54 constant_stack_parameter_count, | |
55 JS_FUNCTION_STUB_MODE); | 47 JS_FUNCTION_STUB_MODE); |
56 } else { | 48 } else { |
57 InternalArrayConstructorDescriptor call_descriptor(isolate); | 49 descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count, |
58 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, | |
59 constant_stack_parameter_count, | |
60 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 50 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
61 } | 51 } |
62 } | 52 } |
63 | 53 |
64 | 54 |
65 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 55 void ArrayNoArgumentConstructorStub::InitializeDescriptor( |
66 CodeStubInterfaceDescriptor* descriptor) { | 56 CodeStubDescriptor* descriptor) { |
67 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); | 57 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0); |
68 } | 58 } |
69 | 59 |
70 | 60 |
71 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 61 void ArraySingleArgumentConstructorStub::InitializeDescriptor( |
72 CodeStubInterfaceDescriptor* descriptor) { | 62 CodeStubDescriptor* descriptor) { |
73 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); | 63 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1); |
74 } | 64 } |
75 | 65 |
76 | 66 |
77 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 67 void ArrayNArgumentsConstructorStub::InitializeDescriptor( |
78 CodeStubInterfaceDescriptor* descriptor) { | 68 CodeStubDescriptor* descriptor) { |
79 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); | 69 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); |
80 } | 70 } |
81 | 71 |
82 | 72 |
83 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 73 void InternalArrayNoArgumentConstructorStub::InitializeDescriptor( |
84 CodeStubInterfaceDescriptor* descriptor) { | 74 CodeStubDescriptor* descriptor) { |
85 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 75 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0); |
86 descriptor, 0); | |
87 } | 76 } |
88 | 77 |
89 | 78 |
90 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 79 void InternalArraySingleArgumentConstructorStub::InitializeDescriptor( |
91 CodeStubInterfaceDescriptor* descriptor) { | 80 CodeStubDescriptor* descriptor) { |
92 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 81 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1); |
93 descriptor, 1); | |
94 } | 82 } |
95 | 83 |
96 | 84 |
97 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 85 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( |
98 CodeStubInterfaceDescriptor* descriptor) { | 86 CodeStubDescriptor* descriptor) { |
99 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 87 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); |
100 descriptor, -1); | |
101 } | 88 } |
102 | 89 |
103 | 90 |
104 #define __ ACCESS_MASM(masm) | 91 #define __ ACCESS_MASM(masm) |
105 | 92 |
106 | 93 |
107 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 94 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
108 Label* slow, | 95 Label* slow, |
109 Condition cc); | 96 Condition cc); |
110 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 97 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
111 Register lhs, | 98 Register lhs, |
112 Register rhs, | 99 Register rhs, |
113 Label* rhs_not_nan, | 100 Label* rhs_not_nan, |
114 Label* slow, | 101 Label* slow, |
115 bool strict); | 102 bool strict); |
116 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 103 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
117 Register lhs, | 104 Register lhs, |
118 Register rhs); | 105 Register rhs); |
119 | 106 |
120 | 107 |
121 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 108 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
| 109 ExternalReference miss) { |
122 // Update the static counter each time a new code stub is generated. | 110 // Update the static counter each time a new code stub is generated. |
123 isolate()->counters()->code_stubs()->Increment(); | 111 isolate()->counters()->code_stubs()->Increment(); |
124 | 112 |
125 CodeStubInterfaceDescriptor descriptor(this); | 113 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); |
126 int param_count = descriptor.GetEnvironmentParameterCount(); | 114 int param_count = descriptor.GetEnvironmentParameterCount(); |
127 { | 115 { |
128 // Call the runtime system in a fresh internal frame. | 116 // Call the runtime system in a fresh internal frame. |
129 FrameScope scope(masm, StackFrame::INTERNAL); | 117 FrameScope scope(masm, StackFrame::INTERNAL); |
130 DCHECK(param_count == 0 || | 118 DCHECK(param_count == 0 || |
131 a0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 119 a0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); |
132 // Push arguments, adjust sp. | 120 // Push arguments, adjust sp. |
133 __ Subu(sp, sp, Operand(param_count * kPointerSize)); | 121 __ Subu(sp, sp, Operand(param_count * kPointerSize)); |
134 for (int i = 0; i < param_count; ++i) { | 122 for (int i = 0; i < param_count; ++i) { |
135 // Store argument to stack. | 123 // Store argument to stack. |
136 __ sw(descriptor.GetEnvironmentParameterRegister(i), | 124 __ sw(descriptor.GetEnvironmentParameterRegister(i), |
137 MemOperand(sp, (param_count - 1 - i) * kPointerSize)); | 125 MemOperand(sp, (param_count - 1 - i) * kPointerSize)); |
138 } | 126 } |
139 ExternalReference miss = descriptor.miss_handler(); | |
140 __ CallExternalReference(miss, param_count); | 127 __ CallExternalReference(miss, param_count); |
141 } | 128 } |
142 | 129 |
143 __ Ret(); | 130 __ Ret(); |
144 } | 131 } |
145 | 132 |
146 | 133 |
147 void DoubleToIStub::Generate(MacroAssembler* masm) { | 134 void DoubleToIStub::Generate(MacroAssembler* masm) { |
148 Label out_of_range, only_low, negate, done; | 135 Label out_of_range, only_low, negate, done; |
149 Register input_reg = source(); | 136 Register input_reg = source(); |
(...skipping 4736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 MemOperand(fp, 6 * kPointerSize), | 4873 MemOperand(fp, 6 * kPointerSize), |
4887 NULL); | 4874 NULL); |
4888 } | 4875 } |
4889 | 4876 |
4890 | 4877 |
4891 #undef __ | 4878 #undef __ |
4892 | 4879 |
4893 } } // namespace v8::internal | 4880 } } // namespace v8::internal |
4894 | 4881 |
4895 #endif // V8_TARGET_ARCH_MIPS | 4882 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |