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

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

Issue 7869009: Remove in-loop tracking for call ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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/v8globals.h ('k') | src/x64/ic-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 int arg_count = args->length(); 1919 int arg_count = args->length();
1920 { PreservePositionScope scope(masm()->positions_recorder()); 1920 { PreservePositionScope scope(masm()->positions_recorder());
1921 for (int i = 0; i < arg_count; i++) { 1921 for (int i = 0; i < arg_count; i++) {
1922 VisitForStackValue(args->at(i)); 1922 VisitForStackValue(args->at(i));
1923 } 1923 }
1924 __ Move(rcx, name); 1924 __ Move(rcx, name);
1925 } 1925 }
1926 // Record source position for debugger. 1926 // Record source position for debugger.
1927 SetSourcePosition(expr->position()); 1927 SetSourcePosition(expr->position());
1928 // Call the IC initialization code. 1928 // Call the IC initialization code.
1929 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1930 Handle<Code> ic = 1929 Handle<Code> ic =
1931 ISOLATE->stub_cache()->ComputeCallInitialize(arg_count, in_loop, mode); 1930 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
1932 __ call(ic, mode, expr->id()); 1931 __ call(ic, mode, expr->id());
1933 RecordJSReturnSite(expr); 1932 RecordJSReturnSite(expr);
1934 // Restore context register. 1933 // Restore context register.
1935 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 1934 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1936 context()->Plug(rax); 1935 context()->Plug(rax);
1937 } 1936 }
1938 1937
1939 1938
1940 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, 1939 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
1941 Expression* key) { 1940 Expression* key) {
(...skipping 10 matching lines...) Expand all
1952 ZoneList<Expression*>* args = expr->arguments(); 1951 ZoneList<Expression*>* args = expr->arguments();
1953 int arg_count = args->length(); 1952 int arg_count = args->length();
1954 { PreservePositionScope scope(masm()->positions_recorder()); 1953 { PreservePositionScope scope(masm()->positions_recorder());
1955 for (int i = 0; i < arg_count; i++) { 1954 for (int i = 0; i < arg_count; i++) {
1956 VisitForStackValue(args->at(i)); 1955 VisitForStackValue(args->at(i));
1957 } 1956 }
1958 } 1957 }
1959 // Record source position for debugger. 1958 // Record source position for debugger.
1960 SetSourcePosition(expr->position()); 1959 SetSourcePosition(expr->position());
1961 // Call the IC initialization code. 1960 // Call the IC initialization code.
1962 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1963 Handle<Code> ic = 1961 Handle<Code> ic =
1964 ISOLATE->stub_cache()->ComputeKeyedCallInitialize(arg_count, in_loop); 1962 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count);
1965 __ movq(rcx, Operand(rsp, (arg_count + 1) * kPointerSize)); // Key. 1963 __ movq(rcx, Operand(rsp, (arg_count + 1) * kPointerSize)); // Key.
1966 __ call(ic, RelocInfo::CODE_TARGET, expr->id()); 1964 __ call(ic, RelocInfo::CODE_TARGET, expr->id());
1967 RecordJSReturnSite(expr); 1965 RecordJSReturnSite(expr);
1968 // Restore context register. 1966 // Restore context register.
1969 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 1967 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1970 context()->DropAndPlug(1, rax); // Drop the key still on the stack. 1968 context()->DropAndPlug(1, rax); // Drop the key still on the stack.
1971 } 1969 }
1972 1970
1973 1971
1974 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { 1972 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
1975 // Code common for calls using the call stub. 1973 // Code common for calls using the call stub.
1976 ZoneList<Expression*>* args = expr->arguments(); 1974 ZoneList<Expression*>* args = expr->arguments();
1977 int arg_count = args->length(); 1975 int arg_count = args->length();
1978 { PreservePositionScope scope(masm()->positions_recorder()); 1976 { PreservePositionScope scope(masm()->positions_recorder());
1979 for (int i = 0; i < arg_count; i++) { 1977 for (int i = 0; i < arg_count; i++) {
1980 VisitForStackValue(args->at(i)); 1978 VisitForStackValue(args->at(i));
1981 } 1979 }
1982 } 1980 }
1983 // Record source position for debugger. 1981 // Record source position for debugger.
1984 SetSourcePosition(expr->position()); 1982 SetSourcePosition(expr->position());
1985 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1983 CallFunctionStub stub(arg_count, flags);
1986 CallFunctionStub stub(arg_count, in_loop, flags);
1987 __ CallStub(&stub); 1984 __ CallStub(&stub);
1988 RecordJSReturnSite(expr); 1985 RecordJSReturnSite(expr);
1989 // Restore context register. 1986 // Restore context register.
1990 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 1987 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1991 // Discard the function left on TOS. 1988 // Discard the function left on TOS.
1992 context()->DropAndPlug(1, rax); 1989 context()->DropAndPlug(1, rax);
1993 } 1990 }
1994 1991
1995 1992
1996 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, 1993 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 EmitResolvePossiblyDirectEval(PERFORM_CONTEXT_LOOKUP, arg_count); 2065 EmitResolvePossiblyDirectEval(PERFORM_CONTEXT_LOOKUP, arg_count);
2069 __ bind(&done); 2066 __ bind(&done);
2070 2067
2071 // The runtime call returns a pair of values in rax (function) and 2068 // The runtime call returns a pair of values in rax (function) and
2072 // rdx (receiver). Touch up the stack with the right values. 2069 // rdx (receiver). Touch up the stack with the right values.
2073 __ movq(Operand(rsp, (arg_count + 0) * kPointerSize), rdx); 2070 __ movq(Operand(rsp, (arg_count + 0) * kPointerSize), rdx);
2074 __ movq(Operand(rsp, (arg_count + 1) * kPointerSize), rax); 2071 __ movq(Operand(rsp, (arg_count + 1) * kPointerSize), rax);
2075 } 2072 }
2076 // Record source position for debugger. 2073 // Record source position for debugger.
2077 SetSourcePosition(expr->position()); 2074 SetSourcePosition(expr->position());
2078 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 2075 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT);
2079 CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_IMPLICIT);
2080 __ CallStub(&stub); 2076 __ CallStub(&stub);
2081 RecordJSReturnSite(expr); 2077 RecordJSReturnSite(expr);
2082 // Restore context register. 2078 // Restore context register.
2083 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2079 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2084 context()->DropAndPlug(1, rax); 2080 context()->DropAndPlug(1, rax);
2085 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { 2081 } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
2086 // Call to a global variable. Push global object as receiver for the 2082 // Call to a global variable. Push global object as receiver for the
2087 // call IC lookup. 2083 // call IC lookup.
2088 __ push(GlobalObjectOperand()); 2084 __ push(GlobalObjectOperand());
2089 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); 2085 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 3466
3471 // Push the arguments ("left-to-right"). 3467 // Push the arguments ("left-to-right").
3472 int arg_count = args->length(); 3468 int arg_count = args->length();
3473 for (int i = 0; i < arg_count; i++) { 3469 for (int i = 0; i < arg_count; i++) {
3474 VisitForStackValue(args->at(i)); 3470 VisitForStackValue(args->at(i));
3475 } 3471 }
3476 3472
3477 if (expr->is_jsruntime()) { 3473 if (expr->is_jsruntime()) {
3478 // Call the JS runtime function using a call IC. 3474 // Call the JS runtime function using a call IC.
3479 __ Move(rcx, expr->name()); 3475 __ Move(rcx, expr->name());
3480 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
3481 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; 3476 RelocInfo::Mode mode = RelocInfo::CODE_TARGET;
3482 Handle<Code> ic = 3477 Handle<Code> ic =
3483 ISOLATE->stub_cache()->ComputeCallInitialize(arg_count, in_loop, mode); 3478 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
3484 __ call(ic, mode, expr->id()); 3479 __ call(ic, mode, expr->id());
3485 // Restore context register. 3480 // Restore context register.
3486 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3481 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3487 } else { 3482 } else {
3488 __ CallRuntime(expr->function(), arg_count); 3483 __ CallRuntime(expr->function(), arg_count);
3489 } 3484 }
3490 context()->Plug(rax); 3485 context()->Plug(rax);
3491 } 3486 }
3492 3487
3493 3488
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
4156 *context_length = 0; 4151 *context_length = 0;
4157 return previous_; 4152 return previous_;
4158 } 4153 }
4159 4154
4160 4155
4161 #undef __ 4156 #undef __
4162 4157
4163 } } // namespace v8::internal 4158 } } // namespace v8::internal
4164 4159
4165 #endif // V8_TARGET_ARCH_X64 4160 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/v8globals.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698