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

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

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 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/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 RegisterDependentCodeForEmbeddedMaps(code); 106 RegisterDependentCodeForEmbeddedMaps(code);
107 } 107 }
108 PopulateDeoptimizationData(code); 108 PopulateDeoptimizationData(code);
109 if (!info()->IsStub()) { 109 if (!info()->IsStub()) {
110 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); 110 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
111 } 111 }
112 info()->CommitDependencies(code); 112 info()->CommitDependencies(code);
113 } 113 }
114 114
115 115
116 void LCodeGen::Abort(BailoutReason reason) { 116 void LCodeGen::Abort(const char* reason) {
117 info()->set_bailout_reason(reason); 117 info()->set_bailout_reason(reason);
118 status_ = ABORTED; 118 status_ = ABORTED;
119 } 119 }
120 120
121 121
122 void LCodeGen::Comment(const char* format, ...) { 122 void LCodeGen::Comment(const char* format, ...) {
123 if (!FLAG_code_comments) return; 123 if (!FLAG_code_comments) return;
124 char buffer[4 * KB]; 124 char buffer[4 * KB];
125 StringBuilder builder(buffer, ARRAY_SIZE(buffer)); 125 StringBuilder builder(buffer, ARRAY_SIZE(buffer));
126 va_list arguments; 126 va_list arguments;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 __ push(Immediate(Smi::FromInt(StackFrame::STUB))); 213 __ push(Immediate(Smi::FromInt(StackFrame::STUB)));
214 } else { 214 } else {
215 __ push(edi); // Callee's JS function. 215 __ push(edi); // Callee's JS function.
216 } 216 }
217 } 217 }
218 218
219 if (info()->IsOptimizing() && 219 if (info()->IsOptimizing() &&
220 dynamic_frame_alignment_ && 220 dynamic_frame_alignment_ &&
221 FLAG_debug_code) { 221 FLAG_debug_code) {
222 __ test(esp, Immediate(kPointerSize)); 222 __ test(esp, Immediate(kPointerSize));
223 __ Assert(zero, kFrameIsExpectedToBeAligned); 223 __ Assert(zero, "frame is expected to be aligned");
224 } 224 }
225 225
226 // Reserve space for the stack slots needed by the code. 226 // Reserve space for the stack slots needed by the code.
227 int slots = GetStackSlotCount(); 227 int slots = GetStackSlotCount();
228 ASSERT(slots != 0 || !info()->IsOptimizing()); 228 ASSERT(slots != 0 || !info()->IsOptimizing());
229 if (slots > 0) { 229 if (slots > 0) {
230 if (slots == 1) { 230 if (slots == 1) {
231 if (dynamic_frame_alignment_) { 231 if (dynamic_frame_alignment_) {
232 __ push(edx); 232 __ push(edx);
233 } else { 233 } else {
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 void LCodeGen::LoadContextFromDeferred(LOperand* context) { 875 void LCodeGen::LoadContextFromDeferred(LOperand* context) {
876 if (context->IsRegister()) { 876 if (context->IsRegister()) {
877 if (!ToRegister(context).is(esi)) { 877 if (!ToRegister(context).is(esi)) {
878 __ mov(esi, ToRegister(context)); 878 __ mov(esi, ToRegister(context));
879 } 879 }
880 } else if (context->IsStackSlot()) { 880 } else if (context->IsStackSlot()) {
881 __ mov(esi, ToOperand(context)); 881 __ mov(esi, ToOperand(context));
882 } else if (context->IsConstantOperand()) { 882 } else if (context->IsConstantOperand()) {
883 HConstant* constant = 883 HConstant* constant =
884 chunk_->LookupConstant(LConstantOperand::cast(context)); 884 chunk_->LookupConstant(LConstantOperand::cast(context));
885 __ LoadObject(esi, Handle<Object>::cast(constant->handle())); 885 __ LoadHeapObject(esi, Handle<Context>::cast(constant->handle()));
886 } else { 886 } else {
887 UNREACHABLE(); 887 UNREACHABLE();
888 } 888 }
889 } 889 }
890 890
891 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, 891 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id,
892 int argc, 892 int argc,
893 LInstruction* instr, 893 LInstruction* instr,
894 LOperand* context) { 894 LOperand* context) {
895 LoadContextFromDeferred(context); 895 LoadContextFromDeferred(context);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 void LCodeGen::DeoptimizeIf(Condition cc, 941 void LCodeGen::DeoptimizeIf(Condition cc,
942 LEnvironment* environment, 942 LEnvironment* environment,
943 Deoptimizer::BailoutType bailout_type) { 943 Deoptimizer::BailoutType bailout_type) {
944 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 944 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
945 ASSERT(environment->HasBeenRegistered()); 945 ASSERT(environment->HasBeenRegistered());
946 int id = environment->deoptimization_index(); 946 int id = environment->deoptimization_index();
947 ASSERT(info()->IsOptimizing() || info()->IsStub()); 947 ASSERT(info()->IsOptimizing() || info()->IsStub());
948 Address entry = 948 Address entry =
949 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 949 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
950 if (entry == NULL) { 950 if (entry == NULL) {
951 Abort(kBailoutWasNotPrepared); 951 Abort("bailout was not prepared");
952 return; 952 return;
953 } 953 }
954 954
955 if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) { 955 if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
956 ExternalReference count = ExternalReference::stress_deopt_count(isolate()); 956 ExternalReference count = ExternalReference::stress_deopt_count(isolate());
957 Label no_deopt; 957 Label no_deopt;
958 __ pushfd(); 958 __ pushfd();
959 __ push(eax); 959 __ push(eax);
960 __ mov(eax, Operand::StaticVariable(count)); 960 __ mov(eax, Operand::StaticVariable(count));
961 __ sub(eax, Immediate(1)); 961 __ sub(eax, Immediate(1));
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 } 1672 }
1673 1673
1674 1674
1675 void LCodeGen::DoBitI(LBitI* instr) { 1675 void LCodeGen::DoBitI(LBitI* instr) {
1676 LOperand* left = instr->left(); 1676 LOperand* left = instr->left();
1677 LOperand* right = instr->right(); 1677 LOperand* right = instr->right();
1678 ASSERT(left->Equals(instr->result())); 1678 ASSERT(left->Equals(instr->result()));
1679 ASSERT(left->IsRegister()); 1679 ASSERT(left->IsRegister());
1680 1680
1681 if (right->IsConstantOperand()) { 1681 if (right->IsConstantOperand()) {
1682 int32_t right_operand = 1682 int right_operand = ToRepresentation(LConstantOperand::cast(right),
1683 ToRepresentation(LConstantOperand::cast(right), 1683 instr->hydrogen()->representation());
1684 instr->hydrogen()->representation());
1685 switch (instr->op()) { 1684 switch (instr->op()) {
1686 case Token::BIT_AND: 1685 case Token::BIT_AND:
1687 __ and_(ToRegister(left), right_operand); 1686 __ and_(ToRegister(left), right_operand);
1688 break; 1687 break;
1689 case Token::BIT_OR: 1688 case Token::BIT_OR:
1690 __ or_(ToRegister(left), right_operand); 1689 __ or_(ToRegister(left), right_operand);
1691 break; 1690 break;
1692 case Token::BIT_XOR: 1691 case Token::BIT_XOR:
1693 if (right_operand == int32_t(~0)) { 1692 __ xor_(ToRegister(left), right_operand);
1694 __ not_(ToRegister(left));
1695 } else {
1696 __ xor_(ToRegister(left), right_operand);
1697 }
1698 break; 1693 break;
1699 default: 1694 default:
1700 UNREACHABLE(); 1695 UNREACHABLE();
1701 break; 1696 break;
1702 } 1697 }
1703 } else { 1698 } else {
1704 switch (instr->op()) { 1699 switch (instr->op()) {
1705 case Token::BIT_AND: 1700 case Token::BIT_AND:
1706 __ and_(ToRegister(left), ToOperand(right)); 1701 __ and_(ToRegister(left), ToOperand(right));
1707 break; 1702 break;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 if (FLAG_debug_code) { 1969 if (FLAG_debug_code) {
1975 __ push(value); 1970 __ push(value);
1976 __ mov(value, FieldOperand(string, HeapObject::kMapOffset)); 1971 __ mov(value, FieldOperand(string, HeapObject::kMapOffset));
1977 __ movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset)); 1972 __ movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset));
1978 1973
1979 __ and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); 1974 __ and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask));
1980 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 1975 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
1981 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 1976 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
1982 __ cmp(value, Immediate(encoding == String::ONE_BYTE_ENCODING 1977 __ cmp(value, Immediate(encoding == String::ONE_BYTE_ENCODING
1983 ? one_byte_seq_type : two_byte_seq_type)); 1978 ? one_byte_seq_type : two_byte_seq_type));
1984 __ Check(equal, kUnexpectedStringType); 1979 __ Check(equal, "Unexpected string type");
1985 __ pop(value); 1980 __ pop(value);
1986 } 1981 }
1987 1982
1988 if (encoding == String::ONE_BYTE_ENCODING) { 1983 if (encoding == String::ONE_BYTE_ENCODING) {
1989 __ mov_b(FieldOperand(string, index, times_1, SeqString::kHeaderSize), 1984 __ mov_b(FieldOperand(string, index, times_1, SeqString::kHeaderSize),
1990 value); 1985 value);
1991 } else { 1986 } else {
1992 __ mov_w(FieldOperand(string, index, times_2, SeqString::kHeaderSize), 1987 __ mov_w(FieldOperand(string, index, times_2, SeqString::kHeaderSize),
1993 value); 1988 value);
1994 } 1989 }
1995 } 1990 }
1996 1991
1997 1992
1993 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1994 LOperand* input = instr->value();
1995 ASSERT(input->Equals(instr->result()));
1996 __ not_(ToRegister(input));
1997 }
1998
1999
1998 void LCodeGen::DoThrow(LThrow* instr) { 2000 void LCodeGen::DoThrow(LThrow* instr) {
1999 __ push(ToOperand(instr->value())); 2001 __ push(ToOperand(instr->value()));
2000 ASSERT(ToRegister(instr->context()).is(esi)); 2002 ASSERT(ToRegister(instr->context()).is(esi));
2001 CallRuntime(Runtime::kThrow, 1, instr); 2003 CallRuntime(Runtime::kThrow, 1, instr);
2002 2004
2003 if (FLAG_debug_code) { 2005 if (FLAG_debug_code) {
2004 Comment("Unreachable code."); 2006 Comment("Unreachable code.");
2005 __ int3(); 2007 __ int3();
2006 } 2008 }
2007 } 2009 }
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2854 2856
2855 void LCodeGen::EmitReturn(LReturn* instr, bool dynamic_frame_alignment) { 2857 void LCodeGen::EmitReturn(LReturn* instr, bool dynamic_frame_alignment) {
2856 int extra_value_count = dynamic_frame_alignment ? 2 : 1; 2858 int extra_value_count = dynamic_frame_alignment ? 2 : 1;
2857 2859
2858 if (instr->has_constant_parameter_count()) { 2860 if (instr->has_constant_parameter_count()) {
2859 int parameter_count = ToInteger32(instr->constant_parameter_count()); 2861 int parameter_count = ToInteger32(instr->constant_parameter_count());
2860 if (dynamic_frame_alignment && FLAG_debug_code) { 2862 if (dynamic_frame_alignment && FLAG_debug_code) {
2861 __ cmp(Operand(esp, 2863 __ cmp(Operand(esp,
2862 (parameter_count + extra_value_count) * kPointerSize), 2864 (parameter_count + extra_value_count) * kPointerSize),
2863 Immediate(kAlignmentZapValue)); 2865 Immediate(kAlignmentZapValue));
2864 __ Assert(equal, kExpectedAlignmentMarker); 2866 __ Assert(equal, "expected alignment marker");
2865 } 2867 }
2866 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); 2868 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx);
2867 } else { 2869 } else {
2868 Register reg = ToRegister(instr->parameter_count()); 2870 Register reg = ToRegister(instr->parameter_count());
2869 // The argument count parameter is a smi 2871 // The argument count parameter is a smi
2870 __ SmiUntag(reg); 2872 __ SmiUntag(reg);
2871 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; 2873 Register return_addr_reg = reg.is(ecx) ? ebx : ecx;
2872 if (dynamic_frame_alignment && FLAG_debug_code) { 2874 if (dynamic_frame_alignment && FLAG_debug_code) {
2873 ASSERT(extra_value_count == 2); 2875 ASSERT(extra_value_count == 2);
2874 __ cmp(Operand(esp, reg, times_pointer_size, 2876 __ cmp(Operand(esp, reg, times_pointer_size,
2875 extra_value_count * kPointerSize), 2877 extra_value_count * kPointerSize),
2876 Immediate(kAlignmentZapValue)); 2878 Immediate(kAlignmentZapValue));
2877 __ Assert(equal, kExpectedAlignmentMarker); 2879 __ Assert(equal, "expected alignment marker");
2878 } 2880 }
2879 2881
2880 // emit code to restore stack based on instr->parameter_count() 2882 // emit code to restore stack based on instr->parameter_count()
2881 __ pop(return_addr_reg); // save return address 2883 __ pop(return_addr_reg); // save return address
2882 if (dynamic_frame_alignment) { 2884 if (dynamic_frame_alignment) {
2883 __ inc(reg); // 1 more for alignment 2885 __ inc(reg); // 1 more for alignment
2884 } 2886 }
2885 __ shl(reg, kPointerSizeLog2); 2887 __ shl(reg, kPointerSizeLog2);
2886 __ add(esp, reg); 2888 __ add(esp, reg);
2887 __ jmp(return_addr_reg); 2889 __ jmp(return_addr_reg);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
3438 Representation key_representation, 3440 Representation key_representation,
3439 ElementsKind elements_kind, 3441 ElementsKind elements_kind,
3440 uint32_t offset, 3442 uint32_t offset,
3441 uint32_t additional_index) { 3443 uint32_t additional_index) {
3442 Register elements_pointer_reg = ToRegister(elements_pointer); 3444 Register elements_pointer_reg = ToRegister(elements_pointer);
3443 int element_shift_size = ElementsKindToShiftSize(elements_kind); 3445 int element_shift_size = ElementsKindToShiftSize(elements_kind);
3444 int shift_size = element_shift_size; 3446 int shift_size = element_shift_size;
3445 if (key->IsConstantOperand()) { 3447 if (key->IsConstantOperand()) {
3446 int constant_value = ToInteger32(LConstantOperand::cast(key)); 3448 int constant_value = ToInteger32(LConstantOperand::cast(key));
3447 if (constant_value & 0xF0000000) { 3449 if (constant_value & 0xF0000000) {
3448 Abort(kArrayIndexConstantValueTooBig); 3450 Abort("array index constant value too big");
3449 } 3451 }
3450 return Operand(elements_pointer_reg, 3452 return Operand(elements_pointer_reg,
3451 ((constant_value + additional_index) << shift_size) 3453 ((constant_value + additional_index) << shift_size)
3452 + offset); 3454 + offset);
3453 } else { 3455 } else {
3454 // Take the tag bit into account while computing the shift size. 3456 // Take the tag bit into account while computing the shift size.
3455 if (key_representation.IsSmi() && (shift_size >= 1)) { 3457 if (key_representation.IsSmi() && (shift_size >= 1)) {
3456 shift_size -= kSmiTagSize; 3458 shift_size -= kSmiTagSize;
3457 } 3459 }
3458 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); 3460 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 ASSERT(instr->value()->Equals(instr->result())); 3814 ASSERT(instr->value()->Equals(instr->result()));
3813 Representation r = instr->hydrogen()->value()->representation(); 3815 Representation r = instr->hydrogen()->value()->representation();
3814 3816
3815 CpuFeatureScope scope(masm(), SSE2); 3817 CpuFeatureScope scope(masm(), SSE2);
3816 if (r.IsDouble()) { 3818 if (r.IsDouble()) {
3817 XMMRegister scratch = xmm0; 3819 XMMRegister scratch = xmm0;
3818 XMMRegister input_reg = ToDoubleRegister(instr->value()); 3820 XMMRegister input_reg = ToDoubleRegister(instr->value());
3819 __ xorps(scratch, scratch); 3821 __ xorps(scratch, scratch);
3820 __ subsd(scratch, input_reg); 3822 __ subsd(scratch, input_reg);
3821 __ pand(input_reg, scratch); 3823 __ pand(input_reg, scratch);
3822 } else if (r.IsSmiOrInteger32()) { 3824 } else if (r.IsInteger32()) {
3823 EmitIntegerMathAbs(instr); 3825 EmitIntegerMathAbs(instr);
3824 } else { // Tagged case. 3826 } else { // Tagged case.
3825 DeferredMathAbsTaggedHeapNumber* deferred = 3827 DeferredMathAbsTaggedHeapNumber* deferred =
3826 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); 3828 new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr);
3827 Register input_reg = ToRegister(instr->value()); 3829 Register input_reg = ToRegister(instr->value());
3828 // Smi check. 3830 // Smi check.
3829 __ JumpIfNotSmi(input_reg, deferred->entry()); 3831 __ JumpIfNotSmi(input_reg, deferred->entry());
3830 EmitIntegerMathAbs(instr); 3832 EmitIntegerMathAbs(instr);
3831 __ bind(deferred->exit()); 3833 __ bind(deferred->exit());
3832 } 3834 }
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
5784 Handle<Cell> cell = isolate()->factory()->NewCell(target); 5786 Handle<Cell> cell = isolate()->factory()->NewCell(target);
5785 __ cmp(reg, Operand::ForCell(cell)); 5787 __ cmp(reg, Operand::ForCell(cell));
5786 } else { 5788 } else {
5787 Operand operand = ToOperand(instr->value()); 5789 Operand operand = ToOperand(instr->value());
5788 __ cmp(operand, target); 5790 __ cmp(operand, target);
5789 } 5791 }
5790 DeoptimizeIf(not_equal, instr->environment()); 5792 DeoptimizeIf(not_equal, instr->environment());
5791 } 5793 }
5792 5794
5793 5795
5794 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { 5796 void LCodeGen::DoCheckMapCommon(Register reg,
5795 { 5797 Handle<Map> map,
5796 PushSafepointRegistersScope scope(this); 5798 LInstruction* instr) {
5797 __ push(object); 5799 Label success;
5798 __ xor_(esi, esi); 5800 __ CompareMap(reg, map, &success);
5799 __ CallRuntimeSaveDoubles(Runtime::kMigrateInstance); 5801 DeoptimizeIf(not_equal, instr->environment());
5800 RecordSafepointWithRegisters( 5802 __ bind(&success);
5801 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
5802
5803 __ test(eax, Immediate(kSmiTagMask));
5804 }
5805 DeoptimizeIf(zero, instr->environment());
5806 } 5803 }
5807 5804
5808 5805
5809 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { 5806 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5810 class DeferredCheckMaps: public LDeferredCode {
5811 public:
5812 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
5813 : LDeferredCode(codegen), instr_(instr), object_(object) {
5814 SetExit(check_maps());
5815 }
5816 virtual void Generate() {
5817 codegen()->DoDeferredInstanceMigration(instr_, object_);
5818 }
5819 Label* check_maps() { return &check_maps_; }
5820 virtual LInstruction* instr() { return instr_; }
5821 private:
5822 LCheckMaps* instr_;
5823 Label check_maps_;
5824 Register object_;
5825 };
5826
5827 if (instr->hydrogen()->CanOmitMapChecks()) return; 5807 if (instr->hydrogen()->CanOmitMapChecks()) return;
5828
5829 LOperand* input = instr->value(); 5808 LOperand* input = instr->value();
5830 ASSERT(input->IsRegister()); 5809 ASSERT(input->IsRegister());
5831 Register reg = ToRegister(input); 5810 Register reg = ToRegister(input);
5832 5811
5812 Label success;
5833 SmallMapList* map_set = instr->hydrogen()->map_set(); 5813 SmallMapList* map_set = instr->hydrogen()->map_set();
5834
5835 DeferredCheckMaps* deferred = NULL;
5836 if (instr->hydrogen()->has_migration_target()) {
5837 deferred = new(zone()) DeferredCheckMaps(this, instr, reg);
5838 __ bind(deferred->check_maps());
5839 }
5840
5841 Label success;
5842 for (int i = 0; i < map_set->length() - 1; i++) { 5814 for (int i = 0; i < map_set->length() - 1; i++) {
5843 Handle<Map> map = map_set->at(i); 5815 Handle<Map> map = map_set->at(i);
5844 __ CompareMap(reg, map, &success); 5816 __ CompareMap(reg, map, &success);
5845 __ j(equal, &success); 5817 __ j(equal, &success);
5846 } 5818 }
5847
5848 Handle<Map> map = map_set->last(); 5819 Handle<Map> map = map_set->last();
5849 __ CompareMap(reg, map, &success); 5820 DoCheckMapCommon(reg, map, instr);
5850 if (instr->hydrogen()->has_migration_target()) {
5851 __ j(not_equal, deferred->entry());
5852 } else {
5853 DeoptimizeIf(not_equal, instr->environment());
5854 }
5855
5856 __ bind(&success); 5821 __ bind(&success);
5857 } 5822 }
5858 5823
5859 5824
5860 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { 5825 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
5861 CpuFeatureScope scope(masm(), SSE2); 5826 CpuFeatureScope scope(masm(), SSE2);
5862 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); 5827 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
5863 Register result_reg = ToRegister(instr->result()); 5828 Register result_reg = ToRegister(instr->result());
5864 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); 5829 __ ClampDoubleToUint8(value_reg, xmm0, result_reg);
5865 } 5830 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
6022 __ bind(&is_smi); 5987 __ bind(&is_smi);
6023 if (!input_reg.is(result_reg)) { 5988 if (!input_reg.is(result_reg)) {
6024 __ mov(result_reg, input_reg); 5989 __ mov(result_reg, input_reg);
6025 } 5990 }
6026 __ SmiUntag(result_reg); 5991 __ SmiUntag(result_reg);
6027 __ ClampUint8(result_reg); 5992 __ ClampUint8(result_reg);
6028 __ bind(&done); 5993 __ bind(&done);
6029 } 5994 }
6030 5995
6031 5996
5997 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
5998 if (instr->hydrogen()->CanOmitPrototypeChecks()) return;
5999 Register reg = ToRegister(instr->temp());
6000
6001 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes();
6002 ZoneList<Handle<Map> >* maps = instr->maps();
6003
6004 ASSERT(prototypes->length() == maps->length());
6005
6006 for (int i = 0; i < prototypes->length(); i++) {
6007 __ LoadHeapObject(reg, prototypes->at(i));
6008 DoCheckMapCommon(reg, maps->at(i), instr);
6009 }
6010 }
6011
6012
6032 void LCodeGen::DoAllocate(LAllocate* instr) { 6013 void LCodeGen::DoAllocate(LAllocate* instr) {
6033 class DeferredAllocate: public LDeferredCode { 6014 class DeferredAllocate: public LDeferredCode {
6034 public: 6015 public:
6035 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) 6016 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
6036 : LDeferredCode(codegen), instr_(instr) { } 6017 : LDeferredCode(codegen), instr_(instr) { }
6037 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 6018 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
6038 virtual LInstruction* instr() { return instr_; } 6019 virtual LInstruction* instr() { return instr_; }
6039 private: 6020 private:
6040 LAllocate* instr_; 6021 LAllocate* instr_;
6041 }; 6022 };
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 FixedArray::kHeaderSize - kPointerSize)); 6511 FixedArray::kHeaderSize - kPointerSize));
6531 __ bind(&done); 6512 __ bind(&done);
6532 } 6513 }
6533 6514
6534 6515
6535 #undef __ 6516 #undef __
6536 6517
6537 } } // namespace v8::internal 6518 } } // namespace v8::internal
6538 6519
6539 #endif // V8_TARGET_ARCH_IA32 6520 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698