| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // Restore the arguments count and leave the construct frame. | 307 // Restore the arguments count and leave the construct frame. |
| 308 __ bind(&exit); | 308 __ bind(&exit); |
| 309 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count | 309 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count |
| 310 __ LeaveConstructFrame(); | 310 __ LeaveConstructFrame(); |
| 311 | 311 |
| 312 // Remove caller arguments from the stack and return. | 312 // Remove caller arguments from the stack and return. |
| 313 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 313 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 314 __ pop(ecx); | 314 __ pop(ecx); |
| 315 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver | 315 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver |
| 316 __ push(ecx); | 316 __ push(ecx); |
| 317 __ IncrementCounter(&Counters::constructed_objects, 1); | 317 __ IncrementCounter(&COUNTER(constructed_objects), 1); |
| 318 __ ret(0); | 318 __ ret(0); |
| 319 } | 319 } |
| 320 | 320 |
| 321 | 321 |
| 322 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 322 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 323 bool is_construct) { | 323 bool is_construct) { |
| 324 // Clear the context before we push it when entering the JS frame. | 324 // Clear the context before we push it when entering the JS frame. |
| 325 __ xor_(esi, Operand(esi)); // clear esi | 325 __ xor_(esi, Operand(esi)); // clear esi |
| 326 | 326 |
| 327 // Enter an internal frame. | 327 // Enter an internal frame. |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 900 |
| 901 // Handle construction of an empty array. | 901 // Handle construction of an empty array. |
| 902 AllocateEmptyJSArray(masm, | 902 AllocateEmptyJSArray(masm, |
| 903 edi, | 903 edi, |
| 904 eax, | 904 eax, |
| 905 ebx, | 905 ebx, |
| 906 ecx, | 906 ecx, |
| 907 edi, | 907 edi, |
| 908 kPreallocatedArrayElements, | 908 kPreallocatedArrayElements, |
| 909 &prepare_generic_code_call); | 909 &prepare_generic_code_call); |
| 910 __ IncrementCounter(&Counters::array_function_native, 1); | 910 __ IncrementCounter(&COUNTER(array_function_native), 1); |
| 911 __ pop(ebx); | 911 __ pop(ebx); |
| 912 if (construct_call) { | 912 if (construct_call) { |
| 913 __ pop(edi); | 913 __ pop(edi); |
| 914 } | 914 } |
| 915 __ ret(kPointerSize); | 915 __ ret(kPointerSize); |
| 916 | 916 |
| 917 // Check for one argument. Bail out if argument is not smi or if it is | 917 // Check for one argument. Bail out if argument is not smi or if it is |
| 918 // negative. | 918 // negative. |
| 919 __ bind(&argc_one_or_more); | 919 __ bind(&argc_one_or_more); |
| 920 __ cmp(eax, 1); | 920 __ cmp(eax, 1); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 940 // esp[C]: argument | 940 // esp[C]: argument |
| 941 AllocateJSArray(masm, | 941 AllocateJSArray(masm, |
| 942 edi, | 942 edi, |
| 943 edx, | 943 edx, |
| 944 eax, | 944 eax, |
| 945 ebx, | 945 ebx, |
| 946 ecx, | 946 ecx, |
| 947 edi, | 947 edi, |
| 948 true, | 948 true, |
| 949 &prepare_generic_code_call); | 949 &prepare_generic_code_call); |
| 950 __ IncrementCounter(&Counters::array_function_native, 1); | 950 __ IncrementCounter(&COUNTER(array_function_native), 1); |
| 951 __ pop(ebx); | 951 __ pop(ebx); |
| 952 if (construct_call) { | 952 if (construct_call) { |
| 953 __ pop(edi); | 953 __ pop(edi); |
| 954 } | 954 } |
| 955 __ ret(2 * kPointerSize); | 955 __ ret(2 * kPointerSize); |
| 956 | 956 |
| 957 // Handle construction of an array from a list of arguments. | 957 // Handle construction of an array from a list of arguments. |
| 958 __ bind(&argc_two_or_more); | 958 __ bind(&argc_two_or_more); |
| 959 ASSERT(kSmiTag == 0); | 959 ASSERT(kSmiTag == 0); |
| 960 __ shl(eax, kSmiTagSize); // Convet argc to a smi. | 960 __ shl(eax, kSmiTagSize); // Convet argc to a smi. |
| 961 // eax: array_size (smi) | 961 // eax: array_size (smi) |
| 962 // edi: constructor | 962 // edi: constructor |
| 963 // esp[0] : argc | 963 // esp[0] : argc |
| 964 // esp[4]: constructor (only if construct_call) | 964 // esp[4]: constructor (only if construct_call) |
| 965 // esp[8] : return address | 965 // esp[8] : return address |
| 966 // esp[C] : last argument | 966 // esp[C] : last argument |
| 967 AllocateJSArray(masm, | 967 AllocateJSArray(masm, |
| 968 edi, | 968 edi, |
| 969 eax, | 969 eax, |
| 970 ebx, | 970 ebx, |
| 971 ecx, | 971 ecx, |
| 972 edx, | 972 edx, |
| 973 edi, | 973 edi, |
| 974 false, | 974 false, |
| 975 &prepare_generic_code_call); | 975 &prepare_generic_code_call); |
| 976 __ IncrementCounter(&Counters::array_function_native, 1); | 976 __ IncrementCounter(&COUNTER(array_function_native), 1); |
| 977 __ mov(eax, ebx); | 977 __ mov(eax, ebx); |
| 978 __ pop(ebx); | 978 __ pop(ebx); |
| 979 if (construct_call) { | 979 if (construct_call) { |
| 980 __ pop(edi); | 980 __ pop(edi); |
| 981 } | 981 } |
| 982 __ push(eax); | 982 __ push(eax); |
| 983 // eax: JSArray | 983 // eax: JSArray |
| 984 // ebx: argc | 984 // ebx: argc |
| 985 // edx: elements_array_end (untagged) | 985 // edx: elements_array_end (untagged) |
| 986 // esp[0]: JSArray | 986 // esp[0]: JSArray |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 | 1136 |
| 1137 | 1137 |
| 1138 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1138 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1139 // ----------- S t a t e ------------- | 1139 // ----------- S t a t e ------------- |
| 1140 // -- eax : actual number of arguments | 1140 // -- eax : actual number of arguments |
| 1141 // -- ebx : expected number of arguments | 1141 // -- ebx : expected number of arguments |
| 1142 // -- edx : code entry to call | 1142 // -- edx : code entry to call |
| 1143 // ----------------------------------- | 1143 // ----------------------------------- |
| 1144 | 1144 |
| 1145 Label invoke, dont_adapt_arguments; | 1145 Label invoke, dont_adapt_arguments; |
| 1146 __ IncrementCounter(&Counters::arguments_adaptors, 1); | 1146 __ IncrementCounter(&COUNTER(arguments_adaptors), 1); |
| 1147 | 1147 |
| 1148 Label enough, too_few; | 1148 Label enough, too_few; |
| 1149 __ cmp(eax, Operand(ebx)); | 1149 __ cmp(eax, Operand(ebx)); |
| 1150 __ j(less, &too_few); | 1150 __ j(less, &too_few); |
| 1151 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel); | 1151 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel); |
| 1152 __ j(equal, &dont_adapt_arguments); | 1152 __ j(equal, &dont_adapt_arguments); |
| 1153 | 1153 |
| 1154 { // Enough parameters: Actual >= expected. | 1154 { // Enough parameters: Actual >= expected. |
| 1155 __ bind(&enough); | 1155 __ bind(&enough); |
| 1156 EnterArgumentsAdaptorFrame(masm); | 1156 EnterArgumentsAdaptorFrame(masm); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 // Dont adapt arguments. | 1211 // Dont adapt arguments. |
| 1212 // ------------------------------------------- | 1212 // ------------------------------------------- |
| 1213 __ bind(&dont_adapt_arguments); | 1213 __ bind(&dont_adapt_arguments); |
| 1214 __ jmp(Operand(edx)); | 1214 __ jmp(Operand(edx)); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 | 1217 |
| 1218 #undef __ | 1218 #undef __ |
| 1219 | 1219 |
| 1220 } } // namespace v8::internal | 1220 } } // namespace v8::internal |
| OLD | NEW |