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 3341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3352 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3352 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3353 ZoneList<Expression*>* args = expr->arguments(); | 3353 ZoneList<Expression*>* args = expr->arguments(); |
3354 ASSERT(args->length() >= 2); | 3354 ASSERT(args->length() >= 2); |
3355 | 3355 |
3356 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3356 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3357 for (int i = 0; i < arg_count + 1; ++i) { | 3357 for (int i = 0; i < arg_count + 1; ++i) { |
3358 VisitForStackValue(args->at(i)); | 3358 VisitForStackValue(args->at(i)); |
3359 } | 3359 } |
3360 VisitForAccumulatorValue(args->last()); // Function. | 3360 VisitForAccumulatorValue(args->last()); // Function. |
3361 | 3361 |
3362 // Check for proxy. | 3362 Label runtime, done; |
3363 Label proxy, done; | 3363 // Check for non-function argument (including proxy). |
3364 __ CmpObjectType(eax, JS_FUNCTION_PROXY_TYPE, ebx); | 3364 __ JumpIfSmi(eax, &runtime); |
3365 __ j(equal, &proxy); | 3365 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); |
| 3366 __ j(not_equal, &runtime); |
3366 | 3367 |
3367 // InvokeFunction requires the function in edi. Move it in there. | 3368 // InvokeFunction requires the function in edi. Move it in there. |
3368 __ mov(edi, result_register()); | 3369 __ mov(edi, result_register()); |
3369 ParameterCount count(arg_count); | 3370 ParameterCount count(arg_count); |
3370 __ InvokeFunction(edi, count, CALL_FUNCTION, | 3371 __ InvokeFunction(edi, count, CALL_FUNCTION, |
3371 NullCallWrapper(), CALL_AS_METHOD); | 3372 NullCallWrapper(), CALL_AS_METHOD); |
3372 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3373 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3373 __ jmp(&done); | 3374 __ jmp(&done); |
3374 | 3375 |
3375 __ bind(&proxy); | 3376 __ bind(&runtime); |
3376 __ push(eax); | 3377 __ push(eax); |
3377 __ CallRuntime(Runtime::kCall, args->length()); | 3378 __ CallRuntime(Runtime::kCall, args->length()); |
3378 __ bind(&done); | 3379 __ bind(&done); |
3379 | 3380 |
3380 context()->Plug(eax); | 3381 context()->Plug(eax); |
3381 } | 3382 } |
3382 | 3383 |
3383 | 3384 |
3384 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 3385 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
3385 // Load the arguments on the stack and call the stub. | 3386 // Load the arguments on the stack and call the stub. |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4544 *stack_depth = 0; | 4545 *stack_depth = 0; |
4545 *context_length = 0; | 4546 *context_length = 0; |
4546 return previous_; | 4547 return previous_; |
4547 } | 4548 } |
4548 | 4549 |
4549 #undef __ | 4550 #undef __ |
4550 | 4551 |
4551 } } // namespace v8::internal | 4552 } } // namespace v8::internal |
4552 | 4553 |
4553 #endif // V8_TARGET_ARCH_IA32 | 4554 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |