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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace v8 { namespace internal { | 34 namespace v8 { namespace internal { |
35 | 35 |
36 | 36 |
37 #define __ masm-> | 37 #define __ masm-> |
38 | 38 |
39 | 39 |
40 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 40 void Builtins::Generate_Adaptor(MacroAssembler* masm, |
41 int argc, | 41 int argc, |
42 CFunctionId id) { | 42 CFunctionId id) { |
43 // argc is the number of arguments excluding the receiver. | 43 // TODO(1238487): Don't pass the function in a static variable. |
44 // JumpToBuiltin expects eax to contain the number of arguments | 44 ExternalReference passed = ExternalReference::builtin_passed_function(); |
45 // including the receiver. | 45 __ mov(Operand::StaticVariable(passed), edi); |
46 __ mov(eax, argc + 1); | 46 |
47 __ mov(Operand::StaticVariable(ExternalReference::builtin_passed_function()), | 47 if (argc == -1) { |
48 edi); | 48 // The actual argument count has already been loaded into register |
| 49 // eax, but JumpToBuiltin expects eax to contain the number of |
| 50 // arguments including the receiver. |
| 51 __ inc(eax); |
| 52 } else { |
| 53 // The number passed in argc excludes the receiver, but |
| 54 // JumpToBuiltin expects eax to contain the number of arguments |
| 55 // including the receiver. |
| 56 __ mov(eax, argc + 1); |
| 57 } |
49 __ JumpToBuiltin(ExternalReference(id)); | 58 __ JumpToBuiltin(ExternalReference(id)); |
50 } | 59 } |
51 | 60 |
52 | 61 |
53 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 62 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
54 // ----------- S t a t e ------------- | 63 // ----------- S t a t e ------------- |
55 // -- eax: number of arguments | 64 // -- eax: number of arguments |
56 // -- edi: constructor function | 65 // -- edi: constructor function |
57 // ----------------------------------- | 66 // ----------------------------------- |
58 | 67 |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc). | 885 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc). |
877 // ----------- S t a t e ------------- | 886 // ----------- S t a t e ------------- |
878 // No registers used on entry. | 887 // No registers used on entry. |
879 // ----------------------------------- | 888 // ----------------------------------- |
880 Generate_DebugBreakCallHelper(masm, 0, false); | 889 Generate_DebugBreakCallHelper(masm, 0, false); |
881 } | 890 } |
882 | 891 |
883 #undef __ | 892 #undef __ |
884 | 893 |
885 } } // namespace v8::internal | 894 } } // namespace v8::internal |
OLD | NEW |