OLD | NEW |
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 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 ZoneList<Expression*>* args = expr->arguments(); | 2235 ZoneList<Expression*>* args = expr->arguments(); |
2236 int arg_count = args->length(); | 2236 int arg_count = args->length(); |
2237 { PreservePositionScope scope(masm()->positions_recorder()); | 2237 { PreservePositionScope scope(masm()->positions_recorder()); |
2238 for (int i = 0; i < arg_count; i++) { | 2238 for (int i = 0; i < arg_count; i++) { |
2239 VisitForStackValue(args->at(i)); | 2239 VisitForStackValue(args->at(i)); |
2240 } | 2240 } |
2241 } | 2241 } |
2242 // Record source position for debugger. | 2242 // Record source position for debugger. |
2243 SetSourcePosition(expr->position()); | 2243 SetSourcePosition(expr->position()); |
2244 CallFunctionStub stub(arg_count, flags); | 2244 CallFunctionStub stub(arg_count, flags); |
| 2245 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2245 __ CallStub(&stub); | 2246 __ CallStub(&stub); |
2246 RecordJSReturnSite(expr); | 2247 RecordJSReturnSite(expr); |
2247 // Restore context register. | 2248 // Restore context register. |
2248 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2249 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2249 context()->DropAndPlug(1, v0); | 2250 context()->DropAndPlug(1, v0); |
2250 } | 2251 } |
2251 | 2252 |
2252 | 2253 |
2253 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2254 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2254 // Push copy of the first argument or undefined if it doesn't exist. | 2255 // Push copy of the first argument or undefined if it doesn't exist. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 EmitResolvePossiblyDirectEval(arg_count); | 2312 EmitResolvePossiblyDirectEval(arg_count); |
2312 | 2313 |
2313 // The runtime call returns a pair of values in v0 (function) and | 2314 // The runtime call returns a pair of values in v0 (function) and |
2314 // v1 (receiver). Touch up the stack with the right values. | 2315 // v1 (receiver). Touch up the stack with the right values. |
2315 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2316 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2316 __ sw(v1, MemOperand(sp, arg_count * kPointerSize)); | 2317 __ sw(v1, MemOperand(sp, arg_count * kPointerSize)); |
2317 } | 2318 } |
2318 // Record source position for debugger. | 2319 // Record source position for debugger. |
2319 SetSourcePosition(expr->position()); | 2320 SetSourcePosition(expr->position()); |
2320 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); | 2321 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); |
| 2322 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2321 __ CallStub(&stub); | 2323 __ CallStub(&stub); |
2322 RecordJSReturnSite(expr); | 2324 RecordJSReturnSite(expr); |
2323 // Restore context register. | 2325 // Restore context register. |
2324 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2326 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2325 context()->DropAndPlug(1, v0); | 2327 context()->DropAndPlug(1, v0); |
2326 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2328 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { |
2327 // Push global object as receiver for the call IC. | 2329 // Push global object as receiver for the call IC. |
2328 __ lw(a0, GlobalObjectOperand()); | 2330 __ lw(a0, GlobalObjectOperand()); |
2329 __ push(a0); | 2331 __ push(a0); |
2330 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); | 2332 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3223 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3225 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3224 ZoneList<Expression*>* args = expr->arguments(); | 3226 ZoneList<Expression*>* args = expr->arguments(); |
3225 ASSERT(args->length() >= 2); | 3227 ASSERT(args->length() >= 2); |
3226 | 3228 |
3227 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3229 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3228 for (int i = 0; i < arg_count + 1; i++) { | 3230 for (int i = 0; i < arg_count + 1; i++) { |
3229 VisitForStackValue(args->at(i)); | 3231 VisitForStackValue(args->at(i)); |
3230 } | 3232 } |
3231 VisitForAccumulatorValue(args->last()); // Function. | 3233 VisitForAccumulatorValue(args->last()); // Function. |
3232 | 3234 |
| 3235 // Check for proxy. |
| 3236 Label proxy, done; |
| 3237 __ GetObjectType(v0, a1, a1); |
| 3238 __ Branch(&proxy, eq, a1, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 3239 |
3233 // InvokeFunction requires the function in a1. Move it in there. | 3240 // InvokeFunction requires the function in a1. Move it in there. |
3234 __ mov(a1, result_register()); | 3241 __ mov(a1, result_register()); |
3235 ParameterCount count(arg_count); | 3242 ParameterCount count(arg_count); |
3236 __ InvokeFunction(a1, count, CALL_FUNCTION, | 3243 __ InvokeFunction(a1, count, CALL_FUNCTION, |
3237 NullCallWrapper(), CALL_AS_METHOD); | 3244 NullCallWrapper(), CALL_AS_METHOD); |
3238 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3245 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3246 __ jmp(&done); |
| 3247 |
| 3248 __ bind(&proxy); |
| 3249 __ push(v0); |
| 3250 __ CallRuntime(Runtime::kCall, args->length()); |
| 3251 __ bind(&done); |
| 3252 |
3239 context()->Plug(v0); | 3253 context()->Plug(v0); |
3240 } | 3254 } |
3241 | 3255 |
3242 | 3256 |
3243 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 3257 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
3244 RegExpConstructResultStub stub; | 3258 RegExpConstructResultStub stub; |
3245 ZoneList<Expression*>* args = expr->arguments(); | 3259 ZoneList<Expression*>* args = expr->arguments(); |
3246 ASSERT(args->length() == 3); | 3260 ASSERT(args->length() == 3); |
3247 VisitForStackValue(args->at(0)); | 3261 VisitForStackValue(args->at(0)); |
3248 VisitForStackValue(args->at(1)); | 3262 VisitForStackValue(args->at(1)); |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4420 *context_length = 0; | 4434 *context_length = 0; |
4421 return previous_; | 4435 return previous_; |
4422 } | 4436 } |
4423 | 4437 |
4424 | 4438 |
4425 #undef __ | 4439 #undef __ |
4426 | 4440 |
4427 } } // namespace v8::internal | 4441 } } // namespace v8::internal |
4428 | 4442 |
4429 #endif // V8_TARGET_ARCH_MIPS | 4443 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |