Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 23484037: Refactoring PropertyCallbackInfo & FunctionCallbackInfo, step 2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 455 }
456 456
457 457
458 // Generates call to API function. 458 // Generates call to API function.
459 static void GenerateFastApiCall(MacroAssembler* masm, 459 static void GenerateFastApiCall(MacroAssembler* masm,
460 const CallOptimization& optimization, 460 const CallOptimization& optimization,
461 int argc, 461 int argc,
462 bool restore_context) { 462 bool restore_context) {
463 // ----------- S t a t e ------------- 463 // ----------- S t a t e -------------
464 // -- esp[0] : return address 464 // -- esp[0] : return address
465 // -- esp[4] : context 465 // -- esp[4] - esp[28] : FunctionCallbackInfo, incl.
466 // -- esp[8] : object passing the type check 466 // : object passing the type check
467 // (last fast api call extra argument, 467 // (set by CheckPrototypes)
468 // set by CheckPrototypes)
469 // -- esp[12] : api function
470 // (first fast api call extra argument)
471 // -- esp[16] : api call data
472 // -- esp[20] : isolate
473 // -- esp[24] : ReturnValue default value
474 // -- esp[28] : ReturnValue
475 // -- esp[32] : last argument 468 // -- esp[32] : last argument
476 // -- ... 469 // -- ...
477 // -- esp[(argc + 7) * 4] : first argument 470 // -- esp[(argc + 7) * 4] : first argument
478 // -- esp[(argc + 8) * 4] : receiver 471 // -- esp[(argc + 8) * 4] : receiver
479 // ----------------------------------- 472 // -----------------------------------
480 473
474 typedef FunctionCallbackArguments FCA;
475 const int kArgs = kFastApiCallArguments;
481 // Save calling context. 476 // Save calling context.
482 __ mov(Operand(esp, kPointerSize), esi); 477 __ mov(Operand(esp, (kArgs + FCA::kContextSaveIndex) * kPointerSize), esi);
483 478
484 // Get the function and setup the context. 479 // Get the function and setup the context.
485 Handle<JSFunction> function = optimization.constant_function(); 480 Handle<JSFunction> function = optimization.constant_function();
486 __ LoadHeapObject(edi, function); 481 __ LoadHeapObject(edi, function);
487 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 482 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
488 483
489 // Pass the additional arguments. 484 // Construct the FunctionCallbackInfo.
490 __ mov(Operand(esp, 3 * kPointerSize), edi); 485 __ mov(Operand(esp, (kArgs + FCA::kCalleeIndex) * kPointerSize), edi);
491 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 486 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
492 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 487 Handle<Object> call_data(api_call_info->data(), masm->isolate());
493 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 488 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
494 __ mov(ecx, api_call_info); 489 __ mov(ecx, api_call_info);
495 __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset)); 490 __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset));
496 __ mov(Operand(esp, 4 * kPointerSize), ebx); 491 __ mov(Operand(esp, (kArgs + FCA::kDataIndex) * kPointerSize), ebx);
497 } else { 492 } else {
498 __ mov(Operand(esp, 4 * kPointerSize), Immediate(call_data)); 493 __ mov(Operand(esp, (kArgs + FCA::kDataIndex) * kPointerSize),
494 Immediate(call_data));
499 } 495 }
500 __ mov(Operand(esp, 5 * kPointerSize), 496 __ mov(Operand(esp, (kArgs + FCA::kIsolateIndex) * kPointerSize),
501 Immediate(reinterpret_cast<int>(masm->isolate()))); 497 Immediate(reinterpret_cast<int>(masm->isolate())));
502 __ mov(Operand(esp, 6 * kPointerSize), 498 __ mov(Operand(esp, (kArgs + FCA::kReturnValueOffset) * kPointerSize),
503 masm->isolate()->factory()->undefined_value()); 499 masm->isolate()->factory()->undefined_value());
504 __ mov(Operand(esp, 7 * kPointerSize), 500 __ mov(
505 masm->isolate()->factory()->undefined_value()); 501 Operand(esp, (kArgs + FCA::kReturnValueDefaultValueIndex) * kPointerSize),
502 masm->isolate()->factory()->undefined_value());
506 503
507 // Prepare arguments. 504 // Prepare arguments.
508 STATIC_ASSERT(kFastApiCallArguments == 7); 505 STATIC_ASSERT(kArgs == 7);
509 __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); 506 __ lea(eax, Operand(esp, kArgs * kPointerSize));
510 507
511 508
512 // API function gets reference to the v8::Arguments. If CPU profiler 509 // API function gets reference to the v8::Arguments. If CPU profiler
513 // is enabled wrapper function will be called and we need to pass 510 // is enabled wrapper function will be called and we need to pass
514 // address of the callback as additional parameter, always allocate 511 // address of the callback as additional parameter, always allocate
515 // space for it. 512 // space for it.
516 const int kApiArgc = 1 + 1; 513 const int kApiArgc = 1 + 1;
517 514
518 // Allocate the v8::Arguments structure in the arguments' space since 515 // Allocate the v8::Arguments structure in the arguments' space since
519 // it's not controlled by GC. 516 // it's not controlled by GC.
(...skipping 12 matching lines...) Expand all
532 __ Set(ApiParameterOperand(4), Immediate(argc)); 529 __ Set(ApiParameterOperand(4), Immediate(argc));
533 // v8::Arguments::is_construct_call_. 530 // v8::Arguments::is_construct_call_.
534 __ Set(ApiParameterOperand(5), Immediate(0)); 531 __ Set(ApiParameterOperand(5), Immediate(0));
535 532
536 // v8::InvocationCallback's argument. 533 // v8::InvocationCallback's argument.
537 __ lea(eax, ApiParameterOperand(2)); 534 __ lea(eax, ApiParameterOperand(2));
538 __ mov(ApiParameterOperand(0), eax); 535 __ mov(ApiParameterOperand(0), eax);
539 536
540 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); 537 Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback);
541 538
542 Operand context_restore_operand(ebp, 2 * kPointerSize); 539 Operand context_restore_operand(
540 ebp, (kArgs + 1 + FCA::kContextSaveIndex) * kPointerSize);
543 Operand return_value_operand( 541 Operand return_value_operand(
544 ebp, (kFastApiCallArguments + 1) * kPointerSize); 542 ebp, (kArgs + 1 + FCA::kReturnValueOffset) * kPointerSize);
545 __ CallApiFunctionAndReturn(function_address, 543 __ CallApiFunctionAndReturn(function_address,
546 thunk_address, 544 thunk_address,
547 ApiParameterOperand(1), 545 ApiParameterOperand(1),
548 argc + kFastApiCallArguments + 1, 546 argc + kArgs + 1,
549 return_value_operand, 547 return_value_operand,
550 restore_context ? 548 restore_context ?
551 &context_restore_operand : NULL); 549 &context_restore_operand : NULL);
552 } 550 }
553 551
554 552
555 // Generate call to api function. 553 // Generate call to api function.
556 static void GenerateFastApiCall(MacroAssembler* masm, 554 static void GenerateFastApiCall(MacroAssembler* masm,
557 const CallOptimization& optimization, 555 const CallOptimization& optimization,
558 Register receiver, 556 Register receiver,
(...skipping 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 // ----------------------------------- 3278 // -----------------------------------
3281 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3279 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3282 } 3280 }
3283 3281
3284 3282
3285 #undef __ 3283 #undef __
3286 3284
3287 } } // namespace v8::internal 3285 } } // namespace v8::internal
3288 3286
3289 #endif // V8_TARGET_ARCH_IA32 3287 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698