Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 6793013: Cache optimized code on shared function info. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 7564 matching lines...) Expand 10 before | Expand all | Expand 10 after
7575 7575
7576 Smi* kEntrySizeSmi = Smi::FromInt(JSFunctionResultCache::kEntrySize); 7576 Smi* kEntrySizeSmi = Smi::FromInt(JSFunctionResultCache::kEntrySize);
7577 Smi* kEntriesIndexSmi = Smi::FromInt(JSFunctionResultCache::kEntriesIndex); 7577 Smi* kEntriesIndexSmi = Smi::FromInt(JSFunctionResultCache::kEntriesIndex);
7578 7578
7579 // Check the cache from finger to start of the cache. 7579 // Check the cache from finger to start of the cache.
7580 __ bind(&first_loop); 7580 __ bind(&first_loop);
7581 __ sub(Operand(dst_), Immediate(kEntrySizeSmi)); 7581 __ sub(Operand(dst_), Immediate(kEntrySizeSmi));
7582 __ cmp(Operand(dst_), Immediate(kEntriesIndexSmi)); 7582 __ cmp(Operand(dst_), Immediate(kEntriesIndexSmi));
7583 __ j(less, &search_further); 7583 __ j(less, &search_further);
7584 7584
7585 __ cmp(key_, CodeGenerator::FixedArrayElementOperand(cache_, dst_)); 7585 __ cmp(key_, FixedArrayElementOperand(cache_, dst_));
7586 __ j(not_equal, &first_loop); 7586 __ j(not_equal, &first_loop);
7587 7587
7588 __ mov(FieldOperand(cache_, JSFunctionResultCache::kFingerOffset), dst_); 7588 __ mov(FieldOperand(cache_, JSFunctionResultCache::kFingerOffset), dst_);
7589 __ mov(dst_, CodeGenerator::FixedArrayElementOperand(cache_, dst_, 1)); 7589 __ mov(dst_, FixedArrayElementOperand(cache_, dst_, 1));
7590 __ jmp(exit_label()); 7590 __ jmp(exit_label());
7591 7591
7592 __ bind(&search_further); 7592 __ bind(&search_further);
7593 7593
7594 // Check the cache from end of cache up to finger. 7594 // Check the cache from end of cache up to finger.
7595 __ mov(dst_, FieldOperand(cache_, JSFunctionResultCache::kCacheSizeOffset)); 7595 __ mov(dst_, FieldOperand(cache_, JSFunctionResultCache::kCacheSizeOffset));
7596 7596
7597 __ bind(&second_loop); 7597 __ bind(&second_loop);
7598 __ sub(Operand(dst_), Immediate(kEntrySizeSmi)); 7598 __ sub(Operand(dst_), Immediate(kEntrySizeSmi));
7599 // Consider prefetching into some reg. 7599 // Consider prefetching into some reg.
7600 __ cmp(dst_, FieldOperand(cache_, JSFunctionResultCache::kFingerOffset)); 7600 __ cmp(dst_, FieldOperand(cache_, JSFunctionResultCache::kFingerOffset));
7601 __ j(less_equal, &cache_miss); 7601 __ j(less_equal, &cache_miss);
7602 7602
7603 __ cmp(key_, CodeGenerator::FixedArrayElementOperand(cache_, dst_)); 7603 __ cmp(key_, FixedArrayElementOperand(cache_, dst_));
7604 __ j(not_equal, &second_loop); 7604 __ j(not_equal, &second_loop);
7605 7605
7606 __ mov(FieldOperand(cache_, JSFunctionResultCache::kFingerOffset), dst_); 7606 __ mov(FieldOperand(cache_, JSFunctionResultCache::kFingerOffset), dst_);
7607 __ mov(dst_, CodeGenerator::FixedArrayElementOperand(cache_, dst_, 1)); 7607 __ mov(dst_, FixedArrayElementOperand(cache_, dst_, 1));
7608 __ jmp(exit_label()); 7608 __ jmp(exit_label());
7609 7609
7610 __ bind(&cache_miss); 7610 __ bind(&cache_miss);
7611 __ push(cache_); // store a reference to cache 7611 __ push(cache_); // store a reference to cache
7612 __ push(key_); // store a key 7612 __ push(key_); // store a key
7613 __ push(Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 7613 __ push(Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
7614 __ push(key_); 7614 __ push(key_);
7615 // On ia32 function must be in edi. 7615 // On ia32 function must be in edi.
7616 __ mov(edi, FieldOperand(cache_, JSFunctionResultCache::kFactoryOffset)); 7616 __ mov(edi, FieldOperand(cache_, JSFunctionResultCache::kFactoryOffset));
7617 ParameterCount expected(1); 7617 ParameterCount expected(1);
(...skipping 25 matching lines...) Expand all
7643 __ mov(edx, FieldOperand(ecx, JSFunctionResultCache::kCacheSizeOffset)); 7643 __ mov(edx, FieldOperand(ecx, JSFunctionResultCache::kCacheSizeOffset));
7644 __ lea(ebx, Operand(edx, JSFunctionResultCache::kEntrySize << 1)); 7644 __ lea(ebx, Operand(edx, JSFunctionResultCache::kEntrySize << 1));
7645 __ mov(FieldOperand(ecx, JSFunctionResultCache::kCacheSizeOffset), ebx); 7645 __ mov(FieldOperand(ecx, JSFunctionResultCache::kCacheSizeOffset), ebx);
7646 7646
7647 // Update the cache itself. 7647 // Update the cache itself.
7648 // edx holds the index. 7648 // edx holds the index.
7649 __ bind(&update_cache); 7649 __ bind(&update_cache);
7650 __ pop(ebx); // restore the key 7650 __ pop(ebx); // restore the key
7651 __ mov(FieldOperand(ecx, JSFunctionResultCache::kFingerOffset), edx); 7651 __ mov(FieldOperand(ecx, JSFunctionResultCache::kFingerOffset), edx);
7652 // Store key. 7652 // Store key.
7653 __ mov(CodeGenerator::FixedArrayElementOperand(ecx, edx), ebx); 7653 __ mov(FixedArrayElementOperand(ecx, edx), ebx);
7654 __ RecordWrite(ecx, 0, ebx, edx); 7654 __ RecordWrite(ecx, 0, ebx, edx);
7655 7655
7656 // Store value. 7656 // Store value.
7657 __ pop(ecx); // restore the cache. 7657 __ pop(ecx); // restore the cache.
7658 __ mov(edx, FieldOperand(ecx, JSFunctionResultCache::kFingerOffset)); 7658 __ mov(edx, FieldOperand(ecx, JSFunctionResultCache::kFingerOffset));
7659 __ add(Operand(edx), Immediate(Smi::FromInt(1))); 7659 __ add(Operand(edx), Immediate(Smi::FromInt(1)));
7660 __ mov(ebx, eax); 7660 __ mov(ebx, eax);
7661 __ mov(CodeGenerator::FixedArrayElementOperand(ecx, edx), ebx); 7661 __ mov(FixedArrayElementOperand(ecx, edx), ebx);
7662 __ RecordWrite(ecx, 0, ebx, edx); 7662 __ RecordWrite(ecx, 0, ebx, edx);
7663 7663
7664 if (!dst_.is(eax)) { 7664 if (!dst_.is(eax)) {
7665 __ mov(dst_, eax); 7665 __ mov(dst_, eax);
7666 } 7666 }
7667 } 7667 }
7668 7668
7669 7669
7670 void CodeGenerator::GenerateGetFromCache(ZoneList<Expression*>* args) { 7670 void CodeGenerator::GenerateGetFromCache(ZoneList<Expression*>* args) {
7671 ASSERT_EQ(2, args->length()); 7671 ASSERT_EQ(2, args->length());
(...skipping 2704 matching lines...) Expand 10 before | Expand all | Expand 10 after
10376 10376
10377 CPU::FlushICache(buffer, actual_size); 10377 CPU::FlushICache(buffer, actual_size);
10378 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); 10378 return FUNCTION_CAST<OS::MemCopyFunction>(buffer);
10379 } 10379 }
10380 10380
10381 #undef __ 10381 #undef __
10382 10382
10383 } } // namespace v8::internal 10383 } } // namespace v8::internal
10384 10384
10385 #endif // V8_TARGET_ARCH_IA32 10385 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698