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

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

Issue 246019: Move the per-ast-node statement position to only statement node types.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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/codegen-x64.h ('k') | no next file » | 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 VisitStatements(node->statements()); 906 VisitStatements(node->statements());
907 if (node->break_target()->is_linked()) { 907 if (node->break_target()->is_linked()) {
908 node->break_target()->Bind(); 908 node->break_target()->Bind();
909 } 909 }
910 node->break_target()->Unuse(); 910 node->break_target()->Unuse();
911 } 911 }
912 912
913 913
914 void CodeGenerator::VisitDeclaration(Declaration* node) { 914 void CodeGenerator::VisitDeclaration(Declaration* node) {
915 Comment cmnt(masm_, "[ Declaration"); 915 Comment cmnt(masm_, "[ Declaration");
916 CodeForStatementPosition(node);
917 Variable* var = node->proxy()->var(); 916 Variable* var = node->proxy()->var();
918 ASSERT(var != NULL); // must have been resolved 917 ASSERT(var != NULL); // must have been resolved
919 Slot* slot = var->slot(); 918 Slot* slot = var->slot();
920 919
921 // If it was not possible to allocate the variable at compile time, 920 // If it was not possible to allocate the variable at compile time,
922 // we need to "declare" it at runtime to make sure it actually 921 // we need to "declare" it at runtime to make sure it actually
923 // exists in the local context. 922 // exists in the local context.
924 if (slot != NULL && slot->type() == Slot::LOOKUP) { 923 if (slot != NULL && slot->type() == Slot::LOOKUP) {
925 // Variables with a "LOOKUP" slot were introduced as non-locals 924 // Variables with a "LOOKUP" slot were introduced as non-locals
926 // during variable resolution and must have mode DYNAMIC. 925 // during variable resolution and must have mode DYNAMIC.
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 Load(node->key()); 2584 Load(node->key());
2586 Load(node->value()); 2585 Load(node->value());
2587 Result result = 2586 Result result =
2588 frame_->CallRuntime(Runtime::kCreateCatchExtensionObject, 2); 2587 frame_->CallRuntime(Runtime::kCreateCatchExtensionObject, 2);
2589 frame_->Push(&result); 2588 frame_->Push(&result);
2590 } 2589 }
2591 2590
2592 2591
2593 void CodeGenerator::VisitAssignment(Assignment* node) { 2592 void CodeGenerator::VisitAssignment(Assignment* node) {
2594 Comment cmnt(masm_, "[ Assignment"); 2593 Comment cmnt(masm_, "[ Assignment");
2595 CodeForStatementPosition(node);
2596 2594
2597 { Reference target(this, node->target()); 2595 { Reference target(this, node->target());
2598 if (target.is_illegal()) { 2596 if (target.is_illegal()) {
2599 // Fool the virtual frame into thinking that we left the assignment's 2597 // Fool the virtual frame into thinking that we left the assignment's
2600 // value on the frame. 2598 // value on the frame.
2601 frame_->Push(Smi::FromInt(0)); 2599 frame_->Push(Smi::FromInt(0));
2602 return; 2600 return;
2603 } 2601 }
2604 Variable* var = node->target()->AsVariableProxy()->AsVariable(); 2602 Variable* var = node->target()->AsVariableProxy()->AsVariable();
2605 2603
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 frame_->PushElementAt(target.size()); 2665 frame_->PushElementAt(target.size());
2668 Result ignored = frame_->CallRuntime(Runtime::kToFastProperties, 1); 2666 Result ignored = frame_->CallRuntime(Runtime::kToFastProperties, 1);
2669 } 2667 }
2670 } 2668 }
2671 } 2669 }
2672 } 2670 }
2673 2671
2674 2672
2675 void CodeGenerator::VisitThrow(Throw* node) { 2673 void CodeGenerator::VisitThrow(Throw* node) {
2676 Comment cmnt(masm_, "[ Throw"); 2674 Comment cmnt(masm_, "[ Throw");
2677 CodeForStatementPosition(node);
2678
2679 Load(node->exception()); 2675 Load(node->exception());
2680 Result result = frame_->CallRuntime(Runtime::kThrow, 1); 2676 Result result = frame_->CallRuntime(Runtime::kThrow, 1);
2681 frame_->Push(&result); 2677 frame_->Push(&result);
2682 } 2678 }
2683 2679
2684 2680
2685 void CodeGenerator::VisitProperty(Property* node) { 2681 void CodeGenerator::VisitProperty(Property* node) {
2686 Comment cmnt(masm_, "[ Property"); 2682 Comment cmnt(masm_, "[ Property");
2687 Reference property(this, node); 2683 Reference property(this, node);
2688 property.GetValue(typeof_state()); 2684 property.GetValue(typeof_state());
2689 } 2685 }
2690 2686
2691 2687
2692 void CodeGenerator::VisitCall(Call* node) { 2688 void CodeGenerator::VisitCall(Call* node) {
2693 Comment cmnt(masm_, "[ Call"); 2689 Comment cmnt(masm_, "[ Call");
2694 2690
2695 ZoneList<Expression*>* args = node->arguments(); 2691 ZoneList<Expression*>* args = node->arguments();
2696 2692
2697 CodeForStatementPosition(node);
2698
2699 // Check if the function is a variable or a property. 2693 // Check if the function is a variable or a property.
2700 Expression* function = node->expression(); 2694 Expression* function = node->expression();
2701 Variable* var = function->AsVariableProxy()->AsVariable(); 2695 Variable* var = function->AsVariableProxy()->AsVariable();
2702 Property* property = function->AsProperty(); 2696 Property* property = function->AsProperty();
2703 2697
2704 // ------------------------------------------------------------------------ 2698 // ------------------------------------------------------------------------
2705 // Fast-case: Use inline caching. 2699 // Fast-case: Use inline caching.
2706 // --- 2700 // ---
2707 // According to ECMA-262, section 11.2.3, page 44, the function to call 2701 // According to ECMA-262, section 11.2.3, page 44, the function to call
2708 // must be resolved after the arguments have been evaluated. The IC code 2702 // must be resolved after the arguments have been evaluated. The IC code
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2848 void CodeGenerator::VisitCallEval(CallEval* node) { 2842 void CodeGenerator::VisitCallEval(CallEval* node) {
2849 Comment cmnt(masm_, "[ CallEval"); 2843 Comment cmnt(masm_, "[ CallEval");
2850 2844
2851 // In a call to eval, we first call %ResolvePossiblyDirectEval to resolve 2845 // In a call to eval, we first call %ResolvePossiblyDirectEval to resolve
2852 // the function we need to call and the receiver of the call. 2846 // the function we need to call and the receiver of the call.
2853 // Then we call the resolved function using the given arguments. 2847 // Then we call the resolved function using the given arguments.
2854 2848
2855 ZoneList<Expression*>* args = node->arguments(); 2849 ZoneList<Expression*>* args = node->arguments();
2856 Expression* function = node->expression(); 2850 Expression* function = node->expression();
2857 2851
2858 CodeForStatementPosition(node);
2859
2860 // Prepare the stack for the call to the resolved function. 2852 // Prepare the stack for the call to the resolved function.
2861 Load(function); 2853 Load(function);
2862 2854
2863 // Allocate a frame slot for the receiver. 2855 // Allocate a frame slot for the receiver.
2864 frame_->Push(Factory::undefined_value()); 2856 frame_->Push(Factory::undefined_value());
2865 int arg_count = args->length(); 2857 int arg_count = args->length();
2866 for (int i = 0; i < arg_count; i++) { 2858 for (int i = 0; i < arg_count; i++) {
2867 Load(args->at(i)); 2859 Load(args->at(i));
2868 } 2860 }
2869 2861
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2901 2893
2902 // Restore the context and overwrite the function on the stack with 2894 // Restore the context and overwrite the function on the stack with
2903 // the result. 2895 // the result.
2904 frame_->RestoreContextRegister(); 2896 frame_->RestoreContextRegister();
2905 frame_->SetElementAt(0, &result); 2897 frame_->SetElementAt(0, &result);
2906 } 2898 }
2907 2899
2908 2900
2909 void CodeGenerator::VisitCallNew(CallNew* node) { 2901 void CodeGenerator::VisitCallNew(CallNew* node) {
2910 Comment cmnt(masm_, "[ CallNew"); 2902 Comment cmnt(masm_, "[ CallNew");
2911 CodeForStatementPosition(node);
2912 2903
2913 // According to ECMA-262, section 11.2.2, page 44, the function 2904 // According to ECMA-262, section 11.2.2, page 44, the function
2914 // expression in new calls must be evaluated before the 2905 // expression in new calls must be evaluated before the
2915 // arguments. This is different from ordinary calls, where the 2906 // arguments. This is different from ordinary calls, where the
2916 // actual function to call is resolved after the arguments have been 2907 // actual function to call is resolved after the arguments have been
2917 // evaluated. 2908 // evaluated.
2918 2909
2919 // Compute function to call and use the global object as the 2910 // Compute function to call and use the global object as the
2920 // receiver. There is no need to use the global proxy here because 2911 // receiver. There is no need to use the global proxy here because
2921 // it will always be replaced with a newly allocated object. 2912 // it will always be replaced with a newly allocated object.
(...skipping 4761 matching lines...) Expand 10 before | Expand all | Expand 10 after
7683 int CompareStub::MinorKey() { 7674 int CompareStub::MinorKey() {
7684 // Encode the two parameters in a unique 16 bit value. 7675 // Encode the two parameters in a unique 16 bit value.
7685 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7676 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7686 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7677 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7687 } 7678 }
7688 7679
7689 7680
7690 #undef __ 7681 #undef __
7691 7682
7692 } } // namespace v8::internal 7683 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698