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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ia32/codegen-ia32.cc ('k') | src/ia32/ic-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 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 __ mov(eax, Immediate(Factory::false_value())); 2841 __ mov(eax, Immediate(Factory::false_value()));
2842 __ jmp(&done); 2842 __ jmp(&done);
2843 __ bind(&ok); 2843 __ bind(&ok);
2844 __ mov(eax, Immediate(Factory::true_value())); 2844 __ mov(eax, Immediate(Factory::true_value()));
2845 __ bind(&done); 2845 __ bind(&done);
2846 2846
2847 Apply(context_, eax); 2847 Apply(context_, eax);
2848 } 2848 }
2849 2849
2850 2850
2851 void FullCodeGenerator::EmitHasCachedArrayIndex(ZoneList<Expression*>* args) {
2852 ASSERT(args->length() == 1);
2853
2854 VisitForValue(args->at(0), kAccumulator);
2855
2856 if (FLAG_debug_code) {
2857 __ AbortIfNotString(eax);
2858 }
2859
2860 Label materialize_true, materialize_false;
2861 Label* if_true = NULL;
2862 Label* if_false = NULL;
2863 Label* fall_through = NULL;
2864 PrepareTest(&materialize_true, &materialize_false,
2865 &if_true, &if_false, &fall_through);
2866
2867 __ test(FieldOperand(eax, String::kHashFieldOffset),
2868 Immediate(String::kContainsCachedArrayIndexMask));
2869 Split(zero, if_true, if_false, fall_through);
2870
2871 Apply(context_, if_true, if_false);
2872 }
2873
2874
2875 void FullCodeGenerator::EmitGetCachedArrayIndex(ZoneList<Expression*>* args) {
2876 ASSERT(args->length() == 1);
2877
2878 VisitForValue(args->at(0), kAccumulator);
2879
2880 if (FLAG_debug_code) {
2881 __ AbortIfNotString(eax);
2882 }
2883
2884 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset));
2885 __ IndexFromHash(eax, eax);
2886
2887 Apply(context_, eax);
2888 }
2889
2890
2851 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 2891 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
2852 Handle<String> name = expr->name(); 2892 Handle<String> name = expr->name();
2853 if (name->length() > 0 && name->Get(0) == '_') { 2893 if (name->length() > 0 && name->Get(0) == '_') {
2854 Comment cmnt(masm_, "[ InlineRuntimeCall"); 2894 Comment cmnt(masm_, "[ InlineRuntimeCall");
2855 EmitInlineRuntimeCall(expr); 2895 EmitInlineRuntimeCall(expr);
2856 return; 2896 return;
2857 } 2897 }
2858 2898
2859 Comment cmnt(masm_, "[ CallRuntime"); 2899 Comment cmnt(masm_, "[ CallRuntime");
2860 ZoneList<Expression*>* args = expr->arguments(); 2900 ZoneList<Expression*>* args = expr->arguments();
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
3505 // And return. 3545 // And return.
3506 __ ret(0); 3546 __ ret(0);
3507 } 3547 }
3508 3548
3509 3549
3510 #undef __ 3550 #undef __
3511 3551
3512 } } // namespace v8::internal 3552 } } // namespace v8::internal
3513 3553
3514 #endif // V8_TARGET_ARCH_IA32 3554 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698