| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 Isolate* isolate, | 128 Isolate* isolate, |
| 129 CodeStubInterfaceDescriptor* descriptor) { | 129 CodeStubInterfaceDescriptor* descriptor) { |
| 130 static Register registers[] = {a1, a0 }; | 130 static Register registers[] = {a1, a0 }; |
| 131 descriptor->register_param_count_ = 2; | 131 descriptor->register_param_count_ = 2; |
| 132 descriptor->register_params_ = registers; | 132 descriptor->register_params_ = registers; |
| 133 descriptor->deoptimization_handler_ = | 133 descriptor->deoptimization_handler_ = |
| 134 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 134 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 135 } | 135 } |
| 136 | 136 |
| 137 | 137 |
| 138 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
| 139 Isolate* isolate, |
| 140 CodeStubInterfaceDescriptor* descriptor) { |
| 141 static Register registers[] = { a2, a1, a0 }; |
| 142 descriptor->register_param_count_ = 3; |
| 143 descriptor->register_params_ = registers; |
| 144 descriptor->deoptimization_handler_ = |
| 145 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; |
| 146 } |
| 147 |
| 148 |
| 138 void LoadFieldStub::InitializeInterfaceDescriptor( | 149 void LoadFieldStub::InitializeInterfaceDescriptor( |
| 139 Isolate* isolate, | 150 Isolate* isolate, |
| 140 CodeStubInterfaceDescriptor* descriptor) { | 151 CodeStubInterfaceDescriptor* descriptor) { |
| 141 static Register registers[] = { a0 }; | 152 static Register registers[] = { a0 }; |
| 142 descriptor->register_param_count_ = 1; | 153 descriptor->register_param_count_ = 1; |
| 143 descriptor->register_params_ = registers; | 154 descriptor->register_params_ = registers; |
| 144 descriptor->deoptimization_handler_ = NULL; | 155 descriptor->deoptimization_handler_ = NULL; |
| 145 } | 156 } |
| 146 | 157 |
| 147 | 158 |
| (...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 // (9) Sliced string. Replace subject with parent. Go to (4). | 3134 // (9) Sliced string. Replace subject with parent. Go to (4). |
| 3124 // Load offset into t0 and replace subject string with parent. | 3135 // Load offset into t0 and replace subject string with parent. |
| 3125 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 3136 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
| 3126 __ sra(t0, t0, kSmiTagSize); | 3137 __ sra(t0, t0, kSmiTagSize); |
| 3127 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 3138 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
| 3128 __ jmp(&check_underlying); // Go to (4). | 3139 __ jmp(&check_underlying); // Go to (4). |
| 3129 #endif // V8_INTERPRETED_REGEXP | 3140 #endif // V8_INTERPRETED_REGEXP |
| 3130 } | 3141 } |
| 3131 | 3142 |
| 3132 | 3143 |
| 3133 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { | |
| 3134 const int kMaxInlineLength = 100; | |
| 3135 Label slowcase; | |
| 3136 Label done; | |
| 3137 __ lw(a1, MemOperand(sp, kPointerSize * 2)); | |
| 3138 STATIC_ASSERT(kSmiTag == 0); | |
| 3139 STATIC_ASSERT(kSmiTagSize == 1); | |
| 3140 __ JumpIfNotSmi(a1, &slowcase); | |
| 3141 __ Branch(&slowcase, hi, a1, Operand(Smi::FromInt(kMaxInlineLength))); | |
| 3142 // Smi-tagging is equivalent to multiplying by 2. | |
| 3143 // Allocate RegExpResult followed by FixedArray with size in ebx. | |
| 3144 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] | |
| 3145 // Elements: [Map][Length][..elements..] | |
| 3146 // Size of JSArray with two in-object properties and the header of a | |
| 3147 // FixedArray. | |
| 3148 int objects_size = | |
| 3149 (JSRegExpResult::kSize + FixedArray::kHeaderSize) / kPointerSize; | |
| 3150 __ srl(t1, a1, kSmiTagSize + kSmiShiftSize); | |
| 3151 __ Addu(a2, t1, Operand(objects_size)); | |
| 3152 __ Allocate( | |
| 3153 a2, // In: Size, in words. | |
| 3154 v0, // Out: Start of allocation (tagged). | |
| 3155 a3, // Scratch register. | |
| 3156 t0, // Scratch register. | |
| 3157 &slowcase, | |
| 3158 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | |
| 3159 // v0: Start of allocated area, object-tagged. | |
| 3160 // a1: Number of elements in array, as smi. | |
| 3161 // t1: Number of elements, untagged. | |
| 3162 | |
| 3163 // Set JSArray map to global.regexp_result_map(). | |
| 3164 // Set empty properties FixedArray. | |
| 3165 // Set elements to point to FixedArray allocated right after the JSArray. | |
| 3166 // Interleave operations for better latency. | |
| 3167 __ lw(a2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
| 3168 __ Addu(a3, v0, Operand(JSRegExpResult::kSize)); | |
| 3169 __ li(t0, Operand(masm->isolate()->factory()->empty_fixed_array())); | |
| 3170 __ lw(a2, FieldMemOperand(a2, GlobalObject::kNativeContextOffset)); | |
| 3171 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); | |
| 3172 __ lw(a2, ContextOperand(a2, Context::REGEXP_RESULT_MAP_INDEX)); | |
| 3173 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | |
| 3174 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); | |
| 3175 | |
| 3176 // Set input, index and length fields from arguments. | |
| 3177 __ lw(a1, MemOperand(sp, kPointerSize * 0)); | |
| 3178 __ lw(a2, MemOperand(sp, kPointerSize * 1)); | |
| 3179 __ lw(t2, MemOperand(sp, kPointerSize * 2)); | |
| 3180 __ sw(a1, FieldMemOperand(v0, JSRegExpResult::kInputOffset)); | |
| 3181 __ sw(a2, FieldMemOperand(v0, JSRegExpResult::kIndexOffset)); | |
| 3182 __ sw(t2, FieldMemOperand(v0, JSArray::kLengthOffset)); | |
| 3183 | |
| 3184 // Fill out the elements FixedArray. | |
| 3185 // v0: JSArray, tagged. | |
| 3186 // a3: FixedArray, tagged. | |
| 3187 // t1: Number of elements in array, untagged. | |
| 3188 | |
| 3189 // Set map. | |
| 3190 __ li(a2, Operand(masm->isolate()->factory()->fixed_array_map())); | |
| 3191 __ sw(a2, FieldMemOperand(a3, HeapObject::kMapOffset)); | |
| 3192 // Set FixedArray length. | |
| 3193 __ sll(t2, t1, kSmiTagSize); | |
| 3194 __ sw(t2, FieldMemOperand(a3, FixedArray::kLengthOffset)); | |
| 3195 // Fill contents of fixed-array with undefined. | |
| 3196 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | |
| 3197 __ Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 3198 // Fill fixed array elements with undefined. | |
| 3199 // v0: JSArray, tagged. | |
| 3200 // a2: undefined. | |
| 3201 // a3: Start of elements in FixedArray. | |
| 3202 // t1: Number of elements to fill. | |
| 3203 Label loop; | |
| 3204 __ sll(t1, t1, kPointerSizeLog2); // Convert num elements to num bytes. | |
| 3205 __ addu(t1, t1, a3); // Point past last element to store. | |
| 3206 __ bind(&loop); | |
| 3207 __ Branch(&done, ge, a3, Operand(t1)); // Break when a3 past end of elem. | |
| 3208 __ sw(a2, MemOperand(a3)); | |
| 3209 __ Branch(&loop, USE_DELAY_SLOT); | |
| 3210 __ addiu(a3, a3, kPointerSize); // In branch delay slot. | |
| 3211 | |
| 3212 __ bind(&done); | |
| 3213 __ DropAndRet(3); | |
| 3214 | |
| 3215 __ bind(&slowcase); | |
| 3216 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1); | |
| 3217 } | |
| 3218 | |
| 3219 | |
| 3220 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 3144 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
| 3221 // Cache the called function in a global property cell. Cache states | 3145 // Cache the called function in a global property cell. Cache states |
| 3222 // are uninitialized, monomorphic (indicated by a JSFunction), and | 3146 // are uninitialized, monomorphic (indicated by a JSFunction), and |
| 3223 // megamorphic. | 3147 // megamorphic. |
| 3224 // a0 : number of arguments to the construct function | 3148 // a0 : number of arguments to the construct function |
| 3225 // a1 : the function to call | 3149 // a1 : the function to call |
| 3226 // a2 : cache cell for call target | 3150 // a2 : cache cell for call target |
| 3227 Label initialize, done, miss, megamorphic, not_array_function; | 3151 Label initialize, done, miss, megamorphic, not_array_function; |
| 3228 | 3152 |
| 3229 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 3153 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| (...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5733 restore_context ? | 5657 restore_context ? |
| 5734 &context_restore_operand : NULL); | 5658 &context_restore_operand : NULL); |
| 5735 } | 5659 } |
| 5736 | 5660 |
| 5737 | 5661 |
| 5738 #undef __ | 5662 #undef __ |
| 5739 | 5663 |
| 5740 } } // namespace v8::internal | 5664 } } // namespace v8::internal |
| 5741 | 5665 |
| 5742 #endif // V8_TARGET_ARCH_MIPS | 5666 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |