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 16013003: Fix hole handling, and ensure smi representation is handled properly (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/hydrogen-instructions.cc ('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 3916 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 Representation exponent_type = instr->hydrogen()->right()->representation(); 3927 Representation exponent_type = instr->hydrogen()->right()->representation();
3928 // Having marked this as a call, we can use any registers. 3928 // Having marked this as a call, we can use any registers.
3929 // Just make sure that the input/output registers are the expected ones. 3929 // Just make sure that the input/output registers are the expected ones.
3930 ASSERT(!instr->right()->IsDoubleRegister() || 3930 ASSERT(!instr->right()->IsDoubleRegister() ||
3931 ToDoubleRegister(instr->right()).is(xmm1)); 3931 ToDoubleRegister(instr->right()).is(xmm1));
3932 ASSERT(!instr->right()->IsRegister() || 3932 ASSERT(!instr->right()->IsRegister() ||
3933 ToRegister(instr->right()).is(eax)); 3933 ToRegister(instr->right()).is(eax));
3934 ASSERT(ToDoubleRegister(instr->left()).is(xmm2)); 3934 ASSERT(ToDoubleRegister(instr->left()).is(xmm2));
3935 ASSERT(ToDoubleRegister(instr->result()).is(xmm3)); 3935 ASSERT(ToDoubleRegister(instr->result()).is(xmm3));
3936 3936
3937 if (exponent_type.IsTagged()) { 3937 if (exponent_type.IsSmi()) {
3938 MathPowStub stub(MathPowStub::TAGGED);
3939 __ CallStub(&stub);
3940 } else if (exponent_type.IsTagged()) {
3938 Label no_deopt; 3941 Label no_deopt;
3939 __ JumpIfSmi(eax, &no_deopt); 3942 __ JumpIfSmi(eax, &no_deopt);
3940 __ CmpObjectType(eax, HEAP_NUMBER_TYPE, ecx); 3943 __ CmpObjectType(eax, HEAP_NUMBER_TYPE, ecx);
3941 DeoptimizeIf(not_equal, instr->environment()); 3944 DeoptimizeIf(not_equal, instr->environment());
3942 __ bind(&no_deopt); 3945 __ bind(&no_deopt);
3943 MathPowStub stub(MathPowStub::TAGGED); 3946 MathPowStub stub(MathPowStub::TAGGED);
3944 __ CallStub(&stub); 3947 __ CallStub(&stub);
3945 } else if (exponent_type.IsInteger32()) { 3948 } else if (exponent_type.IsInteger32()) {
3946 MathPowStub stub(MathPowStub::INTEGER); 3949 MathPowStub stub(MathPowStub::INTEGER);
3947 __ CallStub(&stub); 3950 __ CallStub(&stub);
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
5050 } 5053 }
5051 5054
5052 5055
5053 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { 5056 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
5054 LOperand* input = instr->value(); 5057 LOperand* input = instr->value();
5055 Register result = ToRegister(input); 5058 Register result = ToRegister(input);
5056 ASSERT(input->IsRegister() && input->Equals(instr->result())); 5059 ASSERT(input->IsRegister() && input->Equals(instr->result()));
5057 if (instr->needs_check()) { 5060 if (instr->needs_check()) {
5058 __ test(result, Immediate(kSmiTagMask)); 5061 __ test(result, Immediate(kSmiTagMask));
5059 DeoptimizeIf(not_zero, instr->environment()); 5062 DeoptimizeIf(not_zero, instr->environment());
5060 } else if (instr->hydrogen()->value()->IsLoadKeyed()) {
5061 HLoadKeyed* load = HLoadKeyed::cast(instr->hydrogen()->value());
5062 if (load->UsesMustHandleHole()) {
5063 __ test(result, Immediate(kSmiTagMask));
5064 if (load->hole_mode() == ALLOW_RETURN_HOLE) {
5065 Label done;
5066 __ j(equal, &done);
5067 __ xor_(result, result);
5068 __ bind(&done);
5069 } else {
5070 DeoptimizeIf(not_zero, instr->environment());
5071 }
5072 } else {
5073 __ AssertSmi(result);
5074 }
5075 } else { 5063 } else {
5076 __ AssertSmi(result); 5064 __ AssertSmi(result);
5077 } 5065 }
5078 __ SmiUntag(result); 5066 __ SmiUntag(result);
5079 } 5067 }
5080 5068
5081 5069
5082 void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg, 5070 void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg,
5083 Register temp_reg, 5071 Register temp_reg,
5084 bool deoptimize_on_undefined, 5072 bool deoptimize_on_undefined,
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
6594 FixedArray::kHeaderSize - kPointerSize)); 6582 FixedArray::kHeaderSize - kPointerSize));
6595 __ bind(&done); 6583 __ bind(&done);
6596 } 6584 }
6597 6585
6598 6586
6599 #undef __ 6587 #undef __
6600 6588
6601 } } // namespace v8::internal 6589 } } // namespace v8::internal
6602 6590
6603 #endif // V8_TARGET_ARCH_IA32 6591 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698