| OLD | NEW |
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 Isolate* isolate, | 107 Isolate* isolate, |
| 108 CodeStubInterfaceDescriptor* descriptor) { | 108 CodeStubInterfaceDescriptor* descriptor) { |
| 109 static Register registers[] = { a1, a0 }; | 109 static Register registers[] = { a1, a0 }; |
| 110 descriptor->register_param_count_ = 2; | 110 descriptor->register_param_count_ = 2; |
| 111 descriptor->register_params_ = registers; | 111 descriptor->register_params_ = registers; |
| 112 descriptor->deoptimization_handler_ = | 112 descriptor->deoptimization_handler_ = |
| 113 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 113 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 114 } | 114 } |
| 115 | 115 |
| 116 | 116 |
| 117 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( |
| 118 Isolate* isolate, |
| 119 CodeStubInterfaceDescriptor* descriptor) { |
| 120 static Register registers[] = {a1, a0 }; |
| 121 descriptor->register_param_count_ = 2; |
| 122 descriptor->register_params_ = registers; |
| 123 descriptor->deoptimization_handler_ = |
| 124 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 125 } |
| 126 |
| 127 |
| 117 void LoadFieldStub::InitializeInterfaceDescriptor( | 128 void LoadFieldStub::InitializeInterfaceDescriptor( |
| 118 Isolate* isolate, | 129 Isolate* isolate, |
| 119 CodeStubInterfaceDescriptor* descriptor) { | 130 CodeStubInterfaceDescriptor* descriptor) { |
| 120 static Register registers[] = { a0 }; | 131 static Register registers[] = { a0 }; |
| 121 descriptor->register_param_count_ = 1; | 132 descriptor->register_param_count_ = 1; |
| 122 descriptor->register_params_ = registers; | 133 descriptor->register_params_ = registers; |
| 123 descriptor->deoptimization_handler_ = NULL; | 134 descriptor->deoptimization_handler_ = NULL; |
| 124 } | 135 } |
| 125 | 136 |
| 126 | 137 |
| 127 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( | 138 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( |
| 128 Isolate* isolate, | 139 Isolate* isolate, |
| 129 CodeStubInterfaceDescriptor* descriptor) { | 140 CodeStubInterfaceDescriptor* descriptor) { |
| 130 static Register registers[] = { a1 }; | 141 static Register registers[] = { a1 }; |
| 131 descriptor->register_param_count_ = 1; | 142 descriptor->register_param_count_ = 1; |
| 132 descriptor->register_params_ = registers; | 143 descriptor->register_params_ = registers; |
| 133 descriptor->deoptimization_handler_ = NULL; | 144 descriptor->deoptimization_handler_ = NULL; |
| 134 } | 145 } |
| 135 | 146 |
| 136 | 147 |
| 148 void KeyedArrayCallStub::InitializeInterfaceDescriptor( |
| 149 Isolate* isolate, |
| 150 CodeStubInterfaceDescriptor* descriptor) { |
| 151 static Register registers[] = { a2 }; |
| 152 descriptor->register_param_count_ = 1; |
| 153 descriptor->register_params_ = registers; |
| 154 descriptor->continuation_type_ = TAIL_CALL_CONTINUATION; |
| 155 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 156 descriptor->deoptimization_handler_ = |
| 157 FUNCTION_ADDR(KeyedCallIC_MissFromStubFailure); |
| 158 } |
| 159 |
| 160 |
| 137 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( | 161 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( |
| 138 Isolate* isolate, | 162 Isolate* isolate, |
| 139 CodeStubInterfaceDescriptor* descriptor) { | 163 CodeStubInterfaceDescriptor* descriptor) { |
| 140 static Register registers[] = { a2, a1, a0 }; | 164 static Register registers[] = { a2, a1, a0 }; |
| 141 descriptor->register_param_count_ = 3; | 165 descriptor->register_param_count_ = 3; |
| 142 descriptor->register_params_ = registers; | 166 descriptor->register_params_ = registers; |
| 143 descriptor->deoptimization_handler_ = | 167 descriptor->deoptimization_handler_ = |
| 144 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); | 168 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); |
| 145 } | 169 } |
| 146 | 170 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 171 | 195 |
| 172 | 196 |
| 173 static void InitializeArrayConstructorDescriptor( | 197 static void InitializeArrayConstructorDescriptor( |
| 174 Isolate* isolate, | 198 Isolate* isolate, |
| 175 CodeStubInterfaceDescriptor* descriptor, | 199 CodeStubInterfaceDescriptor* descriptor, |
| 176 int constant_stack_parameter_count) { | 200 int constant_stack_parameter_count) { |
| 177 // register state | 201 // register state |
| 178 // a0 -- number of arguments | 202 // a0 -- number of arguments |
| 179 // a1 -- function | 203 // a1 -- function |
| 180 // a2 -- type info cell with elements kind | 204 // a2 -- type info cell with elements kind |
| 181 static Register registers[] = { a1, a2 }; | 205 static Register registers_variable_args[] = { a1, a2, a0 }; |
| 182 descriptor->register_param_count_ = 2; | 206 static Register registers_no_args[] = { a1, a2 }; |
| 183 if (constant_stack_parameter_count != 0) { | 207 |
| 208 if (constant_stack_parameter_count == 0) { |
| 209 descriptor->register_param_count_ = 2; |
| 210 descriptor->register_params_ = registers_no_args; |
| 211 } else { |
| 184 // stack param count needs (constructor pointer, and single argument) | 212 // stack param count needs (constructor pointer, and single argument) |
| 213 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 185 descriptor->stack_parameter_count_ = a0; | 214 descriptor->stack_parameter_count_ = a0; |
| 215 descriptor->register_param_count_ = 3; |
| 216 descriptor->register_params_ = registers_variable_args; |
| 186 } | 217 } |
| 218 |
| 187 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 219 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
| 188 descriptor->register_params_ = registers; | |
| 189 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 220 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
| 190 descriptor->deoptimization_handler_ = | 221 descriptor->deoptimization_handler_ = |
| 191 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; | 222 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; |
| 192 } | 223 } |
| 193 | 224 |
| 194 | 225 |
| 195 static void InitializeInternalArrayConstructorDescriptor( | 226 static void InitializeInternalArrayConstructorDescriptor( |
| 196 Isolate* isolate, | 227 Isolate* isolate, |
| 197 CodeStubInterfaceDescriptor* descriptor, | 228 CodeStubInterfaceDescriptor* descriptor, |
| 198 int constant_stack_parameter_count) { | 229 int constant_stack_parameter_count) { |
| 199 // register state | 230 // register state |
| 200 // a0 -- number of arguments | 231 // a0 -- number of arguments |
| 201 // a1 -- constructor function | 232 // a1 -- constructor function |
| 202 static Register registers[] = { a1 }; | 233 static Register registers_variable_args[] = { a1, a0 }; |
| 203 descriptor->register_param_count_ = 1; | 234 static Register registers_no_args[] = { a1 }; |
| 204 | 235 |
| 205 if (constant_stack_parameter_count != 0) { | 236 if (constant_stack_parameter_count == 0) { |
| 206 // Stack param count needs (constructor pointer, and single argument). | 237 descriptor->register_param_count_ = 1; |
| 238 descriptor->register_params_ = registers_no_args; |
| 239 } else { |
| 240 // stack param count needs (constructor pointer, and single argument) |
| 241 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 207 descriptor->stack_parameter_count_ = a0; | 242 descriptor->stack_parameter_count_ = a0; |
| 243 descriptor->register_param_count_ = 2; |
| 244 descriptor->register_params_ = registers_variable_args; |
| 208 } | 245 } |
| 246 |
| 209 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 247 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
| 210 descriptor->register_params_ = registers; | |
| 211 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 248 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
| 212 descriptor->deoptimization_handler_ = | 249 descriptor->deoptimization_handler_ = |
| 213 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; | 250 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; |
| 214 } | 251 } |
| 215 | 252 |
| 216 | 253 |
| 217 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 254 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 218 Isolate* isolate, | 255 Isolate* isolate, |
| 219 CodeStubInterfaceDescriptor* descriptor) { | 256 CodeStubInterfaceDescriptor* descriptor) { |
| 220 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); | 257 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 Isolate* isolate, | 321 Isolate* isolate, |
| 285 CodeStubInterfaceDescriptor* descriptor) { | 322 CodeStubInterfaceDescriptor* descriptor) { |
| 286 static Register registers[] = { a0, a3, a1, a2 }; | 323 static Register registers[] = { a0, a3, a1, a2 }; |
| 287 descriptor->register_param_count_ = 4; | 324 descriptor->register_param_count_ = 4; |
| 288 descriptor->register_params_ = registers; | 325 descriptor->register_params_ = registers; |
| 289 descriptor->deoptimization_handler_ = | 326 descriptor->deoptimization_handler_ = |
| 290 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); | 327 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); |
| 291 } | 328 } |
| 292 | 329 |
| 293 | 330 |
| 331 void NewStringAddStub::InitializeInterfaceDescriptor( |
| 332 Isolate* isolate, |
| 333 CodeStubInterfaceDescriptor* descriptor) { |
| 334 static Register registers[] = { a1, a0 }; |
| 335 descriptor->register_param_count_ = 2; |
| 336 descriptor->register_params_ = registers; |
| 337 descriptor->deoptimization_handler_ = |
| 338 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
| 339 } |
| 340 |
| 341 |
| 294 #define __ ACCESS_MASM(masm) | 342 #define __ ACCESS_MASM(masm) |
| 295 | 343 |
| 296 | 344 |
| 297 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 345 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
| 298 Label* slow, | 346 Label* slow, |
| 299 Condition cc); | 347 Condition cc); |
| 300 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 348 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
| 301 Register lhs, | 349 Register lhs, |
| 302 Register rhs, | 350 Register rhs, |
| 303 Label* rhs_not_nan, | 351 Label* rhs_not_nan, |
| (...skipping 5519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5823 if (function_mode_ == JS_FUNCTION_STUB_MODE) { | 5871 if (function_mode_ == JS_FUNCTION_STUB_MODE) { |
| 5824 __ Addu(a1, a1, Operand(1)); | 5872 __ Addu(a1, a1, Operand(1)); |
| 5825 } | 5873 } |
| 5826 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5874 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5827 __ sll(a1, a1, kPointerSizeLog2); | 5875 __ sll(a1, a1, kPointerSizeLog2); |
| 5828 __ Ret(USE_DELAY_SLOT); | 5876 __ Ret(USE_DELAY_SLOT); |
| 5829 __ Addu(sp, sp, a1); | 5877 __ Addu(sp, sp, a1); |
| 5830 } | 5878 } |
| 5831 | 5879 |
| 5832 | 5880 |
| 5881 void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) { |
| 5882 CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); |
| 5883 __ Call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
| 5884 __ mov(a1, v0); |
| 5885 int parameter_count_offset = |
| 5886 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 5887 __ lw(a0, MemOperand(fp, parameter_count_offset)); |
| 5888 // The parameter count above includes the receiver for the arguments passed to |
| 5889 // the deoptimization handler. Subtract the receiver for the parameter count |
| 5890 // for the call. |
| 5891 __ Subu(a0, a0, 1); |
| 5892 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5893 ParameterCount argument_count(a0); |
| 5894 __ InvokeFunction( |
| 5895 a1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 5896 } |
| 5897 |
| 5898 |
| 5833 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5899 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5834 if (masm->isolate()->function_entry_hook() != NULL) { | 5900 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5835 AllowStubCallsScope allow_stub_calls(masm, true); | 5901 AllowStubCallsScope allow_stub_calls(masm, true); |
| 5836 ProfileEntryHookStub stub; | 5902 ProfileEntryHookStub stub; |
| 5837 __ push(ra); | 5903 __ push(ra); |
| 5838 __ CallStub(&stub); | 5904 __ CallStub(&stub); |
| 5839 __ pop(ra); | 5905 __ pop(ra); |
| 5840 } | 5906 } |
| 5841 } | 5907 } |
| 5842 | 5908 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5974 __ Addu(a3, a3, Operand(1)); | 6040 __ Addu(a3, a3, Operand(1)); |
| 5975 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); | 6041 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5976 | 6042 |
| 5977 if (FLAG_debug_code) { | 6043 if (FLAG_debug_code) { |
| 5978 __ lw(t1, FieldMemOperand(t1, 0)); | 6044 __ lw(t1, FieldMemOperand(t1, 0)); |
| 5979 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 6045 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
| 5980 __ Assert(eq, kExpectedAllocationSiteInCell, t1, Operand(at)); | 6046 __ Assert(eq, kExpectedAllocationSiteInCell, t1, Operand(at)); |
| 5981 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); | 6047 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5982 } | 6048 } |
| 5983 | 6049 |
| 5984 // Save the resulting elements kind in type info | 6050 // Save the resulting elements kind in type info. We can't just store a3 |
| 5985 __ SmiTag(a3); | 6051 // in the AllocationSite::transition_info field because elements kind is |
| 5986 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); | 6052 // restricted to a portion of the field...upper bits need to be left alone. |
| 5987 __ sw(a3, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); | 6053 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5988 __ SmiUntag(a3); | 6054 __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); |
| 6055 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); |
| 6056 __ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); |
| 6057 |
| 5989 | 6058 |
| 5990 __ bind(&normal_sequence); | 6059 __ bind(&normal_sequence); |
| 5991 int last_index = GetSequenceIndexFromFastElementsKind( | 6060 int last_index = GetSequenceIndexFromFastElementsKind( |
| 5992 TERMINAL_FAST_ELEMENTS_KIND); | 6061 TERMINAL_FAST_ELEMENTS_KIND); |
| 5993 for (int i = 0; i <= last_index; ++i) { | 6062 for (int i = 0; i <= last_index; ++i) { |
| 5994 Label next; | 6063 Label next; |
| 5995 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 6064 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
| 5996 __ Branch(&next, ne, a3, Operand(kind)); | 6065 __ Branch(&next, ne, a3, Operand(kind)); |
| 5997 ArraySingleArgumentConstructorStub stub(kind); | 6066 ArraySingleArgumentConstructorStub stub(kind); |
| 5998 __ TailCallStub(&stub); | 6067 __ TailCallStub(&stub); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6120 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 6189 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 6121 | 6190 |
| 6122 // If the type cell is undefined, or contains anything other than an | 6191 // If the type cell is undefined, or contains anything other than an |
| 6123 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 6192 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| 6124 __ lw(t0, FieldMemOperand(a3, 0)); | 6193 __ lw(t0, FieldMemOperand(a3, 0)); |
| 6125 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 6194 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
| 6126 __ Branch(&no_info, ne, t0, Operand(at)); | 6195 __ Branch(&no_info, ne, t0, Operand(at)); |
| 6127 | 6196 |
| 6128 __ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset)); | 6197 __ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset)); |
| 6129 __ SmiUntag(a3); | 6198 __ SmiUntag(a3); |
| 6199 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 6200 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); |
| 6130 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 6201 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 6131 | 6202 |
| 6132 __ bind(&no_info); | 6203 __ bind(&no_info); |
| 6133 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 6204 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 6134 } | 6205 } |
| 6135 | 6206 |
| 6136 | 6207 |
| 6137 void InternalArrayConstructorStub::GenerateCase( | 6208 void InternalArrayConstructorStub::GenerateCase( |
| 6138 MacroAssembler* masm, ElementsKind kind) { | 6209 MacroAssembler* masm, ElementsKind kind) { |
| 6139 Label not_zero_case, not_one_case; | 6210 Label not_zero_case, not_one_case; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6215 __ bind(&fast_elements_case); | 6286 __ bind(&fast_elements_case); |
| 6216 GenerateCase(masm, FAST_ELEMENTS); | 6287 GenerateCase(masm, FAST_ELEMENTS); |
| 6217 } | 6288 } |
| 6218 | 6289 |
| 6219 | 6290 |
| 6220 #undef __ | 6291 #undef __ |
| 6221 | 6292 |
| 6222 } } // namespace v8::internal | 6293 } } // namespace v8::internal |
| 6223 | 6294 |
| 6224 #endif // V8_TARGET_ARCH_MIPS | 6295 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |