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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 Isolate* isolate, | 127 Isolate* isolate, |
128 CodeStubInterfaceDescriptor* descriptor) { | 128 CodeStubInterfaceDescriptor* descriptor) { |
129 static Register registers[] = { r1, r0 }; | 129 static Register registers[] = { r1, r0 }; |
130 descriptor->register_param_count_ = 2; | 130 descriptor->register_param_count_ = 2; |
131 descriptor->register_params_ = registers; | 131 descriptor->register_params_ = registers; |
132 descriptor->deoptimization_handler_ = | 132 descriptor->deoptimization_handler_ = |
133 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 133 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
134 } | 134 } |
135 | 135 |
136 | 136 |
| 137 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
| 138 Isolate* isolate, |
| 139 CodeStubInterfaceDescriptor* descriptor) { |
| 140 static Register registers[] = { r2, r1, r0 }; |
| 141 descriptor->register_param_count_ = 3; |
| 142 descriptor->register_params_ = registers; |
| 143 descriptor->deoptimization_handler_ = |
| 144 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; |
| 145 } |
| 146 |
| 147 |
137 void LoadFieldStub::InitializeInterfaceDescriptor( | 148 void LoadFieldStub::InitializeInterfaceDescriptor( |
138 Isolate* isolate, | 149 Isolate* isolate, |
139 CodeStubInterfaceDescriptor* descriptor) { | 150 CodeStubInterfaceDescriptor* descriptor) { |
140 static Register registers[] = { r0 }; | 151 static Register registers[] = { r0 }; |
141 descriptor->register_param_count_ = 1; | 152 descriptor->register_param_count_ = 1; |
142 descriptor->register_params_ = registers; | 153 descriptor->register_params_ = registers; |
143 descriptor->deoptimization_handler_ = NULL; | 154 descriptor->deoptimization_handler_ = NULL; |
144 } | 155 } |
145 | 156 |
146 | 157 |
(...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 // (9) Sliced string. Replace subject with parent. Go to (4). | 2988 // (9) Sliced string. Replace subject with parent. Go to (4). |
2978 // Load offset into r9 and replace subject string with parent. | 2989 // Load offset into r9 and replace subject string with parent. |
2979 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 2990 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
2980 __ SmiUntag(r9); | 2991 __ SmiUntag(r9); |
2981 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 2992 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
2982 __ jmp(&check_underlying); // Go to (4). | 2993 __ jmp(&check_underlying); // Go to (4). |
2983 #endif // V8_INTERPRETED_REGEXP | 2994 #endif // V8_INTERPRETED_REGEXP |
2984 } | 2995 } |
2985 | 2996 |
2986 | 2997 |
2987 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { | |
2988 const int kMaxInlineLength = 100; | |
2989 Label slowcase; | |
2990 Label done; | |
2991 Factory* factory = masm->isolate()->factory(); | |
2992 | |
2993 __ ldr(r1, MemOperand(sp, kPointerSize * 2)); | |
2994 STATIC_ASSERT(kSmiTag == 0); | |
2995 STATIC_ASSERT(kSmiTagSize == 1); | |
2996 __ JumpIfNotSmi(r1, &slowcase); | |
2997 __ cmp(r1, Operand(Smi::FromInt(kMaxInlineLength))); | |
2998 __ b(hi, &slowcase); | |
2999 // Smi-tagging is equivalent to multiplying by 2. | |
3000 // Allocate RegExpResult followed by FixedArray with size in ebx. | |
3001 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] | |
3002 // Elements: [Map][Length][..elements..] | |
3003 // Size of JSArray with two in-object properties and the header of a | |
3004 // FixedArray. | |
3005 int objects_size = | |
3006 (JSRegExpResult::kSize + FixedArray::kHeaderSize) / kPointerSize; | |
3007 __ SmiUntag(r5, r1); | |
3008 __ add(r2, r5, Operand(objects_size)); | |
3009 __ Allocate( | |
3010 r2, // In: Size, in words. | |
3011 r0, // Out: Start of allocation (tagged). | |
3012 r3, // Scratch register. | |
3013 r4, // Scratch register. | |
3014 &slowcase, | |
3015 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | |
3016 // r0: Start of allocated area, object-tagged. | |
3017 // r1: Number of elements in array, as smi. | |
3018 // r5: Number of elements, untagged. | |
3019 | |
3020 // Set JSArray map to global.regexp_result_map(). | |
3021 // Set empty properties FixedArray. | |
3022 // Set elements to point to FixedArray allocated right after the JSArray. | |
3023 // Interleave operations for better latency. | |
3024 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
3025 __ add(r3, r0, Operand(JSRegExpResult::kSize)); | |
3026 __ mov(r4, Operand(factory->empty_fixed_array())); | |
3027 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset)); | |
3028 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | |
3029 __ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX)); | |
3030 __ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | |
3031 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | |
3032 | |
3033 // Set input, index and length fields from arguments. | |
3034 __ ldr(r1, MemOperand(sp, kPointerSize * 0)); | |
3035 __ ldr(r2, MemOperand(sp, kPointerSize * 1)); | |
3036 __ ldr(r6, MemOperand(sp, kPointerSize * 2)); | |
3037 __ str(r1, FieldMemOperand(r0, JSRegExpResult::kInputOffset)); | |
3038 __ str(r2, FieldMemOperand(r0, JSRegExpResult::kIndexOffset)); | |
3039 __ str(r6, FieldMemOperand(r0, JSArray::kLengthOffset)); | |
3040 | |
3041 // Fill out the elements FixedArray. | |
3042 // r0: JSArray, tagged. | |
3043 // r3: FixedArray, tagged. | |
3044 // r5: Number of elements in array, untagged. | |
3045 | |
3046 // Set map. | |
3047 __ mov(r2, Operand(factory->fixed_array_map())); | |
3048 __ str(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | |
3049 // Set FixedArray length. | |
3050 __ SmiTag(r6, r5); | |
3051 __ str(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); | |
3052 // Fill contents of fixed-array with undefined. | |
3053 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | |
3054 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
3055 // Fill fixed array elements with undefined. | |
3056 // r0: JSArray, tagged. | |
3057 // r2: undefined. | |
3058 // r3: Start of elements in FixedArray. | |
3059 // r5: Number of elements to fill. | |
3060 Label loop; | |
3061 __ cmp(r5, Operand::Zero()); | |
3062 __ bind(&loop); | |
3063 __ b(le, &done); // Jump if r5 is negative or zero. | |
3064 __ sub(r5, r5, Operand(1), SetCC); | |
3065 __ str(r2, MemOperand(r3, r5, LSL, kPointerSizeLog2)); | |
3066 __ jmp(&loop); | |
3067 | |
3068 __ bind(&done); | |
3069 __ add(sp, sp, Operand(3 * kPointerSize)); | |
3070 __ Ret(); | |
3071 | |
3072 __ bind(&slowcase); | |
3073 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1); | |
3074 } | |
3075 | |
3076 | |
3077 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 2998 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
3078 // Cache the called function in a global property cell. Cache states | 2999 // Cache the called function in a global property cell. Cache states |
3079 // are uninitialized, monomorphic (indicated by a JSFunction), and | 3000 // are uninitialized, monomorphic (indicated by a JSFunction), and |
3080 // megamorphic. | 3001 // megamorphic. |
3081 // r0 : number of arguments to the construct function | 3002 // r0 : number of arguments to the construct function |
3082 // r1 : the function to call | 3003 // r1 : the function to call |
3083 // r2 : cache cell for call target | 3004 // r2 : cache cell for call target |
3084 Label initialize, done, miss, megamorphic, not_array_function; | 3005 Label initialize, done, miss, megamorphic, not_array_function; |
3085 | 3006 |
3086 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 3007 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5565 restore_context ? | 5486 restore_context ? |
5566 &context_restore_operand : NULL); | 5487 &context_restore_operand : NULL); |
5567 } | 5488 } |
5568 | 5489 |
5569 | 5490 |
5570 #undef __ | 5491 #undef __ |
5571 | 5492 |
5572 } } // namespace v8::internal | 5493 } } // namespace v8::internal |
5573 | 5494 |
5574 #endif // V8_TARGET_ARCH_ARM | 5495 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |