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

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

Issue 523051: Make the ResolvePossiblyDirectEval faster by avoiding the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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/scopes.cc ('k') | test/mjsunit/eval.js » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 } 2664 }
2665 2665
2666 // Prepare the stack for the call to ResolvePossiblyDirectEval. 2666 // Prepare the stack for the call to ResolvePossiblyDirectEval.
2667 frame_->PushElementAt(arg_count + 1); 2667 frame_->PushElementAt(arg_count + 1);
2668 if (arg_count > 0) { 2668 if (arg_count > 0) {
2669 frame_->PushElementAt(arg_count); 2669 frame_->PushElementAt(arg_count);
2670 } else { 2670 } else {
2671 frame_->Push(Factory::undefined_value()); 2671 frame_->Push(Factory::undefined_value());
2672 } 2672 }
2673 2673
2674 // Push the receiver.
2675 frame_->PushParameterAt(-1);
2676
2674 // Resolve the call. 2677 // Resolve the call.
2675 Result result = 2678 Result result =
2676 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 2); 2679 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 3);
2677 2680
2678 // Touch up the stack with the right values for the function and the 2681 // The runtime call returns a pair of values in rax (function) and
2679 // receiver. Use a scratch register to avoid destroying the result. 2682 // rdx (receiver). Touch up the stack with the right values.
2680 Result scratch = allocator_->Allocate(); 2683 Result receiver = allocator_->Allocate(rdx);
2681 ASSERT(scratch.is_valid()); 2684 frame_->SetElementAt(arg_count + 1, &result);
2682 __ movq(scratch.reg(), 2685 frame_->SetElementAt(arg_count, &receiver);
2683 FieldOperand(result.reg(), FixedArray::OffsetOfElementAt(0))); 2686 receiver.Unuse();
2684 frame_->SetElementAt(arg_count + 1, &scratch);
2685
2686 // We can reuse the result register now.
2687 frame_->Spill(result.reg());
2688 __ movq(result.reg(),
2689 FieldOperand(result.reg(), FixedArray::OffsetOfElementAt(1)));
2690 frame_->SetElementAt(arg_count, &result);
2691 2687
2692 // Call the function. 2688 // Call the function.
2693 CodeForSourcePosition(node->position()); 2689 CodeForSourcePosition(node->position());
2694 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 2690 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
2695 CallFunctionStub call_function(arg_count, in_loop); 2691 CallFunctionStub call_function(arg_count, in_loop);
2696 result = frame_->CallStub(&call_function, arg_count + 1); 2692 result = frame_->CallStub(&call_function, arg_count + 1);
2697 2693
2698 // Restore the context and overwrite the function on the stack with 2694 // Restore the context and overwrite the function on the stack with
2699 // the result. 2695 // the result.
2700 frame_->RestoreContextRegister(); 2696 frame_->RestoreContextRegister();
(...skipping 5343 matching lines...) Expand 10 before | Expand all | Expand 10 after
8044 masm.GetCode(&desc); 8040 masm.GetCode(&desc);
8045 // Call the function from C++. 8041 // Call the function from C++.
8046 return FUNCTION_CAST<ModuloFunction>(buffer); 8042 return FUNCTION_CAST<ModuloFunction>(buffer);
8047 } 8043 }
8048 8044
8049 #endif 8045 #endif
8050 8046
8051 #undef __ 8047 #undef __
8052 8048
8053 } } // namespace v8::internal 8049 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | test/mjsunit/eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698