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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // address of the callback as additional parameter, always allocate | 509 // address of the callback as additional parameter, always allocate |
510 // space for it. | 510 // space for it. |
511 const int kApiArgc = 1 + 1; | 511 const int kApiArgc = 1 + 1; |
512 | 512 |
513 // Allocate the v8::Arguments structure in the arguments' space since | 513 // Allocate the v8::Arguments structure in the arguments' space since |
514 // it's not controlled by GC. | 514 // it's not controlled by GC. |
515 const int kApiStackSpace = 4; | 515 const int kApiStackSpace = 4; |
516 | 516 |
517 // Function address is a foreign pointer outside V8's heap. | 517 // Function address is a foreign pointer outside V8's heap. |
518 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 518 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
519 // TODO(dcarney): fix signatures using returns_handle | 519 __ PrepareCallApiFunction(kApiArgc + kApiStackSpace); |
520 const bool returns_handle = false; | |
521 __ PrepareCallApiFunction(kApiArgc + kApiStackSpace, returns_handle); | |
522 | 520 |
523 // v8::Arguments::implicit_args_. | 521 // v8::Arguments::implicit_args_. |
524 __ mov(ApiParameterOperand(2, returns_handle), eax); | 522 __ mov(ApiParameterOperand(2), eax); |
525 __ add(eax, Immediate(argc * kPointerSize)); | 523 __ add(eax, Immediate(argc * kPointerSize)); |
526 // v8::Arguments::values_. | 524 // v8::Arguments::values_. |
527 __ mov(ApiParameterOperand(3, returns_handle), eax); | 525 __ mov(ApiParameterOperand(3), eax); |
528 // v8::Arguments::length_. | 526 // v8::Arguments::length_. |
529 __ Set(ApiParameterOperand(4, returns_handle), Immediate(argc)); | 527 __ Set(ApiParameterOperand(4), Immediate(argc)); |
530 // v8::Arguments::is_construct_call_. | 528 // v8::Arguments::is_construct_call_. |
531 __ Set(ApiParameterOperand(5, returns_handle), Immediate(0)); | 529 __ Set(ApiParameterOperand(5), Immediate(0)); |
532 | 530 |
533 // v8::InvocationCallback's argument. | 531 // v8::InvocationCallback's argument. |
534 __ lea(eax, ApiParameterOperand(2, returns_handle)); | 532 __ lea(eax, ApiParameterOperand(2)); |
535 __ mov(ApiParameterOperand(0, returns_handle), eax); | 533 __ mov(ApiParameterOperand(0), eax); |
536 | 534 |
537 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 535 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
538 | 536 |
539 __ CallApiFunctionAndReturn(function_address, | 537 __ CallApiFunctionAndReturn(function_address, |
540 thunk_address, | 538 thunk_address, |
541 ApiParameterOperand(1, returns_handle), | 539 ApiParameterOperand(1), |
542 argc + kFastApiCallArguments + 1, | 540 argc + kFastApiCallArguments + 1, |
543 returns_handle, | |
544 kFastApiCallArguments + 1); | 541 kFastApiCallArguments + 1); |
545 } | 542 } |
546 | 543 |
547 | 544 |
548 class CallInterceptorCompiler BASE_EMBEDDED { | 545 class CallInterceptorCompiler BASE_EMBEDDED { |
549 public: | 546 public: |
550 CallInterceptorCompiler(StubCompiler* stub_compiler, | 547 CallInterceptorCompiler(StubCompiler* stub_compiler, |
551 const ParameterCount& arguments, | 548 const ParameterCount& arguments, |
552 Register name, | 549 Register name, |
553 Code::ExtraICState extra_state) | 550 Code::ExtraICState extra_state) |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 __ push(scratch3()); // Restore return address. | 1387 __ push(scratch3()); // Restore return address. |
1391 | 1388 |
1392 // array for v8::Arguments::values_, handler for name and pointer | 1389 // array for v8::Arguments::values_, handler for name and pointer |
1393 // to the values (it considered as smi in GC). | 1390 // to the values (it considered as smi in GC). |
1394 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; | 1391 const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; |
1395 // Allocate space for opional callback address parameter in case | 1392 // Allocate space for opional callback address parameter in case |
1396 // CPU profiler is active. | 1393 // CPU profiler is active. |
1397 const int kApiArgc = 2 + 1; | 1394 const int kApiArgc = 2 + 1; |
1398 | 1395 |
1399 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1396 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1400 // TODO(dcarney): fix signatures using returns_handle | 1397 __ PrepareCallApiFunction(kApiArgc); |
1401 const bool returns_handle = false; | 1398 __ mov(ApiParameterOperand(0), ebx); // name. |
1402 __ PrepareCallApiFunction(kApiArgc, returns_handle); | |
1403 __ mov(ApiParameterOperand(0, returns_handle), ebx); // name. | |
1404 __ add(ebx, Immediate(kPointerSize)); | 1399 __ add(ebx, Immediate(kPointerSize)); |
1405 __ mov(ApiParameterOperand(1, returns_handle), ebx); // arguments pointer. | 1400 __ mov(ApiParameterOperand(1), ebx); // arguments pointer. |
1406 | 1401 |
1407 // Emitting a stub call may try to allocate (if the code is not | 1402 // Emitting a stub call may try to allocate (if the code is not |
1408 // already generated). Do not allow the assembler to perform a | 1403 // already generated). Do not allow the assembler to perform a |
1409 // garbage collection but instead return the allocation failure | 1404 // garbage collection but instead return the allocation failure |
1410 // object. | 1405 // object. |
1411 | 1406 |
1412 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 1407 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
1413 | 1408 |
1414 __ CallApiFunctionAndReturn(getter_address, | 1409 __ CallApiFunctionAndReturn(getter_address, |
1415 thunk_address, | 1410 thunk_address, |
1416 ApiParameterOperand(2, returns_handle), | 1411 ApiParameterOperand(2), |
1417 kStackSpace, | 1412 kStackSpace, |
1418 returns_handle, | |
1419 6); | 1413 6); |
1420 } | 1414 } |
1421 | 1415 |
1422 | 1416 |
1423 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1417 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
1424 // Return the constant value. | 1418 // Return the constant value. |
1425 __ LoadObject(eax, value); | 1419 __ LoadObject(eax, value); |
1426 __ ret(0); | 1420 __ ret(0); |
1427 } | 1421 } |
1428 | 1422 |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 // ----------------------------------- | 3242 // ----------------------------------- |
3249 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3243 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3250 } | 3244 } |
3251 | 3245 |
3252 | 3246 |
3253 #undef __ | 3247 #undef __ |
3254 | 3248 |
3255 } } // namespace v8::internal | 3249 } } // namespace v8::internal |
3256 | 3250 |
3257 #endif // V8_TARGET_ARCH_IA32 | 3251 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |