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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 9425045: Support fast case for-in in Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: port to x64&arm, cleanup Created 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4832 matching lines...) Expand 10 before | Expand all | Expand 10 after
4843 4843
4844 // If the environment were already registered, we would have no way of 4844 // If the environment were already registered, we would have no way of
4845 // backpatching it with the spill slot operands. 4845 // backpatching it with the spill slot operands.
4846 ASSERT(!environment->HasBeenRegistered()); 4846 ASSERT(!environment->HasBeenRegistered());
4847 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4847 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4848 ASSERT(osr_pc_offset_ == -1); 4848 ASSERT(osr_pc_offset_ == -1);
4849 osr_pc_offset_ = masm()->pc_offset(); 4849 osr_pc_offset_ = masm()->pc_offset();
4850 } 4850 }
4851 4851
4852 4852
4853 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
4854 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
4855 __ cmp(r0, ip);
4856 DeoptimizeIf(eq, instr->environment());
4857
4858 Register null_value = r5;
4859 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
4860 __ cmp(r0, null_value);
4861 DeoptimizeIf(eq, instr->environment());
4862
4863 __ tst(r0, Operand(kSmiTagMask));
4864 DeoptimizeIf(eq, instr->environment());
4865
4866 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
4867 __ CompareObjectType(r0, r1, r1, LAST_JS_PROXY_TYPE);
4868 DeoptimizeIf(le, instr->environment());
4869
4870 Label use_cache, call_runtime;
4871 __ CheckEnumCache(null_value, &call_runtime);
4872
4873 __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset));
4874 __ b(&use_cache);
4875
4876 // Get the set of properties to enumerate.
4877 __ bind(&call_runtime);
4878 __ push(r0);
4879 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
4880
4881 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset));
4882 __ LoadRoot(ip, Heap::kMetaMapRootIndex);
4883 __ cmp(r1, ip);
4884 DeoptimizeIf(ne, instr->environment());
4885 __ bind(&use_cache);
4886 }
4887
4888
4889 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
4890 Register map = ToRegister(instr->map());
4891 Register result = ToRegister(instr->result());
4892 __ LoadInstanceDescriptors(map, result);
4893 __ ldr(result,
4894 FieldMemOperand(result, DescriptorArray::kEnumerationIndexOffset));
4895 __ ldr(result,
4896 FieldMemOperand(result, FixedArray::SizeFor(instr->idx())));
4897 __ cmp(result, Operand(0));
4898 DeoptimizeIf(eq, instr->environment());
4899 }
4900
4901
4902 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
4903 Register object = ToRegister(instr->value());
4904 Register map = ToRegister(instr->map());
4905 __ ldr(scratch0(), FieldMemOperand(object, HeapObject::kMapOffset));
4906 __ cmp(map, scratch0());
4907 DeoptimizeIf(ne, instr->environment());
4908 }
4909
4910
4911 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
4912 Register object = ToRegister(instr->object());
4913 Register index = ToRegister(instr->index());
4914 Register result = ToRegister(instr->result());
4915 Register scratch = scratch0();
4916
4917 Label out_of_object, done;
4918 __ cmp(index, Operand(0));
4919 __ b(lt, &out_of_object);
4920
4921 STATIC_ASSERT(kPointerSizeLog2 > kSmiTagSize);
4922 __ add(scratch, object, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
4923 __ ldr(result, FieldMemOperand(scratch, JSObject::kHeaderSize));
4924
4925 __ b(&done);
4926
4927 __ bind(&out_of_object);
4928 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
4929 // Index is equal to negated out of object property index plus 1.
4930 __ sub(scratch, object, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
4931 __ ldr(result, FieldMemOperand(scratch,
4932 FixedArray::kHeaderSize - kPointerSize));
4933 __ bind(&done);
4934 }
4853 4935
4854 4936
4855 #undef __ 4937 #undef __
4856 4938
4857 } } // namespace v8::internal 4939 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698