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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 __ push(Operand(ebx, ecx, times_4, 0)); | 360 __ push(Operand(ebx, ecx, times_4, 0)); |
361 __ bind(&entry); | 361 __ bind(&entry); |
362 __ dec(ecx); | 362 __ dec(ecx); |
363 __ j(greater_equal, &loop); | 363 __ j(greater_equal, &loop); |
364 | 364 |
365 // Call the function. | 365 // Call the function. |
366 if (is_api_function) { | 366 if (is_api_function) { |
367 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 367 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
368 Handle<Code> code = | 368 Handle<Code> code = |
369 masm->isolate()->builtins()->HandleApiCallConstruct(); | 369 masm->isolate()->builtins()->HandleApiCallConstruct(); |
370 ParameterCount expected(0); | 370 __ SetCallKind(ecx, CALL_AS_METHOD); |
371 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, | 371 __ call(code, RelocInfo::CODE_TARGET); |
372 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
373 } else { | 372 } else { |
374 ParameterCount actual(eax); | 373 ParameterCount actual(eax); |
375 __ InvokeFunction(edi, actual, CALL_FUNCTION, | 374 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
376 NullCallWrapper(), CALL_AS_METHOD); | 375 NullCallWrapper(), CALL_AS_METHOD); |
377 } | 376 } |
378 | 377 |
379 // Store offset of return address for deoptimizer. | 378 // Store offset of return address for deoptimizer. |
380 if (!is_api_function && !count_constructions) { | 379 if (!is_api_function && !count_constructions) { |
381 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 380 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
382 } | 381 } |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver | 1246 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver |
1248 __ push(ecx); | 1247 __ push(ecx); |
1249 } | 1248 } |
1250 | 1249 |
1251 | 1250 |
1252 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1251 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1253 // ----------- S t a t e ------------- | 1252 // ----------- S t a t e ------------- |
1254 // -- eax : actual number of arguments | 1253 // -- eax : actual number of arguments |
1255 // -- ebx : expected number of arguments | 1254 // -- ebx : expected number of arguments |
1256 // -- ecx : call kind information | 1255 // -- ecx : call kind information |
1257 // -- edx : code entry to call | 1256 // -- edi : function (passed through to callee) |
1258 // ----------------------------------- | 1257 // ----------------------------------- |
1259 | 1258 |
1260 Label invoke, dont_adapt_arguments; | 1259 Label invoke, dont_adapt_arguments; |
1261 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 1260 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
1262 | 1261 |
1263 Label enough, too_few; | 1262 Label enough, too_few; |
| 1263 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
1264 __ cmp(eax, ebx); | 1264 __ cmp(eax, ebx); |
1265 __ j(less, &too_few); | 1265 __ j(less, &too_few); |
1266 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel); | 1266 __ cmp(ebx, SharedFunctionInfo::kDontAdaptArgumentsSentinel); |
1267 __ j(equal, &dont_adapt_arguments); | 1267 __ j(equal, &dont_adapt_arguments); |
1268 | 1268 |
1269 { // Enough parameters: Actual >= expected. | 1269 { // Enough parameters: Actual >= expected. |
1270 __ bind(&enough); | 1270 __ bind(&enough); |
1271 EnterArgumentsAdaptorFrame(masm); | 1271 EnterArgumentsAdaptorFrame(masm); |
1272 | 1272 |
1273 // Copy receiver and all expected arguments. | 1273 // Copy receiver and all expected arguments. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 | 1389 |
1390 __ bind(&ok); | 1390 __ bind(&ok); |
1391 __ ret(0); | 1391 __ ret(0); |
1392 } | 1392 } |
1393 | 1393 |
1394 #undef __ | 1394 #undef __ |
1395 } | 1395 } |
1396 } // namespace v8::internal | 1396 } // namespace v8::internal |
1397 | 1397 |
1398 #endif // V8_TARGET_ARCH_IA32 | 1398 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |