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

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

Issue 8318014: Make _CallFunction proxy-aware. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Kevin's comment. Created 9 years, 1 month 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/arm/debug-arm.cc ('k') | src/arm/lithium-arm.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 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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 ZoneList<Expression*>* args = expr->arguments(); 2108 ZoneList<Expression*>* args = expr->arguments();
2109 int arg_count = args->length(); 2109 int arg_count = args->length();
2110 { PreservePositionScope scope(masm()->positions_recorder()); 2110 { PreservePositionScope scope(masm()->positions_recorder());
2111 for (int i = 0; i < arg_count; i++) { 2111 for (int i = 0; i < arg_count; i++) {
2112 VisitForStackValue(args->at(i)); 2112 VisitForStackValue(args->at(i));
2113 } 2113 }
2114 } 2114 }
2115 // Record source position for debugger. 2115 // Record source position for debugger.
2116 SetSourcePosition(expr->position()); 2116 SetSourcePosition(expr->position());
2117 CallFunctionStub stub(arg_count, flags); 2117 CallFunctionStub stub(arg_count, flags);
2118 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2118 __ CallStub(&stub); 2119 __ CallStub(&stub);
2119 RecordJSReturnSite(expr); 2120 RecordJSReturnSite(expr);
2120 // Restore context register. 2121 // Restore context register.
2121 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2122 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2122 context()->DropAndPlug(1, r0); 2123 context()->DropAndPlug(1, r0);
2123 } 2124 }
2124 2125
2125 2126
2126 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, 2127 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
2127 int arg_count) { 2128 int arg_count) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 2206
2206 // The runtime call returns a pair of values in r0 (function) and 2207 // The runtime call returns a pair of values in r0 (function) and
2207 // r1 (receiver). Touch up the stack with the right values. 2208 // r1 (receiver). Touch up the stack with the right values.
2208 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 2209 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize));
2209 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); 2210 __ str(r1, MemOperand(sp, arg_count * kPointerSize));
2210 } 2211 }
2211 2212
2212 // Record source position for debugger. 2213 // Record source position for debugger.
2213 SetSourcePosition(expr->position()); 2214 SetSourcePosition(expr->position());
2214 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); 2215 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT);
2216 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
2215 __ CallStub(&stub); 2217 __ CallStub(&stub);
2216 RecordJSReturnSite(expr); 2218 RecordJSReturnSite(expr);
2217 // Restore context register. 2219 // Restore context register.
2218 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2220 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2219 context()->DropAndPlug(1, r0); 2221 context()->DropAndPlug(1, r0);
2220 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { 2222 } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
2221 // Push global object as receiver for the call IC. 2223 // Push global object as receiver for the call IC.
2222 __ ldr(r0, GlobalObjectOperand()); 2224 __ ldr(r0, GlobalObjectOperand());
2223 __ push(r0); 2225 __ push(r0);
2224 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); 2226 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 3092
3091 void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) { 3093 void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) {
3092 ASSERT(args->length() >= 2); 3094 ASSERT(args->length() >= 2);
3093 3095
3094 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3096 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3095 for (int i = 0; i < arg_count + 1; i++) { 3097 for (int i = 0; i < arg_count + 1; i++) {
3096 VisitForStackValue(args->at(i)); 3098 VisitForStackValue(args->at(i));
3097 } 3099 }
3098 VisitForAccumulatorValue(args->last()); // Function. 3100 VisitForAccumulatorValue(args->last()); // Function.
3099 3101
3102 // Check for proxy.
3103 Label proxy, done;
3104 __ CompareObjectType(r0, r1, r1, JS_FUNCTION_PROXY_TYPE);
3105 __ b(eq, &proxy);
3106
3100 // InvokeFunction requires the function in r1. Move it in there. 3107 // InvokeFunction requires the function in r1. Move it in there.
3101 __ mov(r1, result_register()); 3108 __ mov(r1, result_register());
3102 ParameterCount count(arg_count); 3109 ParameterCount count(arg_count);
3103 __ InvokeFunction(r1, count, CALL_FUNCTION, 3110 __ InvokeFunction(r1, count, CALL_FUNCTION,
3104 NullCallWrapper(), CALL_AS_METHOD); 3111 NullCallWrapper(), CALL_AS_METHOD);
3105 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3112 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3113 __ jmp(&done);
3114
3115 __ bind(&proxy);
3116 __ push(r0);
3117 __ CallRuntime(Runtime::kCall, args->length());
3118 __ bind(&done);
3119
3106 context()->Plug(r0); 3120 context()->Plug(r0);
3107 } 3121 }
3108 3122
3109 3123
3110 void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) { 3124 void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) {
3111 RegExpConstructResultStub stub; 3125 RegExpConstructResultStub stub;
3112 ASSERT(args->length() == 3); 3126 ASSERT(args->length() == 3);
3113 VisitForStackValue(args->at(0)); 3127 VisitForStackValue(args->at(0));
3114 VisitForStackValue(args->at(1)); 3128 VisitForStackValue(args->at(1));
3115 VisitForStackValue(args->at(2)); 3129 VisitForStackValue(args->at(2));
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4260 *context_length = 0; 4274 *context_length = 0;
4261 return previous_; 4275 return previous_;
4262 } 4276 }
4263 4277
4264 4278
4265 #undef __ 4279 #undef __
4266 4280
4267 } } // namespace v8::internal 4281 } } // namespace v8::internal
4268 4282
4269 #endif // V8_TARGET_ARCH_ARM 4283 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/debug-arm.cc ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698