Chromium Code Reviews| 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 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2499 __ bind(&done); | 2499 __ bind(&done); |
| 2500 } | 2500 } |
| 2501 | 2501 |
| 2502 | 2502 |
| 2503 void CallFunctionStub::Generate(MacroAssembler* masm) { | 2503 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 2504 // ebx : cache cell for call target | 2504 // ebx : cache cell for call target |
| 2505 // edi : the function to call | 2505 // edi : the function to call |
| 2506 Isolate* isolate = masm->isolate(); | 2506 Isolate* isolate = masm->isolate(); |
| 2507 Label slow, non_function; | 2507 Label slow, non_function; |
| 2508 | 2508 |
| 2509 // Check that the function really is a JavaScript function. | |
| 2510 __ JumpIfSmi(edi, &non_function); | |
| 2511 | |
| 2509 // The receiver might implicitly be the global object. This is | 2512 // The receiver might implicitly be the global object. This is |
| 2510 // indicated by passing the hole as the receiver to the call | 2513 // indicated by passing the hole as the receiver to the call |
| 2511 // function stub. | 2514 // function stub. |
| 2512 if (ReceiverMightBeImplicit()) { | 2515 if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) { |
| 2513 Label receiver_ok; | 2516 Label call, patch_current_context; |
| 2514 // Get the receiver from the stack. | 2517 if (ReceiverMightBeImplicit()) { |
| 2515 // +1 ~ return address | 2518 // Get the receiver from the stack. |
| 2516 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); | 2519 // +1 ~ return address |
| 2517 // Call as function is indicated with the hole. | 2520 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize)); |
| 2518 __ cmp(eax, isolate->factory()->the_hole_value()); | 2521 // Call as function is indicated with the hole. |
| 2519 __ j(not_equal, &receiver_ok, Label::kNear); | 2522 __ cmp(eax, isolate->factory()->the_hole_value()); |
| 2523 __ j(not_equal, &call, Label::kNear); | |
| 2524 } | |
| 2520 // Patch the receiver on the stack with the global receiver object. | 2525 // Patch the receiver on the stack with the global receiver object. |
| 2526 // Goto slow case if we do not have a function. | |
| 2527 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | |
| 2528 __ j(not_equal, &patch_current_context); | |
| 2529 CallStubCompiler::FetchGlobalProxy(masm, ecx, edi); | |
| 2530 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx); | |
| 2531 __ jmp(&call, Label::kNear); | |
| 2532 __ bind(&patch_current_context); | |
| 2521 __ mov(ecx, GlobalObjectOperand()); | 2533 __ mov(ecx, GlobalObjectOperand()); |
|
dcarney
2013/12/26 13:35:52
this should have a TODO to fix for function proxie
Toon Verwaest
2014/01/03 17:56:26
I decided to just fix it anyway. I discovered some
| |
| 2522 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); | 2534 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
| 2523 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx); | 2535 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx); |
| 2524 __ bind(&receiver_ok); | 2536 __ jmp(&slow); |
| 2537 __ bind(&call); | |
| 2538 } else { | |
| 2539 // Goto slow case if we do not have a function. | |
| 2540 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | |
| 2541 __ j(not_equal, &slow); | |
| 2525 } | 2542 } |
| 2526 | 2543 |
| 2527 // Check that the function really is a JavaScript function. | |
| 2528 __ JumpIfSmi(edi, &non_function); | |
| 2529 // Goto slow case if we do not have a function. | |
| 2530 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | |
| 2531 __ j(not_equal, &slow); | |
| 2532 | |
| 2533 if (RecordCallTarget()) { | 2544 if (RecordCallTarget()) { |
| 2534 GenerateRecordCallTarget(masm); | 2545 GenerateRecordCallTarget(masm); |
| 2535 } | 2546 } |
| 2536 | 2547 |
| 2537 // Fast-case: Just invoke the function. | 2548 // Fast-case: Just invoke the function. |
| 2538 ParameterCount actual(argc_); | 2549 ParameterCount actual(argc_); |
| 2539 | 2550 |
| 2540 if (ReceiverMightBeImplicit()) { | 2551 if (ReceiverMightBeImplicit()) { |
| 2541 Label call_as_function; | 2552 Label call_as_function; |
| 2542 __ cmp(eax, isolate->factory()->the_hole_value()); | 2553 __ cmp(eax, isolate->factory()->the_hole_value()); |
| (...skipping 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5671 __ bind(&fast_elements_case); | 5682 __ bind(&fast_elements_case); |
| 5672 GenerateCase(masm, FAST_ELEMENTS); | 5683 GenerateCase(masm, FAST_ELEMENTS); |
| 5673 } | 5684 } |
| 5674 | 5685 |
| 5675 | 5686 |
| 5676 #undef __ | 5687 #undef __ |
| 5677 | 5688 |
| 5678 } } // namespace v8::internal | 5689 } } // namespace v8::internal |
| 5679 | 5690 |
| 5680 #endif // V8_TARGET_ARCH_IA32 | 5691 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |