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

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

Issue 9425045: Support fast case for-in in Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 4711 matching lines...) Expand 10 before | Expand all | Expand 10 after
4722 EmitPushTaggedOperand(obj); 4722 EmitPushTaggedOperand(obj);
4723 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); 4723 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
4724 LPointerMap* pointers = instr->pointer_map(); 4724 LPointerMap* pointers = instr->pointer_map();
4725 RecordPosition(pointers->position()); 4725 RecordPosition(pointers->position());
4726 SafepointGenerator safepoint_generator( 4726 SafepointGenerator safepoint_generator(
4727 this, pointers, Safepoint::kLazyDeopt); 4727 this, pointers, Safepoint::kLazyDeopt);
4728 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4728 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4729 } 4729 }
4730 4730
4731 4731
4732 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
4733 __ cmp(eax, isolate()->factory()->undefined_value());
4734 DeoptimizeIf(equal, instr->environment());
4735
4736 __ cmp(eax, isolate()->factory()->null_value());
4737 DeoptimizeIf(equal, instr->environment());
4738
4739 __ test(eax, Immediate(kSmiTagMask));
4740 DeoptimizeIf(zero, instr->environment());
4741
4742 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
4743 DeoptimizeIf(below, instr->environment());
4744
4745 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
4746 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx);
4747 DeoptimizeIf(below_equal, instr->environment());
4748
4749 Label use_cache, call_runtime;
4750 __ CheckEnumCache(&call_runtime);
4751
4752 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset));
4753 __ jmp(&use_cache, Label::kNear);
4754
4755 // Get the set of properties to enumerate.
4756 __ bind(&call_runtime);
4757 __ push(eax);
4758 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr);
4759
4760 __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
4761 isolate()->factory()->meta_map());
4762 DeoptimizeIf(not_equal, instr->environment());
4763 __ bind(&use_cache);
4764 }
4765
4766
4767 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) {
4768 Register map = ToRegister(instr->keys());
4769 Register result = ToRegister(instr->result());
4770 __ LoadInstanceDescriptors(map, result);
4771 __ mov(result,
4772 FieldOperand(result, DescriptorArray::kEnumerationIndexOffset));
4773 __ mov(result,
4774 FieldOperand(result, FixedArray::SizeFor(instr->idx())));
4775 __ test(result, result);
4776 DeoptimizeIf(equal, instr->environment());
4777 }
4778
4779
4780 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) {
4781 Register object = ToRegister(instr->value());
4782 __ cmp(ToRegister(instr->map()),
4783 FieldOperand(object, HeapObject::kMapOffset));
4784 DeoptimizeIf(not_equal, instr->environment());
4785 }
4786
4787
4788 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) {
4789 Register object = ToRegister(instr->object());
4790 Register index = ToRegister(instr->index());
4791
4792 Label out_of_object, done;
4793 __ cmp(index, Immediate(0));
4794 __ j(less, &out_of_object);
4795 __ mov(object, Operand(object,
4796 index,
4797 times_half_pointer_size,
4798 JSObject::kHeaderSize - kHeapObjectTag));
fschneider 2012/02/20 14:56:06 Maybe use FieldOperand instead to avoid having to
4799 __ jmp(&done, Label::kNear);
4800
4801 __ bind(&out_of_object);
4802 __ mov(object, FieldOperand(object, JSObject::kPropertiesOffset));
4803 __ neg(index);
4804 __ mov(object, Operand(object,
4805 index,
4806 times_half_pointer_size,
4807 kPointerSize - kHeapObjectTag));
fschneider 2012/02/20 14:56:06 Shouldn't this be FixedArray::kHeaderSize - kHeapO
4808 __ bind(&done);
4809 }
4810
4811
4732 #undef __ 4812 #undef __
4733 4813
4734 } } // namespace v8::internal 4814 } } // namespace v8::internal
4735 4815
4736 #endif // V8_TARGET_ARCH_IA32 4816 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698