| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 __ bind(&check_optimized); | 286 __ bind(&check_optimized); |
| 287 | 287 |
| 288 __ IncrementCounter(counters->fast_new_closure_try_optimized(), 1); | 288 __ IncrementCounter(counters->fast_new_closure_try_optimized(), 1); |
| 289 | 289 |
| 290 // ecx holds native context, ebx points to fixed array of 3-element entries | 290 // ecx holds native context, ebx points to fixed array of 3-element entries |
| 291 // (native context, optimized code, literals). | 291 // (native context, optimized code, literals). |
| 292 // Map must never be empty, so check the first elements. | 292 // Map must never be empty, so check the first elements. |
| 293 Label install_optimized; | 293 Label install_optimized; |
| 294 // Speculatively move code object into edx. | 294 // Speculatively move code object into edx. |
| 295 __ mov(edx, FieldOperand(ebx, FixedArray::kHeaderSize + kPointerSize)); | 295 __ mov(edx, FieldOperand(ebx, SharedFunctionInfo::kFirstCodeSlot)); |
| 296 __ cmp(ecx, FieldOperand(ebx, FixedArray::kHeaderSize)); | 296 __ cmp(ecx, FieldOperand(ebx, SharedFunctionInfo::kFirstContextSlot)); |
| 297 __ j(equal, &install_optimized); | 297 __ j(equal, &install_optimized); |
| 298 | 298 |
| 299 // Iterate through the rest of map backwards. edx holds an index as a Smi. | 299 // Iterate through the rest of map backwards. edx holds an index as a Smi. |
| 300 Label loop; | 300 Label loop; |
| 301 Label restore; | 301 Label restore; |
| 302 __ mov(edx, FieldOperand(ebx, FixedArray::kLengthOffset)); | 302 __ mov(edx, FieldOperand(ebx, FixedArray::kLengthOffset)); |
| 303 __ bind(&loop); | 303 __ bind(&loop); |
| 304 // Do not double check first entry. | 304 // Do not double check first entry. |
| 305 __ cmp(edx, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 305 __ cmp(edx, Immediate(Smi::FromInt(SharedFunctionInfo::kSecondEntryIndex))); |
| 306 __ j(equal, &restore); | 306 __ j(equal, &restore); |
| 307 __ sub(edx, Immediate(Smi::FromInt( | 307 __ sub(edx, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
| 308 SharedFunctionInfo::kEntryLength))); // Skip an entry. | |
| 309 __ cmp(ecx, CodeGenerator::FixedArrayElementOperand(ebx, edx, 0)); | 308 __ cmp(ecx, CodeGenerator::FixedArrayElementOperand(ebx, edx, 0)); |
| 310 __ j(not_equal, &loop, Label::kNear); | 309 __ j(not_equal, &loop, Label::kNear); |
| 311 // Hit: fetch the optimized code. | 310 // Hit: fetch the optimized code. |
| 312 __ mov(edx, CodeGenerator::FixedArrayElementOperand(ebx, edx, 1)); | 311 __ mov(edx, CodeGenerator::FixedArrayElementOperand(ebx, edx, 1)); |
| 313 | 312 |
| 314 __ bind(&install_optimized); | 313 __ bind(&install_optimized); |
| 315 __ IncrementCounter(counters->fast_new_closure_install_optimized(), 1); | 314 __ IncrementCounter(counters->fast_new_closure_install_optimized(), 1); |
| 316 | 315 |
| 317 // TODO(fschneider): Idea: store proper code pointers in the optimized code | 316 // TODO(fschneider): Idea: store proper code pointers in the optimized code |
| 318 // map and either unmangle them on marking or do nothing as the whole map is | 317 // map and either unmangle them on marking or do nothing as the whole map is |
| (...skipping 7669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7988 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 7987 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 7989 } | 7988 } |
| 7990 } | 7989 } |
| 7991 | 7990 |
| 7992 | 7991 |
| 7993 #undef __ | 7992 #undef __ |
| 7994 | 7993 |
| 7995 } } // namespace v8::internal | 7994 } } // namespace v8::internal |
| 7996 | 7995 |
| 7997 #endif // V8_TARGET_ARCH_IA32 | 7996 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |