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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 596011: Change GenerateLoadStringLength to have two scratch registers on all platform... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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/ic-ia32.cc ('k') | src/stub-cache.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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 __ mov(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); 219 __ mov(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
220 __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); 220 __ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
221 ASSERT(kNotStringTag != 0); 221 ASSERT(kNotStringTag != 0);
222 __ test(scratch, Immediate(kNotStringTag)); 222 __ test(scratch, Immediate(kNotStringTag));
223 __ j(not_zero, non_string_object, not_taken); 223 __ j(not_zero, non_string_object, not_taken);
224 } 224 }
225 225
226 226
227 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, 227 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
228 Register receiver, 228 Register receiver,
229 Register scratch, 229 Register scratch1,
230 Register scratch2,
230 Label* miss) { 231 Label* miss) {
231 Label load_length, check_wrapper; 232 Label load_length, check_wrapper;
232 233
233 // Check if the object is a string leaving the instance type in the 234 // Check if the object is a string leaving the instance type in the
234 // scratch register. 235 // scratch register.
235 GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); 236 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper);
236 237
237 // Load length from the string and convert to a smi. 238 // Load length from the string and convert to a smi.
238 __ bind(&load_length); 239 __ bind(&load_length);
239 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); 240 __ mov(eax, FieldOperand(receiver, String::kLengthOffset));
240 __ SmiTag(eax); 241 __ SmiTag(eax);
241 __ ret(0); 242 __ ret(0);
242 243
243 // Check if the object is a JSValue wrapper. 244 // Check if the object is a JSValue wrapper.
244 __ bind(&check_wrapper); 245 __ bind(&check_wrapper);
245 __ cmp(scratch, JS_VALUE_TYPE); 246 __ cmp(scratch1, JS_VALUE_TYPE);
246 __ j(not_equal, miss, not_taken); 247 __ j(not_equal, miss, not_taken);
247 248
248 // Check if the wrapped value is a string and load the length 249 // Check if the wrapped value is a string and load the length
249 // directly if it is. 250 // directly if it is.
250 __ mov(receiver, FieldOperand(receiver, JSValue::kValueOffset)); 251 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset));
251 GenerateStringCheck(masm, receiver, scratch, miss, miss); 252 GenerateStringCheck(masm, scratch2, scratch1, miss, miss);
252 __ jmp(&load_length); 253 __ jmp(&load_length);
253 } 254 }
254 255
255 256
256 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, 257 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
257 Register receiver, 258 Register receiver,
258 Register scratch1, 259 Register scratch1,
259 Register scratch2, 260 Register scratch2,
260 Label* miss_label) { 261 Label* miss_label) {
261 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 262 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 Label miss; 1767 Label miss;
1767 1768
1768 __ mov(eax, Operand(esp, kPointerSize)); 1769 __ mov(eax, Operand(esp, kPointerSize));
1769 __ mov(ecx, Operand(esp, 2 * kPointerSize)); 1770 __ mov(ecx, Operand(esp, 2 * kPointerSize));
1770 __ IncrementCounter(&Counters::keyed_load_string_length, 1); 1771 __ IncrementCounter(&Counters::keyed_load_string_length, 1);
1771 1772
1772 // Check that the name has not changed. 1773 // Check that the name has not changed.
1773 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 1774 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1774 __ j(not_equal, &miss, not_taken); 1775 __ j(not_equal, &miss, not_taken);
1775 1776
1776 GenerateLoadStringLength(masm(), ecx, edx, &miss); 1777 GenerateLoadStringLength(masm(), ecx, edx, ebx, &miss);
1777 __ bind(&miss); 1778 __ bind(&miss);
1778 __ DecrementCounter(&Counters::keyed_load_string_length, 1); 1779 __ DecrementCounter(&Counters::keyed_load_string_length, 1);
1779 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 1780 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
1780 1781
1781 // Return the generated code. 1782 // Return the generated code.
1782 return GetCode(CALLBACKS, name); 1783 return GetCode(CALLBACKS, name);
1783 } 1784 }
1784 1785
1785 1786
1786 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { 1787 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); 1943 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
1943 1944
1944 // Return the generated code. 1945 // Return the generated code.
1945 return GetCode(); 1946 return GetCode();
1946 } 1947 }
1947 1948
1948 1949
1949 #undef __ 1950 #undef __
1950 1951
1951 } } // namespace v8::internal 1952 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698