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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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/ia32/assembler-ia32.cc ('k') | src/ia32/code-stubs-ia32.h » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 394
395 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { 395 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
396 Generate_JSConstructStubHelper(masm, true, false); 396 Generate_JSConstructStubHelper(masm, true, false);
397 } 397 }
398 398
399 399
400 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 400 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
401 bool is_construct) { 401 bool is_construct) {
402 // Clear the context before we push it when entering the JS frame. 402 // Clear the context before we push it when entering the JS frame.
403 __ xor_(esi, Operand(esi)); // clear esi 403 __ Set(esi, Immediate(0));
404 404
405 // Enter an internal frame. 405 // Enter an internal frame.
406 __ EnterInternalFrame(); 406 __ EnterInternalFrame();
407 407
408 // Load the previous frame pointer (ebx) to access C arguments 408 // Load the previous frame pointer (ebx) to access C arguments
409 __ mov(ebx, Operand(ebp, 0)); 409 __ mov(ebx, Operand(ebp, 0));
410 410
411 // Get the function from the frame and setup the context. 411 // Get the function from the frame and setup the context.
412 __ mov(ecx, Operand(ebx, EntryFrameConstants::kFunctionArgOffset)); 412 __ mov(ecx, Operand(ebx, EntryFrameConstants::kFunctionArgOffset));
413 __ mov(esi, FieldOperand(ecx, JSFunction::kContextOffset)); 413 __ mov(esi, FieldOperand(ecx, JSFunction::kContextOffset));
414 414
415 // Push the function and the receiver onto the stack. 415 // Push the function and the receiver onto the stack.
416 __ push(ecx); 416 __ push(ecx);
417 __ push(Operand(ebx, EntryFrameConstants::kReceiverArgOffset)); 417 __ push(Operand(ebx, EntryFrameConstants::kReceiverArgOffset));
418 418
419 // Load the number of arguments and setup pointer to the arguments. 419 // Load the number of arguments and setup pointer to the arguments.
420 __ mov(eax, Operand(ebx, EntryFrameConstants::kArgcOffset)); 420 __ mov(eax, Operand(ebx, EntryFrameConstants::kArgcOffset));
421 __ mov(ebx, Operand(ebx, EntryFrameConstants::kArgvOffset)); 421 __ mov(ebx, Operand(ebx, EntryFrameConstants::kArgvOffset));
422 422
423 // Copy arguments to the stack in a loop. 423 // Copy arguments to the stack in a loop.
424 Label loop, entry; 424 Label loop, entry;
425 __ xor_(ecx, Operand(ecx)); // clear ecx 425 __ Set(ecx, Immediate(0));
426 __ jmp(&entry); 426 __ jmp(&entry);
427 __ bind(&loop); 427 __ bind(&loop);
428 __ mov(edx, Operand(ebx, ecx, times_4, 0)); // push parameter from argv 428 __ mov(edx, Operand(ebx, ecx, times_4, 0)); // push parameter from argv
429 __ push(Operand(edx, 0)); // dereference handle 429 __ push(Operand(edx, 0)); // dereference handle
430 __ inc(Operand(ecx)); 430 __ inc(Operand(ecx));
431 __ bind(&entry); 431 __ bind(&entry);
432 __ cmp(ecx, Operand(eax)); 432 __ cmp(ecx, Operand(eax));
433 __ j(not_equal, &loop); 433 __ j(not_equal, &loop);
434 434
435 // Get the function from the stack and call it. 435 // Get the function from the stack and call it.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 __ jmp(&shift_arguments); 638 __ jmp(&shift_arguments);
639 } 639 }
640 640
641 // 3b. Patch the first argument when calling a non-function. The 641 // 3b. Patch the first argument when calling a non-function. The
642 // CALL_NON_FUNCTION builtin expects the non-function callee as 642 // CALL_NON_FUNCTION builtin expects the non-function callee as
643 // receiver, so overwrite the first argument which will ultimately 643 // receiver, so overwrite the first argument which will ultimately
644 // become the receiver. 644 // become the receiver.
645 __ bind(&non_function); 645 __ bind(&non_function);
646 __ mov(Operand(esp, eax, times_4, 0), edi); 646 __ mov(Operand(esp, eax, times_4, 0), edi);
647 // Clear edi to indicate a non-function being called. 647 // Clear edi to indicate a non-function being called.
648 __ xor_(edi, Operand(edi)); 648 __ Set(edi, Immediate(0));
649 649
650 // 4. Shift arguments and return address one slot down on the stack 650 // 4. Shift arguments and return address one slot down on the stack
651 // (overwriting the original receiver). Adjust argument count to make 651 // (overwriting the original receiver). Adjust argument count to make
652 // the original first argument the new receiver. 652 // the original first argument the new receiver.
653 __ bind(&shift_arguments); 653 __ bind(&shift_arguments);
654 { Label loop; 654 { Label loop;
655 __ mov(ecx, eax); 655 __ mov(ecx, eax);
656 __ bind(&loop); 656 __ bind(&loop);
657 __ mov(ebx, Operand(esp, ecx, times_4, 0)); 657 __ mov(ebx, Operand(esp, ecx, times_4, 0));
658 __ mov(Operand(esp, ecx, times_4, kPointerSize), ebx); 658 __ mov(Operand(esp, ecx, times_4, kPointerSize), ebx);
659 __ dec(ecx); 659 __ dec(ecx);
660 __ j(not_sign, &loop); // While non-negative (to copy return address). 660 __ j(not_sign, &loop); // While non-negative (to copy return address).
661 __ pop(ebx); // Discard copy of return address. 661 __ pop(ebx); // Discard copy of return address.
662 __ dec(eax); // One fewer argument (first argument is new receiver). 662 __ dec(eax); // One fewer argument (first argument is new receiver).
663 } 663 }
664 664
665 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. 665 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
666 { Label function; 666 { Label function;
667 __ test(edi, Operand(edi)); 667 __ test(edi, Operand(edi));
668 __ j(not_zero, &function, taken); 668 __ j(not_zero, &function, taken);
669 __ xor_(ebx, Operand(ebx)); 669 __ Set(ebx, Immediate(0));
670 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 670 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
671 __ jmp(Handle<Code>(Isolate::Current()->builtins()->builtin( 671 __ jmp(Handle<Code>(Isolate::Current()->builtins()->builtin(
672 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET); 672 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET);
673 __ bind(&function); 673 __ bind(&function);
674 } 674 }
675 675
676 // 5b. Get the code to call from the function and check that the number of 676 // 5b. Get the code to call from the function and check that the number of
677 // expected arguments matches what we're providing. If so, jump 677 // expected arguments matches what we're providing. If so, jump
678 // (tail-call) to the code in register edx without checking arguments. 678 // (tail-call) to the code in register edx without checking arguments.
679 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 679 __ mov(edx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1572 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1573 generator.Generate(); 1573 generator.Generate();
1574 } 1574 }
1575 1575
1576 1576
1577 #undef __ 1577 #undef __
1578 1578
1579 } } // namespace v8::internal 1579 } } // namespace v8::internal
1580 1580
1581 #endif // V8_TARGET_ARCH_IA32 1581 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/code-stubs-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698