OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 __ j(not_zero, &slow_case); | 3152 __ j(not_zero, &slow_case); |
3153 | 3153 |
3154 // Check that both indices are valid. | 3154 // Check that both indices are valid. |
3155 __ mov(temp, FieldOperand(object, JSArray::kLengthOffset)); | 3155 __ mov(temp, FieldOperand(object, JSArray::kLengthOffset)); |
3156 __ cmp(temp, Operand(index_1)); | 3156 __ cmp(temp, Operand(index_1)); |
3157 __ j(below_equal, &slow_case); | 3157 __ j(below_equal, &slow_case); |
3158 __ cmp(temp, Operand(index_2)); | 3158 __ cmp(temp, Operand(index_2)); |
3159 __ j(below_equal, &slow_case); | 3159 __ j(below_equal, &slow_case); |
3160 | 3160 |
3161 // Bring addresses into index1 and index2. | 3161 // Bring addresses into index1 and index2. |
3162 __ lea(index_1, CodeGenerator::FixedArrayElementOperand(elements, index_1)); | 3162 __ lea(index_1, FixedArrayElementOperand(elements, index_1)); |
3163 __ lea(index_2, CodeGenerator::FixedArrayElementOperand(elements, index_2)); | 3163 __ lea(index_2, FixedArrayElementOperand(elements, index_2)); |
3164 | 3164 |
3165 // Swap elements. Use object and temp as scratch registers. | 3165 // Swap elements. Use object and temp as scratch registers. |
3166 __ mov(object, Operand(index_1, 0)); | 3166 __ mov(object, Operand(index_1, 0)); |
3167 __ mov(temp, Operand(index_2, 0)); | 3167 __ mov(temp, Operand(index_2, 0)); |
3168 __ mov(Operand(index_2, 0), object); | 3168 __ mov(Operand(index_2, 0), object); |
3169 __ mov(Operand(index_1, 0), temp); | 3169 __ mov(Operand(index_1, 0), temp); |
3170 | 3170 |
3171 Label new_space; | 3171 Label new_space; |
3172 __ InNewSpace(elements, temp, equal, &new_space); | 3172 __ InNewSpace(elements, temp, equal, &new_space); |
3173 | 3173 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3213 __ mov(cache, | 3213 __ mov(cache, |
3214 FieldOperand(cache, GlobalObject::kGlobalContextOffset)); | 3214 FieldOperand(cache, GlobalObject::kGlobalContextOffset)); |
3215 __ mov(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | 3215 __ mov(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); |
3216 __ mov(cache, | 3216 __ mov(cache, |
3217 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | 3217 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); |
3218 | 3218 |
3219 Label done, not_found; | 3219 Label done, not_found; |
3220 // tmp now holds finger offset as a smi. | 3220 // tmp now holds finger offset as a smi. |
3221 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 3221 ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
3222 __ mov(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset)); | 3222 __ mov(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset)); |
3223 __ cmp(key, CodeGenerator::FixedArrayElementOperand(cache, tmp)); | 3223 __ cmp(key, FixedArrayElementOperand(cache, tmp)); |
3224 __ j(not_equal, ¬_found); | 3224 __ j(not_equal, ¬_found); |
3225 | 3225 |
3226 __ mov(eax, CodeGenerator::FixedArrayElementOperand(cache, tmp, 1)); | 3226 __ mov(eax, FixedArrayElementOperand(cache, tmp, 1)); |
3227 __ jmp(&done); | 3227 __ jmp(&done); |
3228 | 3228 |
3229 __ bind(¬_found); | 3229 __ bind(¬_found); |
3230 // Call runtime to perform the lookup. | 3230 // Call runtime to perform the lookup. |
3231 __ push(cache); | 3231 __ push(cache); |
3232 __ push(key); | 3232 __ push(key); |
3233 __ CallRuntime(Runtime::kGetFromCache, 2); | 3233 __ CallRuntime(Runtime::kGetFromCache, 2); |
3234 | 3234 |
3235 __ bind(&done); | 3235 __ bind(&done); |
3236 context()->Plug(eax); | 3236 context()->Plug(eax); |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4348 // And return. | 4348 // And return. |
4349 __ ret(0); | 4349 __ ret(0); |
4350 } | 4350 } |
4351 | 4351 |
4352 | 4352 |
4353 #undef __ | 4353 #undef __ |
4354 | 4354 |
4355 } } // namespace v8::internal | 4355 } } // namespace v8::internal |
4356 | 4356 |
4357 #endif // V8_TARGET_ARCH_IA32 | 4357 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |