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

Side by Side Diff: src/ia32/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.h ('k') | src/ia32/full-codegen-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 7900 matching lines...) Expand 10 before | Expand all | Expand 10 after
7911 __ CmpObjectType(left, JS_REGEXP_TYPE, tmp); 7911 __ CmpObjectType(left, JS_REGEXP_TYPE, tmp);
7912 destination()->false_target()->Branch(not_equal); 7912 destination()->false_target()->Branch(not_equal);
7913 __ cmp(tmp, FieldOperand(right, HeapObject::kMapOffset)); 7913 __ cmp(tmp, FieldOperand(right, HeapObject::kMapOffset));
7914 destination()->false_target()->Branch(not_equal); 7914 destination()->false_target()->Branch(not_equal);
7915 __ mov(tmp, FieldOperand(left, JSRegExp::kDataOffset)); 7915 __ mov(tmp, FieldOperand(left, JSRegExp::kDataOffset));
7916 __ cmp(tmp, FieldOperand(right, JSRegExp::kDataOffset)); 7916 __ cmp(tmp, FieldOperand(right, JSRegExp::kDataOffset));
7917 destination()->Split(equal); 7917 destination()->Split(equal);
7918 } 7918 }
7919 7919
7920 7920
7921 void CodeGenerator::GenerateHasCachedArrayIndex(ZoneList<Expression*>* args) {
7922 ASSERT(args->length() == 1);
7923 Load(args->at(0));
7924 Result value = frame_->Pop();
7925 value.ToRegister();
7926 ASSERT(value.is_valid());
7927 if (FLAG_debug_code) {
7928 __ AbortIfNotString(value.reg());
7929 }
7930
7931 __ test(FieldOperand(value.reg(), String::kHashFieldOffset),
7932 Immediate(String::kContainsCachedArrayIndexMask));
7933
7934 value.Unuse();
7935 destination()->Split(zero);
7936 }
7937
7938
7939 void CodeGenerator::GenerateGetCachedArrayIndex(ZoneList<Expression*>* args) {
7940 ASSERT(args->length() == 1);
7941 Load(args->at(0));
7942 Result string = frame_->Pop();
7943 string.ToRegister();
7944 if (FLAG_debug_code) {
7945 __ AbortIfNotString(string.reg());
7946 }
7947
7948 Result number = allocator()->Allocate();
7949 ASSERT(number.is_valid());
7950 __ mov(number.reg(), FieldOperand(string.reg(), String::kHashFieldOffset));
7951 __ IndexFromHash(number.reg(), number.reg());
7952 string.Unuse();
7953 frame_->Push(&number);
7954 }
7955
7956
7921 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { 7957 void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
7922 ASSERT(!in_safe_int32_mode()); 7958 ASSERT(!in_safe_int32_mode());
7923 if (CheckForInlineRuntimeCall(node)) { 7959 if (CheckForInlineRuntimeCall(node)) {
7924 return; 7960 return;
7925 } 7961 }
7926 7962
7927 ZoneList<Expression*>* args = node->arguments(); 7963 ZoneList<Expression*>* args = node->arguments();
7928 Comment cmnt(masm_, "[ CallRuntime"); 7964 Comment cmnt(masm_, "[ CallRuntime");
7929 Runtime::Function* function = node->function(); 7965 Runtime::Function* function = node->function();
7930 7966
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
9998 masm.GetCode(&desc); 10034 masm.GetCode(&desc);
9999 // Call the function from C++. 10035 // Call the function from C++.
10000 return FUNCTION_CAST<MemCopyFunction>(buffer); 10036 return FUNCTION_CAST<MemCopyFunction>(buffer);
10001 } 10037 }
10002 10038
10003 #undef __ 10039 #undef __
10004 10040
10005 } } // namespace v8::internal 10041 } } // namespace v8::internal
10006 10042
10007 #endif // V8_TARGET_ARCH_IA32 10043 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698