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 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3317 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3317 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
3318 ZoneList<Expression*>* args = expr->arguments(); | 3318 ZoneList<Expression*>* args = expr->arguments(); |
3319 ASSERT(args->length() >= 2); | 3319 ASSERT(args->length() >= 2); |
3320 | 3320 |
3321 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3321 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
3322 for (int i = 0; i < arg_count + 1; i++) { | 3322 for (int i = 0; i < arg_count + 1; i++) { |
3323 VisitForStackValue(args->at(i)); | 3323 VisitForStackValue(args->at(i)); |
3324 } | 3324 } |
3325 VisitForAccumulatorValue(args->last()); // Function. | 3325 VisitForAccumulatorValue(args->last()); // Function. |
3326 | 3326 |
3327 // Check for proxy. | 3327 Label runtime, done; |
3328 Label proxy, done; | 3328 // Check for non-function argument (including proxy). |
3329 __ CmpObjectType(rax, JS_FUNCTION_PROXY_TYPE, rbx); | 3329 __ JumpIfSmi(rax, &runtime); |
3330 __ j(equal, &proxy); | 3330 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx); |
| 3331 __ j(not_equal, &runtime); |
3331 | 3332 |
3332 // InvokeFunction requires the function in rdi. Move it in there. | 3333 // InvokeFunction requires the function in rdi. Move it in there. |
3333 __ movq(rdi, result_register()); | 3334 __ movq(rdi, result_register()); |
3334 ParameterCount count(arg_count); | 3335 ParameterCount count(arg_count); |
3335 __ InvokeFunction(rdi, count, CALL_FUNCTION, | 3336 __ InvokeFunction(rdi, count, CALL_FUNCTION, |
3336 NullCallWrapper(), CALL_AS_METHOD); | 3337 NullCallWrapper(), CALL_AS_METHOD); |
3337 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 3338 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
3338 __ jmp(&done); | 3339 __ jmp(&done); |
3339 | 3340 |
3340 __ bind(&proxy); | 3341 __ bind(&runtime); |
3341 __ push(rax); | 3342 __ push(rax); |
3342 __ CallRuntime(Runtime::kCall, args->length()); | 3343 __ CallRuntime(Runtime::kCall, args->length()); |
3343 __ bind(&done); | 3344 __ bind(&done); |
3344 | 3345 |
3345 context()->Plug(rax); | 3346 context()->Plug(rax); |
3346 } | 3347 } |
3347 | 3348 |
3348 | 3349 |
3349 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 3350 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
3350 RegExpConstructResultStub stub; | 3351 RegExpConstructResultStub stub; |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4539 *context_length = 0; | 4540 *context_length = 0; |
4540 return previous_; | 4541 return previous_; |
4541 } | 4542 } |
4542 | 4543 |
4543 | 4544 |
4544 #undef __ | 4545 #undef __ |
4545 | 4546 |
4546 } } // namespace v8::internal | 4547 } } // namespace v8::internal |
4547 | 4548 |
4548 #endif // V8_TARGET_ARCH_X64 | 4549 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |