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

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

Issue 172133003: Harmony: optimize Math.clz32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 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
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | src/x64/lithium-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after
3722 __ movsd(Operand(rsp, 0), input_reg); 3722 __ movsd(Operand(rsp, 0), input_reg);
3723 __ fld_d(Operand(rsp, 0)); 3723 __ fld_d(Operand(rsp, 0));
3724 __ fyl2x(); 3724 __ fyl2x();
3725 __ fstp_d(Operand(rsp, 0)); 3725 __ fstp_d(Operand(rsp, 0));
3726 __ movsd(input_reg, Operand(rsp, 0)); 3726 __ movsd(input_reg, Operand(rsp, 0));
3727 __ addq(rsp, Immediate(kDoubleSize)); 3727 __ addq(rsp, Immediate(kDoubleSize));
3728 __ bind(&done); 3728 __ bind(&done);
3729 } 3729 }
3730 3730
3731 3731
3732 void LCodeGen::DoMathClz32(LMathClz32* instr) {
3733 Register input = ToRegister(instr->value());
3734 Register result = ToRegister(instr->result());
3735 Label not_zero_input;
3736 __ bsrl(result, input);
3737
3738 __ j(not_zero, &not_zero_input);
3739 __ Set(result, 63); // 63^31 == 32
3740
3741 __ bind(&not_zero_input);
3742 __ xorl(result, Immediate(31)); // for x in [0..31], 31^x == 31-x.
3743 }
3744
3745
3732 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { 3746 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3733 ASSERT(ToRegister(instr->context()).is(rsi)); 3747 ASSERT(ToRegister(instr->context()).is(rsi));
3734 ASSERT(ToRegister(instr->function()).is(rdi)); 3748 ASSERT(ToRegister(instr->function()).is(rdi));
3735 ASSERT(instr->HasPointerMap()); 3749 ASSERT(instr->HasPointerMap());
3736 3750
3737 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); 3751 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
3738 if (known_function.is_null()) { 3752 if (known_function.is_null()) {
3739 LPointerMap* pointers = instr->pointer_map(); 3753 LPointerMap* pointers = instr->pointer_map();
3740 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3754 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3741 ParameterCount count(instr->arity()); 3755 ParameterCount count(instr->arity());
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
5564 FixedArray::kHeaderSize - kPointerSize)); 5578 FixedArray::kHeaderSize - kPointerSize));
5565 __ bind(&done); 5579 __ bind(&done);
5566 } 5580 }
5567 5581
5568 5582
5569 #undef __ 5583 #undef __
5570 5584
5571 } } // namespace v8::internal 5585 } } // namespace v8::internal
5572 5586
5573 #endif // V8_TARGET_ARCH_X64 5587 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/disasm-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698