OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3453 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3453 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3454 ZoneList<Expression*>* args = expr->arguments(); | 3454 ZoneList<Expression*>* args = expr->arguments(); |
3455 ASSERT(args->length() >= 2); | 3455 ASSERT(args->length() >= 2); |
3456 | 3456 |
3457 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3457 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3458 for (int i = 0; i < arg_count + 1; i++) { | 3458 for (int i = 0; i < arg_count + 1; i++) { |
3459 VisitForStackValue(args->at(i)); | 3459 VisitForStackValue(args->at(i)); |
3460 } | 3460 } |
3461 VisitForAccumulatorValue(args->last()); // Function. | 3461 VisitForAccumulatorValue(args->last()); // Function. |
3462 | 3462 |
3463 // Check for proxy. | 3463 Label runtime, done; |
3464 Label proxy, done; | 3464 // Check for non-function argument (including proxy). |
| 3465 __ JumpIfSmi(v0, &runtime); |
3465 __ GetObjectType(v0, a1, a1); | 3466 __ GetObjectType(v0, a1, a1); |
3466 __ Branch(&proxy, eq, a1, Operand(JS_FUNCTION_PROXY_TYPE)); | 3467 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); |
3467 | 3468 |
3468 // InvokeFunction requires the function in a1. Move it in there. | 3469 // InvokeFunction requires the function in a1. Move it in there. |
3469 __ mov(a1, result_register()); | 3470 __ mov(a1, result_register()); |
3470 ParameterCount count(arg_count); | 3471 ParameterCount count(arg_count); |
3471 __ InvokeFunction(a1, count, CALL_FUNCTION, | 3472 __ InvokeFunction(a1, count, CALL_FUNCTION, |
3472 NullCallWrapper(), CALL_AS_METHOD); | 3473 NullCallWrapper(), CALL_AS_METHOD); |
3473 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3474 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3474 __ jmp(&done); | 3475 __ jmp(&done); |
3475 | 3476 |
3476 __ bind(&proxy); | 3477 __ bind(&runtime); |
3477 __ push(v0); | 3478 __ push(v0); |
3478 __ CallRuntime(Runtime::kCall, args->length()); | 3479 __ CallRuntime(Runtime::kCall, args->length()); |
3479 __ bind(&done); | 3480 __ bind(&done); |
3480 | 3481 |
3481 context()->Plug(v0); | 3482 context()->Plug(v0); |
3482 } | 3483 } |
3483 | 3484 |
3484 | 3485 |
3485 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 3486 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
3486 RegExpConstructResultStub stub; | 3487 RegExpConstructResultStub stub; |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4610 *context_length = 0; | 4611 *context_length = 0; |
4611 return previous_; | 4612 return previous_; |
4612 } | 4613 } |
4613 | 4614 |
4614 | 4615 |
4615 #undef __ | 4616 #undef __ |
4616 | 4617 |
4617 } } // namespace v8::internal | 4618 } } // namespace v8::internal |
4618 | 4619 |
4619 #endif // V8_TARGET_ARCH_MIPS | 4620 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |