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

Side by Side Diff: src/arm/ic-arm.cc

Issue 3141022: Using array index hash code for string-to-number conversion. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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/arm/full-codegen-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 // Is the string a symbol? 521 // Is the string a symbol?
522 // map: key map 522 // map: key map
523 __ ldrb(hash, FieldMemOperand(map, Map::kInstanceTypeOffset)); 523 __ ldrb(hash, FieldMemOperand(map, Map::kInstanceTypeOffset));
524 ASSERT(kSymbolTag != 0); 524 ASSERT(kSymbolTag != 0);
525 __ tst(hash, Operand(kIsSymbolMask)); 525 __ tst(hash, Operand(kIsSymbolMask));
526 __ b(eq, not_symbol); 526 __ b(eq, not_symbol);
527 } 527 }
528 528
529 529
530 // Picks out an array index from the hash field.
531 static void GenerateIndexFromHash(MacroAssembler* masm,
532 Register key,
533 Register hash) {
534 // Register use:
535 // key - holds the overwritten key on exit.
536 // hash - holds the key's hash. Clobbered.
537
538 // If the hash field contains an array index pick it out. The assert checks
539 // that the constants for the maximum number of digits for an array index
540 // cached in the hash field and the number of bits reserved for it does not
541 // conflict.
542 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) <
543 (1 << String::kArrayIndexValueBits));
544 // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in
545 // the low kHashShift bits.
546 ASSERT(String::kHashShift >= kSmiTagSize);
547 // Here we actually clobber the key which will be used if calling into
548 // runtime later. However as the new key is the numeric value of a string key
549 // there is no difference in using either key.
550 ASSERT(String::kHashShift >= kSmiTagSize);
551 __ Ubfx(hash, hash, String::kHashShift, String::kArrayIndexValueBits);
552 __ mov(key, Operand(hash, LSL, kSmiTagSize));
553 }
554
555
556 // Defined in ic.cc. 530 // Defined in ic.cc.
557 Object* CallIC_Miss(Arguments args); 531 Object* CallIC_Miss(Arguments args);
558 532
559 // The generated code does not accept smi keys. 533 // The generated code does not accept smi keys.
560 // The generated code falls through if both probes miss. 534 // The generated code falls through if both probes miss.
561 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm, 535 static void GenerateMonomorphicCacheProbe(MacroAssembler* masm,
562 int argc, 536 int argc,
563 Code::Kind kind) { 537 Code::Kind kind) {
564 // ----------- S t a t e ------------- 538 // ----------- S t a t e -------------
565 // -- r1 : receiver 539 // -- r1 : receiver
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // This branch is taken if: 819 // This branch is taken if:
846 // - the receiver requires boxing or access check, 820 // - the receiver requires boxing or access check,
847 // - the key is neither smi nor symbol, 821 // - the key is neither smi nor symbol,
848 // - the value loaded is not a function, 822 // - the value loaded is not a function,
849 // - there is hope that the runtime will create a monomorphic call stub 823 // - there is hope that the runtime will create a monomorphic call stub
850 // that will get fetched next time. 824 // that will get fetched next time.
851 __ IncrementCounter(&Counters::keyed_call_generic_slow, 1, r0, r3); 825 __ IncrementCounter(&Counters::keyed_call_generic_slow, 1, r0, r3);
852 GenerateMiss(masm, argc); 826 GenerateMiss(masm, argc);
853 827
854 __ bind(&index_string); 828 __ bind(&index_string);
855 GenerateIndexFromHash(masm, r2, r3); 829 __ IndexFromHash(r3, r2);
856 // Now jump to the place where smi keys are handled. 830 // Now jump to the place where smi keys are handled.
857 __ jmp(&index_smi); 831 __ jmp(&index_smi);
858 } 832 }
859 833
860 834
861 void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) { 835 void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) {
862 // ----------- S t a t e ------------- 836 // ----------- S t a t e -------------
863 // -- r2 : name 837 // -- r2 : name
864 // -- lr : return address 838 // -- lr : return address
865 // ----------------------------------- 839 // -----------------------------------
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 // r3: elements 1216 // r3: elements
1243 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); 1217 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset));
1244 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); 1218 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset));
1245 GenerateGlobalInstanceTypeCheck(masm, r2, &slow); 1219 GenerateGlobalInstanceTypeCheck(masm, r2, &slow);
1246 // Load the property to r0. 1220 // Load the property to r0.
1247 GenerateDictionaryLoad(masm, &slow, r3, r0, r0, r2, r4); 1221 GenerateDictionaryLoad(masm, &slow, r3, r0, r0, r2, r4);
1248 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1, r2, r3); 1222 __ IncrementCounter(&Counters::keyed_load_generic_symbol, 1, r2, r3);
1249 __ Ret(); 1223 __ Ret();
1250 1224
1251 __ bind(&index_string); 1225 __ bind(&index_string);
1252 GenerateIndexFromHash(masm, key, r3); 1226 __ IndexFromHash(r3, key);
1253 // Now jump to the place where smi keys are handled. 1227 // Now jump to the place where smi keys are handled.
1254 __ jmp(&index_smi); 1228 __ jmp(&index_smi);
1255 } 1229 }
1256 1230
1257 1231
1258 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { 1232 void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
1259 // ---------- S t a t e -------------- 1233 // ---------- S t a t e --------------
1260 // -- lr : return address 1234 // -- lr : return address
1261 // -- r0 : key (index) 1235 // -- r0 : key (index)
1262 // -- r1 : receiver 1236 // -- r1 : receiver
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 GenerateMiss(masm); 2247 GenerateMiss(masm);
2274 } 2248 }
2275 2249
2276 2250
2277 #undef __ 2251 #undef __
2278 2252
2279 2253
2280 } } // namespace v8::internal 2254 } } // namespace v8::internal
2281 2255
2282 #endif // V8_TARGET_ARCH_ARM 2256 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698