OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 683 |
684 | 684 |
685 void MacroAssembler::StubReturn(int argc) { | 685 void MacroAssembler::StubReturn(int argc) { |
686 ASSERT(argc >= 1 && generating_stub()); | 686 ASSERT(argc >= 1 && generating_stub()); |
687 if (argc > 1) | 687 if (argc > 1) |
688 add(sp, sp, Operand((argc - 1) * kPointerSize)); | 688 add(sp, sp, Operand((argc - 1) * kPointerSize)); |
689 Ret(); | 689 Ret(); |
690 } | 690 } |
691 | 691 |
692 | 692 |
| 693 void MacroAssembler::IllegalOperation(int num_arguments) { |
| 694 if (num_arguments > 0) { |
| 695 add(sp, sp, Operand(num_arguments * kPointerSize)); |
| 696 } |
| 697 mov(r0, Operand(Factory::undefined_value())); |
| 698 } |
| 699 |
| 700 |
693 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { | 701 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { |
694 // All parameters are on the stack. r0 has the return value after call. | 702 // All parameters are on the stack. r0 has the return value after call. |
695 | 703 |
696 // Either the expected number of arguments is unknown, or the actual | 704 // If the expected number of arguments of the runtime function is |
697 // number of arguments match the expectation. | 705 // constant, we check that the actual number of arguments match the |
698 ASSERT(f->nargs < 0 || f->nargs == num_arguments); | 706 // expectation. |
| 707 if (f->nargs >= 0 && f->nargs != num_arguments) { |
| 708 IllegalOperation(num_arguments); |
| 709 return; |
| 710 } |
699 | 711 |
700 Runtime::FunctionId function_id = | 712 Runtime::FunctionId function_id = |
701 static_cast<Runtime::FunctionId>(f->stub_id); | 713 static_cast<Runtime::FunctionId>(f->stub_id); |
702 RuntimeStub stub(function_id, num_arguments); | 714 RuntimeStub stub(function_id, num_arguments); |
703 CallStub(&stub); | 715 CallStub(&stub); |
704 } | 716 } |
705 | 717 |
706 | 718 |
707 void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) { | 719 void MacroAssembler::CallRuntime(Runtime::FunctionId fid, int num_arguments) { |
708 CallRuntime(Runtime::FunctionForId(fid), num_arguments); | 720 CallRuntime(Runtime::FunctionForId(fid), num_arguments); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 #endif | 829 #endif |
818 mov(r0, Operand(p0)); | 830 mov(r0, Operand(p0)); |
819 push(r0); | 831 push(r0); |
820 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 832 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
821 push(r0); | 833 push(r0); |
822 CallRuntime(Runtime::kAbort, 2); | 834 CallRuntime(Runtime::kAbort, 2); |
823 // will not return here | 835 // will not return here |
824 } | 836 } |
825 | 837 |
826 } } // namespace v8::internal | 838 } } // namespace v8::internal |
OLD | NEW |