| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 Isolate* isolate, | 106 Isolate* isolate, |
| 107 CodeStubInterfaceDescriptor* descriptor) { | 107 CodeStubInterfaceDescriptor* descriptor) { |
| 108 static Register registers[] = { r1, r0 }; | 108 static Register registers[] = { r1, r0 }; |
| 109 descriptor->register_param_count_ = 2; | 109 descriptor->register_param_count_ = 2; |
| 110 descriptor->register_params_ = registers; | 110 descriptor->register_params_ = registers; |
| 111 descriptor->deoptimization_handler_ = | 111 descriptor->deoptimization_handler_ = |
| 112 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 112 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( |
| 117 Isolate* isolate, |
| 118 CodeStubInterfaceDescriptor* descriptor) { |
| 119 static Register registers[] = { r1, r0 }; |
| 120 descriptor->register_param_count_ = 2; |
| 121 descriptor->register_params_ = registers; |
| 122 descriptor->deoptimization_handler_ = |
| 123 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 124 } |
| 125 |
| 126 |
| 116 void LoadFieldStub::InitializeInterfaceDescriptor( | 127 void LoadFieldStub::InitializeInterfaceDescriptor( |
| 117 Isolate* isolate, | 128 Isolate* isolate, |
| 118 CodeStubInterfaceDescriptor* descriptor) { | 129 CodeStubInterfaceDescriptor* descriptor) { |
| 119 static Register registers[] = { r0 }; | 130 static Register registers[] = { r0 }; |
| 120 descriptor->register_param_count_ = 1; | 131 descriptor->register_param_count_ = 1; |
| 121 descriptor->register_params_ = registers; | 132 descriptor->register_params_ = registers; |
| 122 descriptor->deoptimization_handler_ = NULL; | 133 descriptor->deoptimization_handler_ = NULL; |
| 123 } | 134 } |
| 124 | 135 |
| 125 | 136 |
| 126 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( | 137 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( |
| 127 Isolate* isolate, | 138 Isolate* isolate, |
| 128 CodeStubInterfaceDescriptor* descriptor) { | 139 CodeStubInterfaceDescriptor* descriptor) { |
| 129 static Register registers[] = { r1 }; | 140 static Register registers[] = { r1 }; |
| 130 descriptor->register_param_count_ = 1; | 141 descriptor->register_param_count_ = 1; |
| 131 descriptor->register_params_ = registers; | 142 descriptor->register_params_ = registers; |
| 132 descriptor->deoptimization_handler_ = NULL; | 143 descriptor->deoptimization_handler_ = NULL; |
| 133 } | 144 } |
| 134 | 145 |
| 135 | 146 |
| 147 void KeyedArrayCallStub::InitializeInterfaceDescriptor( |
| 148 Isolate* isolate, |
| 149 CodeStubInterfaceDescriptor* descriptor) { |
| 150 static Register registers[] = { r2 }; |
| 151 descriptor->register_param_count_ = 1; |
| 152 descriptor->register_params_ = registers; |
| 153 descriptor->continuation_type_ = TAIL_CALL_CONTINUATION; |
| 154 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 155 descriptor->deoptimization_handler_ = |
| 156 FUNCTION_ADDR(KeyedCallIC_MissFromStubFailure); |
| 157 } |
| 158 |
| 159 |
| 136 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( | 160 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( |
| 137 Isolate* isolate, | 161 Isolate* isolate, |
| 138 CodeStubInterfaceDescriptor* descriptor) { | 162 CodeStubInterfaceDescriptor* descriptor) { |
| 139 static Register registers[] = { r2, r1, r0 }; | 163 static Register registers[] = { r2, r1, r0 }; |
| 140 descriptor->register_param_count_ = 3; | 164 descriptor->register_param_count_ = 3; |
| 141 descriptor->register_params_ = registers; | 165 descriptor->register_params_ = registers; |
| 142 descriptor->deoptimization_handler_ = | 166 descriptor->deoptimization_handler_ = |
| 143 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); | 167 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); |
| 144 } | 168 } |
| 145 | 169 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 206 |
| 183 | 207 |
| 184 static void InitializeArrayConstructorDescriptor( | 208 static void InitializeArrayConstructorDescriptor( |
| 185 Isolate* isolate, | 209 Isolate* isolate, |
| 186 CodeStubInterfaceDescriptor* descriptor, | 210 CodeStubInterfaceDescriptor* descriptor, |
| 187 int constant_stack_parameter_count) { | 211 int constant_stack_parameter_count) { |
| 188 // register state | 212 // register state |
| 189 // r0 -- number of arguments | 213 // r0 -- number of arguments |
| 190 // r1 -- function | 214 // r1 -- function |
| 191 // r2 -- type info cell with elements kind | 215 // r2 -- type info cell with elements kind |
| 192 static Register registers[] = { r1, r2 }; | 216 static Register registers_variable_args[] = { r1, r2, r0 }; |
| 193 descriptor->register_param_count_ = 2; | 217 static Register registers_no_args[] = { r1, r2 }; |
| 194 if (constant_stack_parameter_count != 0) { | 218 |
| 219 if (constant_stack_parameter_count == 0) { |
| 220 descriptor->register_param_count_ = 2; |
| 221 descriptor->register_params_ = registers_no_args; |
| 222 } else { |
| 195 // stack param count needs (constructor pointer, and single argument) | 223 // stack param count needs (constructor pointer, and single argument) |
| 224 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 196 descriptor->stack_parameter_count_ = r0; | 225 descriptor->stack_parameter_count_ = r0; |
| 226 descriptor->register_param_count_ = 3; |
| 227 descriptor->register_params_ = registers_variable_args; |
| 197 } | 228 } |
| 229 |
| 198 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 230 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
| 199 descriptor->register_params_ = registers; | |
| 200 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 231 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
| 201 descriptor->deoptimization_handler_ = | 232 descriptor->deoptimization_handler_ = |
| 202 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; | 233 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; |
| 203 } | 234 } |
| 204 | 235 |
| 205 | 236 |
| 206 static void InitializeInternalArrayConstructorDescriptor( | 237 static void InitializeInternalArrayConstructorDescriptor( |
| 207 Isolate* isolate, | 238 Isolate* isolate, |
| 208 CodeStubInterfaceDescriptor* descriptor, | 239 CodeStubInterfaceDescriptor* descriptor, |
| 209 int constant_stack_parameter_count) { | 240 int constant_stack_parameter_count) { |
| 210 // register state | 241 // register state |
| 211 // r0 -- number of arguments | 242 // r0 -- number of arguments |
| 212 // r1 -- constructor function | 243 // r1 -- constructor function |
| 213 static Register registers[] = { r1 }; | 244 static Register registers_variable_args[] = { r1, r0 }; |
| 214 descriptor->register_param_count_ = 1; | 245 static Register registers_no_args[] = { r1 }; |
| 215 | 246 |
| 216 if (constant_stack_parameter_count != 0) { | 247 if (constant_stack_parameter_count == 0) { |
| 248 descriptor->register_param_count_ = 1; |
| 249 descriptor->register_params_ = registers_no_args; |
| 250 } else { |
| 217 // stack param count needs (constructor pointer, and single argument) | 251 // stack param count needs (constructor pointer, and single argument) |
| 252 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 218 descriptor->stack_parameter_count_ = r0; | 253 descriptor->stack_parameter_count_ = r0; |
| 254 descriptor->register_param_count_ = 2; |
| 255 descriptor->register_params_ = registers_variable_args; |
| 219 } | 256 } |
| 257 |
| 220 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 258 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
| 221 descriptor->register_params_ = registers; | |
| 222 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 259 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
| 223 descriptor->deoptimization_handler_ = | 260 descriptor->deoptimization_handler_ = |
| 224 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; | 261 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; |
| 225 } | 262 } |
| 226 | 263 |
| 227 | 264 |
| 228 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 265 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 229 Isolate* isolate, | 266 Isolate* isolate, |
| 230 CodeStubInterfaceDescriptor* descriptor) { | 267 CodeStubInterfaceDescriptor* descriptor) { |
| 231 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); | 268 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); |
| (...skipping 5441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5673 if (function_mode_ == JS_FUNCTION_STUB_MODE) { | 5710 if (function_mode_ == JS_FUNCTION_STUB_MODE) { |
| 5674 __ add(r1, r1, Operand(1)); | 5711 __ add(r1, r1, Operand(1)); |
| 5675 } | 5712 } |
| 5676 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5713 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5677 __ mov(r1, Operand(r1, LSL, kPointerSizeLog2)); | 5714 __ mov(r1, Operand(r1, LSL, kPointerSizeLog2)); |
| 5678 __ add(sp, sp, r1); | 5715 __ add(sp, sp, r1); |
| 5679 __ Ret(); | 5716 __ Ret(); |
| 5680 } | 5717 } |
| 5681 | 5718 |
| 5682 | 5719 |
| 5720 void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) { |
| 5721 CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); |
| 5722 __ Call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
| 5723 __ mov(r1, r0); |
| 5724 int parameter_count_offset = |
| 5725 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 5726 __ ldr(r0, MemOperand(fp, parameter_count_offset)); |
| 5727 // The parameter count above includes the receiver for the arguments passed to |
| 5728 // the deoptimization handler. Subtract the receiver for the parameter count |
| 5729 // for the call. |
| 5730 __ sub(r0, r0, Operand(1)); |
| 5731 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5732 ParameterCount argument_count(r0); |
| 5733 __ InvokeFunction( |
| 5734 r1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 5735 } |
| 5736 |
| 5737 |
| 5683 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5738 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5684 if (masm->isolate()->function_entry_hook() != NULL) { | 5739 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5685 PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize); | 5740 PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize); |
| 5686 AllowStubCallsScope allow_stub_calls(masm, true); | 5741 AllowStubCallsScope allow_stub_calls(masm, true); |
| 5687 ProfileEntryHookStub stub; | 5742 ProfileEntryHookStub stub; |
| 5688 __ push(lr); | 5743 __ push(lr); |
| 5689 __ CallStub(&stub); | 5744 __ CallStub(&stub); |
| 5690 __ pop(lr); | 5745 __ pop(lr); |
| 5691 } | 5746 } |
| 5692 } | 5747 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5830 __ add(r3, r3, Operand(1)); | 5885 __ add(r3, r3, Operand(1)); |
| 5831 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); | 5886 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); |
| 5832 | 5887 |
| 5833 if (FLAG_debug_code) { | 5888 if (FLAG_debug_code) { |
| 5834 __ ldr(r5, FieldMemOperand(r5, 0)); | 5889 __ ldr(r5, FieldMemOperand(r5, 0)); |
| 5835 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 5890 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
| 5836 __ Assert(eq, kExpectedAllocationSiteInCell); | 5891 __ Assert(eq, kExpectedAllocationSiteInCell); |
| 5837 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); | 5892 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); |
| 5838 } | 5893 } |
| 5839 | 5894 |
| 5840 // Save the resulting elements kind in type info | 5895 // Save the resulting elements kind in type info. We can't just store r3 |
| 5841 __ SmiTag(r3); | 5896 // in the AllocationSite::transition_info field because elements kind is |
| 5842 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); | 5897 // restricted to a portion of the field...upper bits need to be left alone. |
| 5843 __ str(r3, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5898 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5844 __ SmiUntag(r3); | 5899 __ ldr(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); |
| 5900 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); |
| 5901 __ str(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); |
| 5845 | 5902 |
| 5846 __ bind(&normal_sequence); | 5903 __ bind(&normal_sequence); |
| 5847 int last_index = GetSequenceIndexFromFastElementsKind( | 5904 int last_index = GetSequenceIndexFromFastElementsKind( |
| 5848 TERMINAL_FAST_ELEMENTS_KIND); | 5905 TERMINAL_FAST_ELEMENTS_KIND); |
| 5849 for (int i = 0; i <= last_index; ++i) { | 5906 for (int i = 0; i <= last_index; ++i) { |
| 5850 Label next; | 5907 Label next; |
| 5851 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5908 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
| 5852 __ cmp(r3, Operand(kind)); | 5909 __ cmp(r3, Operand(kind)); |
| 5853 __ b(ne, &next); | 5910 __ b(ne, &next); |
| 5854 ArraySingleArgumentConstructorStub stub(kind); | 5911 ArraySingleArgumentConstructorStub stub(kind); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5976 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); | 6033 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); |
| 5977 | 6034 |
| 5978 // If the type cell is undefined, or contains anything other than an | 6035 // If the type cell is undefined, or contains anything other than an |
| 5979 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 6036 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| 5980 __ ldr(r4, FieldMemOperand(r3, 0)); | 6037 __ ldr(r4, FieldMemOperand(r3, 0)); |
| 5981 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); | 6038 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); |
| 5982 __ b(ne, &no_info); | 6039 __ b(ne, &no_info); |
| 5983 | 6040 |
| 5984 __ ldr(r3, FieldMemOperand(r3, AllocationSite::kTransitionInfoOffset)); | 6041 __ ldr(r3, FieldMemOperand(r3, AllocationSite::kTransitionInfoOffset)); |
| 5985 __ SmiUntag(r3); | 6042 __ SmiUntag(r3); |
| 6043 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 6044 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); |
| 5986 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 6045 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 5987 | 6046 |
| 5988 __ bind(&no_info); | 6047 __ bind(&no_info); |
| 5989 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 6048 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 5990 } | 6049 } |
| 5991 | 6050 |
| 5992 | 6051 |
| 5993 void InternalArrayConstructorStub::GenerateCase( | 6052 void InternalArrayConstructorStub::GenerateCase( |
| 5994 MacroAssembler* masm, ElementsKind kind) { | 6053 MacroAssembler* masm, ElementsKind kind) { |
| 5995 Label not_zero_case, not_one_case; | 6054 Label not_zero_case, not_one_case; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6073 __ bind(&fast_elements_case); | 6132 __ bind(&fast_elements_case); |
| 6074 GenerateCase(masm, FAST_ELEMENTS); | 6133 GenerateCase(masm, FAST_ELEMENTS); |
| 6075 } | 6134 } |
| 6076 | 6135 |
| 6077 | 6136 |
| 6078 #undef __ | 6137 #undef __ |
| 6079 | 6138 |
| 6080 } } // namespace v8::internal | 6139 } } // namespace v8::internal |
| 6081 | 6140 |
| 6082 #endif // V8_TARGET_ARCH_ARM | 6141 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |