| 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 Immediate(reinterpret_cast<int>(masm->isolate()))); | 496 Immediate(reinterpret_cast<int>(masm->isolate()))); |
| 497 __ mov(Operand(esp, 5 * kPointerSize), | 497 __ mov(Operand(esp, 5 * kPointerSize), |
| 498 masm->isolate()->factory()->undefined_value()); | 498 masm->isolate()->factory()->undefined_value()); |
| 499 __ mov(Operand(esp, 6 * kPointerSize), | 499 __ mov(Operand(esp, 6 * kPointerSize), |
| 500 masm->isolate()->factory()->undefined_value()); | 500 masm->isolate()->factory()->undefined_value()); |
| 501 | 501 |
| 502 // Prepare arguments. | 502 // Prepare arguments. |
| 503 STATIC_ASSERT(kFastApiCallArguments == 6); | 503 STATIC_ASSERT(kFastApiCallArguments == 6); |
| 504 __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); | 504 __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); |
| 505 | 505 |
| 506 const int kApiArgc = 1; // API function gets reference to the v8::Arguments. | 506 |
| 507 // API function gets reference to the v8::Arguments. If CPU profiler |
| 508 // is enabled wrapper function will be called and we need to pass |
| 509 // address of the callback as additional parameter, always allocate |
| 510 // space for it. |
| 511 const int kApiArgc = 1 + 1; |
| 507 | 512 |
| 508 // Allocate the v8::Arguments structure in the arguments' space since | 513 // Allocate the v8::Arguments structure in the arguments' space since |
| 509 // it's not controlled by GC. | 514 // it's not controlled by GC. |
| 510 const int kApiStackSpace = 4; | 515 const int kApiStackSpace = 4; |
| 511 | 516 |
| 512 // Function address is a foreign pointer outside V8's heap. | 517 // Function address is a foreign pointer outside V8's heap. |
| 513 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 518 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
| 514 bool returns_handle = | 519 bool returns_handle = |
| 515 !CallbackTable::ReturnsVoid(masm->isolate(), | 520 !CallbackTable::ReturnsVoid(masm->isolate(), |
| 516 reinterpret_cast<void*>(function_address)); | 521 reinterpret_cast<void*>(function_address)); |
| 517 __ PrepareCallApiFunction(kApiArgc + kApiStackSpace, returns_handle); | 522 __ PrepareCallApiFunction(kApiArgc + kApiStackSpace, returns_handle); |
| 518 | 523 |
| 519 // v8::Arguments::implicit_args_. | 524 // v8::Arguments::implicit_args_. |
| 520 __ mov(ApiParameterOperand(1, returns_handle), eax); | 525 __ mov(ApiParameterOperand(2, returns_handle), eax); |
| 521 __ add(eax, Immediate(argc * kPointerSize)); | 526 __ add(eax, Immediate(argc * kPointerSize)); |
| 522 // v8::Arguments::values_. | 527 // v8::Arguments::values_. |
| 523 __ mov(ApiParameterOperand(2, returns_handle), eax); | 528 __ mov(ApiParameterOperand(3, returns_handle), eax); |
| 524 // v8::Arguments::length_. | 529 // v8::Arguments::length_. |
| 525 __ Set(ApiParameterOperand(3, returns_handle), Immediate(argc)); | 530 __ Set(ApiParameterOperand(4, returns_handle), Immediate(argc)); |
| 526 // v8::Arguments::is_construct_call_. | 531 // v8::Arguments::is_construct_call_. |
| 527 __ Set(ApiParameterOperand(4, returns_handle), Immediate(0)); | 532 __ Set(ApiParameterOperand(5, returns_handle), Immediate(0)); |
| 528 | 533 |
| 529 // v8::InvocationCallback's argument. | 534 // v8::InvocationCallback's argument. |
| 530 __ lea(eax, ApiParameterOperand(1, returns_handle)); | 535 __ lea(eax, ApiParameterOperand(2, returns_handle)); |
| 531 __ mov(ApiParameterOperand(0, returns_handle), eax); | 536 __ mov(ApiParameterOperand(0, returns_handle), eax); |
| 532 | 537 |
| 538 Address thunk_address = returns_handle |
| 539 ? FUNCTION_ADDR(&InvokeInvocationCallback) |
| 540 : FUNCTION_ADDR(&InvokeFunctionCallback); |
| 541 |
| 533 __ CallApiFunctionAndReturn(function_address, | 542 __ CallApiFunctionAndReturn(function_address, |
| 543 thunk_address, |
| 544 ApiParameterOperand(1, returns_handle), |
| 534 argc + kFastApiCallArguments + 1, | 545 argc + kFastApiCallArguments + 1, |
| 535 returns_handle, | 546 returns_handle, |
| 536 kFastApiCallArguments + 1); | 547 kFastApiCallArguments + 1); |
| 537 } | 548 } |
| 538 | 549 |
| 539 | 550 |
| 540 class CallInterceptorCompiler BASE_EMBEDDED { | 551 class CallInterceptorCompiler BASE_EMBEDDED { |
| 541 public: | 552 public: |
| 542 CallInterceptorCompiler(StubCompiler* stub_compiler, | 553 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 543 const ParameterCount& arguments, | 554 const ParameterCount& arguments, |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 __ push(scratch2()); | 1410 __ push(scratch2()); |
| 1400 | 1411 |
| 1401 __ push(name()); // name | 1412 __ push(name()); // name |
| 1402 __ mov(ebx, esp); // esp points to reference to name (handler). | 1413 __ mov(ebx, esp); // esp points to reference to name (handler). |
| 1403 | 1414 |
| 1404 __ push(scratch3()); // Restore return address. | 1415 __ push(scratch3()); // Restore return address. |
| 1405 | 1416 |
| 1406 // array for v8::Arguments::values_, handler for name and pointer | 1417 // array for v8::Arguments::values_, handler for name and pointer |
| 1407 // to the values (it considered as smi in GC). | 1418 // to the values (it considered as smi in GC). |
| 1408 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; | 1419 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; |
| 1409 const int kApiArgc = 2; | 1420 // Allocate space for opional callback address parameter in case |
| 1421 // CPU profiler is active. |
| 1422 const int kApiArgc = 2 + 1; |
| 1410 | 1423 |
| 1411 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1424 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 1412 bool returns_handle = | 1425 bool returns_handle = |
| 1413 !CallbackTable::ReturnsVoid(isolate(), | 1426 !CallbackTable::ReturnsVoid(isolate(), |
| 1414 reinterpret_cast<void*>(getter_address)); | 1427 reinterpret_cast<void*>(getter_address)); |
| 1415 __ PrepareCallApiFunction(kApiArgc, returns_handle); | 1428 __ PrepareCallApiFunction(kApiArgc, returns_handle); |
| 1416 __ mov(ApiParameterOperand(0, returns_handle), ebx); // name. | 1429 __ mov(ApiParameterOperand(0, returns_handle), ebx); // name. |
| 1417 __ add(ebx, Immediate(kPointerSize)); | 1430 __ add(ebx, Immediate(kPointerSize)); |
| 1418 __ mov(ApiParameterOperand(1, returns_handle), ebx); // arguments pointer. | 1431 __ mov(ApiParameterOperand(1, returns_handle), ebx); // arguments pointer. |
| 1419 | 1432 |
| 1420 // Emitting a stub call may try to allocate (if the code is not | 1433 // Emitting a stub call may try to allocate (if the code is not |
| 1421 // already generated). Do not allow the assembler to perform a | 1434 // already generated). Do not allow the assembler to perform a |
| 1422 // garbage collection but instead return the allocation failure | 1435 // garbage collection but instead return the allocation failure |
| 1423 // object. | 1436 // object. |
| 1424 | 1437 |
| 1438 Address thunk_address = returns_handle |
| 1439 ? FUNCTION_ADDR(&InvokeAccessorGetter) |
| 1440 : FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
| 1441 |
| 1425 __ CallApiFunctionAndReturn(getter_address, | 1442 __ CallApiFunctionAndReturn(getter_address, |
| 1443 thunk_address, |
| 1444 ApiParameterOperand(2, returns_handle), |
| 1426 kStackSpace, | 1445 kStackSpace, |
| 1427 returns_handle, | 1446 returns_handle, |
| 1428 6); | 1447 6); |
| 1429 } | 1448 } |
| 1430 | 1449 |
| 1431 | 1450 |
| 1432 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { | 1451 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { |
| 1433 // Return the constant value. | 1452 // Return the constant value. |
| 1434 __ LoadHeapObject(eax, value); | 1453 __ LoadHeapObject(eax, value); |
| 1435 __ ret(0); | 1454 __ ret(0); |
| (...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3762 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3744 } | 3763 } |
| 3745 } | 3764 } |
| 3746 | 3765 |
| 3747 | 3766 |
| 3748 #undef __ | 3767 #undef __ |
| 3749 | 3768 |
| 3750 } } // namespace v8::internal | 3769 } } // namespace v8::internal |
| 3751 | 3770 |
| 3752 #endif // V8_TARGET_ARCH_IA32 | 3771 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |