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

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

Issue 10543094: Eliminate redundant smi checks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Delay SMI checks as long as possible Created 8 years, 6 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 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 // Load the result. 2382 // Load the result.
2383 __ movq(result, 2383 __ movq(result,
2384 BuildFastArrayOperand(instr->elements(), 2384 BuildFastArrayOperand(instr->elements(),
2385 instr->key(), 2385 instr->key(),
2386 FAST_ELEMENTS, 2386 FAST_ELEMENTS,
2387 FixedArray::kHeaderSize - kHeapObjectTag, 2387 FixedArray::kHeaderSize - kHeapObjectTag,
2388 instr->additional_index())); 2388 instr->additional_index()));
2389 2389
2390 // Check for the hole value. 2390 // Check for the hole value.
2391 if (instr->hydrogen()->RequiresHoleCheck()) { 2391 if (instr->hydrogen()->RequiresHoleCheck()) {
2392 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); 2392 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
2393 DeoptimizeIf(equal, instr->environment()); 2393 Condition smi = __ CheckSmi(result);
2394 DeoptimizeIf(NegateCondition(smi), instr->environment());
2395 } else {
2396 __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
2397 DeoptimizeIf(equal, instr->environment());
2398 }
2394 } 2399 }
2395 } 2400 }
2396 2401
2397 2402
2398 void LCodeGen::DoLoadKeyedFastDoubleElement( 2403 void LCodeGen::DoLoadKeyedFastDoubleElement(
2399 LLoadKeyedFastDoubleElement* instr) { 2404 LLoadKeyedFastDoubleElement* instr) {
2400 XMMRegister result(ToDoubleRegister(instr->result())); 2405 XMMRegister result(ToDoubleRegister(instr->result()));
2401 2406
2402 if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) { 2407 if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
2403 // Sign extend key because it could be a 32 bit negative value 2408 // Sign extend key because it could be a 32 bit negative value
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
3783 __ Integer32ToSmi(input, input); 3788 __ Integer32ToSmi(input, input);
3784 } 3789 }
3785 3790
3786 3791
3787 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { 3792 void LCodeGen::DoSmiUntag(LSmiUntag* instr) {
3788 ASSERT(instr->InputAt(0)->Equals(instr->result())); 3793 ASSERT(instr->InputAt(0)->Equals(instr->result()));
3789 Register input = ToRegister(instr->InputAt(0)); 3794 Register input = ToRegister(instr->InputAt(0));
3790 if (instr->needs_check()) { 3795 if (instr->needs_check()) {
3791 Condition is_smi = __ CheckSmi(input); 3796 Condition is_smi = __ CheckSmi(input);
3792 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); 3797 DeoptimizeIf(NegateCondition(is_smi), instr->environment());
3798 } else {
3799 #if DEBUG
3800 Label ok;
3801 Condition is_smi = __ CheckSmi(input);
3802 __ j(is_smi, &ok, Label::kNear);
3803 __ int3();
3804 __ bind(&ok);
3805 #endif
3793 } 3806 }
3794 __ SmiToInteger32(input, input); 3807 __ SmiToInteger32(input, input);
3795 } 3808 }
3796 3809
3797 3810
3798 void LCodeGen::EmitNumberUntagD(Register input_reg, 3811 void LCodeGen::EmitNumberUntagD(Register input_reg,
3799 XMMRegister result_reg, 3812 XMMRegister result_reg,
3800 bool deoptimize_on_undefined, 3813 bool deoptimize_on_undefined,
3801 bool deoptimize_on_minus_zero, 3814 bool deoptimize_on_minus_zero,
3802 LEnvironment* env) { 3815 LEnvironment* env) {
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
4896 FixedArray::kHeaderSize - kPointerSize)); 4909 FixedArray::kHeaderSize - kPointerSize));
4897 __ bind(&done); 4910 __ bind(&done);
4898 } 4911 }
4899 4912
4900 4913
4901 #undef __ 4914 #undef __
4902 4915
4903 } } // namespace v8::internal 4916 } } // namespace v8::internal
4904 4917
4905 #endif // V8_TARGET_ARCH_X64 4918 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698