| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 __ push(Operand(ebx, ecx, times_4, 0)); | 357 __ push(Operand(ebx, ecx, times_4, 0)); |
| 358 __ bind(&entry); | 358 __ bind(&entry); |
| 359 __ dec(ecx); | 359 __ dec(ecx); |
| 360 __ j(greater_equal, &loop); | 360 __ j(greater_equal, &loop); |
| 361 | 361 |
| 362 // Call the function. | 362 // Call the function. |
| 363 if (is_api_function) { | 363 if (is_api_function) { |
| 364 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 364 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 365 Handle<Code> code = | 365 Handle<Code> code = |
| 366 masm->isolate()->builtins()->HandleApiCallConstruct(); | 366 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 367 ParameterCount expected(0); | 367 __ call(code, RelocInfo::CODE_TARGET); |
| 368 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, | |
| 369 CALL_FUNCTION, NullCallWrapper()); | |
| 370 } else { | 368 } else { |
| 371 ParameterCount actual(eax); | 369 ParameterCount actual(eax); |
| 372 __ InvokeFunction(edi, actual, CALL_FUNCTION, | 370 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 373 NullCallWrapper()); | 371 NullCallWrapper()); |
| 374 } | 372 } |
| 375 | 373 |
| 376 // Store offset of return address for deoptimizer. | 374 // Store offset of return address for deoptimizer. |
| 377 if (!is_api_function && !count_constructions) { | 375 if (!is_api_function && !count_constructions) { |
| 378 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 376 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 379 } | 377 } |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 __ pop(ecx); | 1222 __ pop(ecx); |
| 1225 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver | 1223 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver |
| 1226 __ push(ecx); | 1224 __ push(ecx); |
| 1227 } | 1225 } |
| 1228 | 1226 |
| 1229 | 1227 |
| 1230 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1228 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1231 // ----------- S t a t e ------------- | 1229 // ----------- S t a t e ------------- |
| 1232 // -- eax : actual number of arguments | 1230 // -- eax : actual number of arguments |
| 1233 // -- ebx : expected number of arguments | 1231 // -- ebx : expected number of arguments |
| 1234 // -- edx : code entry to call | 1232 // -- edi : function (passed through to callee) |
| 1235 // ----------------------------------- | 1233 // ----------------------------------- |
| 1236 | 1234 |
| 1237 Label invoke, dont_adapt_arguments; | 1235 Label invoke, dont_adapt_arguments; |
| 1238 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 1236 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
| 1239 | 1237 |
| 1240 Label enough, too_few; | 1238 Label enough, too_few; |
| 1239 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
| 1241 __ cmp(eax, ebx); | 1240 __ cmp(eax, ebx); |
| 1242 __ j(less, &too_few); | 1241 __ j(less, &too_few); |
| 1243 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel); | 1242 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel); |
| 1244 __ j(equal, &dont_adapt_arguments); | 1243 __ j(equal, &dont_adapt_arguments); |
| 1245 | 1244 |
| 1246 { // Enough parameters: Actual >= expected. | 1245 { // Enough parameters: Actual >= expected. |
| 1247 __ bind(&enough); | 1246 __ bind(&enough); |
| 1248 EnterArgumentsAdaptorFrame(masm); | 1247 EnterArgumentsAdaptorFrame(masm); |
| 1249 | 1248 |
| 1250 // Copy receiver and all expected arguments. | 1249 // Copy receiver and all expected arguments. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 | 1365 |
| 1367 __ bind(&ok); | 1366 __ bind(&ok); |
| 1368 __ ret(0); | 1367 __ ret(0); |
| 1369 } | 1368 } |
| 1370 | 1369 |
| 1371 #undef __ | 1370 #undef __ |
| 1372 } | 1371 } |
| 1373 } // namespace v8::internal | 1372 } // namespace v8::internal |
| 1374 | 1373 |
| 1375 #endif // V8_TARGET_ARCH_IA32 | 1374 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |