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