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 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 2629 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
2630 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); | 2630 mov(ebx, FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
2631 SmiUntag(ebx); | 2631 SmiUntag(ebx); |
2632 | 2632 |
2633 ParameterCount expected(ebx); | 2633 ParameterCount expected(ebx); |
2634 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2634 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
2635 expected, actual, flag, call_wrapper, call_kind); | 2635 expected, actual, flag, call_wrapper, call_kind); |
2636 } | 2636 } |
2637 | 2637 |
2638 | 2638 |
2639 void MacroAssembler::InvokeFunction(Register fun, | 2639 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
2640 const ParameterCount& expected, | 2640 const ParameterCount& expected, |
2641 const ParameterCount& actual, | 2641 const ParameterCount& actual, |
2642 InvokeFlag flag, | 2642 InvokeFlag flag, |
2643 const CallWrapper& call_wrapper, | 2643 const CallWrapper& call_wrapper, |
2644 CallKind call_kind) { | 2644 CallKind call_kind) { |
2645 // You can't call a function without a valid frame. | 2645 // You can't call a function without a valid frame. |
2646 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 2646 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
2647 | 2647 |
2648 ASSERT(fun.is(edi)); | 2648 // Get the function and setup the context. |
| 2649 LoadHeapObject(edi, function); |
2649 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 2650 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
2650 | 2651 |
| 2652 // We call indirectly through the code field in the function to |
| 2653 // allow recompilation to take effect without changing any of the |
| 2654 // call sites. |
2651 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2655 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
2652 expected, actual, flag, call_wrapper, call_kind); | 2656 expected, actual, flag, call_wrapper, call_kind); |
2653 } | 2657 } |
2654 | 2658 |
2655 | 2659 |
2656 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | |
2657 const ParameterCount& expected, | |
2658 const ParameterCount& actual, | |
2659 InvokeFlag flag, | |
2660 const CallWrapper& call_wrapper, | |
2661 CallKind call_kind) { | |
2662 LoadHeapObject(edi, function); | |
2663 InvokeFunction(edi, expected, actual, flag, call_wrapper, call_kind); | |
2664 } | |
2665 | |
2666 | |
2667 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 2660 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
2668 InvokeFlag flag, | 2661 InvokeFlag flag, |
2669 const CallWrapper& call_wrapper) { | 2662 const CallWrapper& call_wrapper) { |
2670 // You can't call a builtin without a valid frame. | 2663 // You can't call a builtin without a valid frame. |
2671 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 2664 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
2672 | 2665 |
2673 // Rely on the assertion to check that the number of provided | 2666 // Rely on the assertion to check that the number of provided |
2674 // arguments match the expected number of arguments. Fake a | 2667 // arguments match the expected number of arguments. Fake a |
2675 // parameter count to avoid emitting code to do the check. | 2668 // parameter count to avoid emitting code to do the check. |
2676 ParameterCount expected(0); | 2669 ParameterCount expected(0); |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3693 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3701 j(equal, found); | 3694 j(equal, found); |
3702 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3695 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3703 cmp(current, Immediate(factory->null_value())); | 3696 cmp(current, Immediate(factory->null_value())); |
3704 j(not_equal, &loop_again); | 3697 j(not_equal, &loop_again); |
3705 } | 3698 } |
3706 | 3699 |
3707 } } // namespace v8::internal | 3700 } } // namespace v8::internal |
3708 | 3701 |
3709 #endif // V8_TARGET_ARCH_IA32 | 3702 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |