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

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

Issue 8192: Fix issue 120 by patching the on-stack receiver in the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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/stub-cache-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 GenerateFastPropertyLoad(masm(), edi, reg, holder, index); 513 GenerateFastPropertyLoad(masm(), edi, reg, holder, index);
514 514
515 // Check that the function really is a function. 515 // Check that the function really is a function.
516 __ test(edi, Immediate(kSmiTagMask)); 516 __ test(edi, Immediate(kSmiTagMask));
517 __ j(zero, &miss, not_taken); 517 __ j(zero, &miss, not_taken);
518 __ mov(ebx, FieldOperand(edi, HeapObject::kMapOffset)); // get the map 518 __ mov(ebx, FieldOperand(edi, HeapObject::kMapOffset)); // get the map
519 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 519 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
520 __ cmp(ebx, JS_FUNCTION_TYPE); 520 __ cmp(ebx, JS_FUNCTION_TYPE);
521 __ j(not_equal, &miss, not_taken); 521 __ j(not_equal, &miss, not_taken);
522 522
523 // Patch the receiver on the stack with the global proxy if
524 // necessary.
523 if (object->IsGlobalObject()) { 525 if (object->IsGlobalObject()) {
524 // TODO(120): Patch receiver with the global proxy. 526 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
527 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
525 } 528 }
526 529
527 // Invoke the function. 530 // Invoke the function.
528 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); 531 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
529 532
530 // Handle call cache miss. 533 // Handle call cache miss.
531 __ bind(&miss); 534 __ bind(&miss);
532 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 535 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
533 __ jmp(ic, RelocInfo::CODE_TARGET); 536 __ jmp(ic, RelocInfo::CODE_TARGET);
534 537
(...skipping 15 matching lines...) Expand all
550 // Get the receiver from the stack. 553 // Get the receiver from the stack.
551 const int argc = arguments().immediate(); 554 const int argc = arguments().immediate();
552 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); 555 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
553 556
554 // Check that the receiver isn't a smi. 557 // Check that the receiver isn't a smi.
555 if (check != NUMBER_CHECK) { 558 if (check != NUMBER_CHECK) {
556 __ test(edx, Immediate(kSmiTagMask)); 559 __ test(edx, Immediate(kSmiTagMask));
557 __ j(zero, &miss, not_taken); 560 __ j(zero, &miss, not_taken);
558 } 561 }
559 562
563 // Make sure that it's okay not to patch the on stack receiver
564 // unless we're doing a receiver map check.
565 ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
566
560 switch (check) { 567 switch (check) {
561 case RECEIVER_MAP_CHECK: 568 case RECEIVER_MAP_CHECK:
562 // Check that the maps haven't changed. 569 // Check that the maps haven't changed.
563 __ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss); 570 __ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss);
571
572 // Patch the receiver on the stack with the global proxy if
573 // necessary.
574 if (object->IsGlobalObject()) {
575 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
576 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
577 }
564 break; 578 break;
565 579
566 case STRING_CHECK: 580 case STRING_CHECK:
567 // Check that the object is a two-byte string or a symbol. 581 // Check that the object is a two-byte string or a symbol.
568 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); 582 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
569 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 583 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
570 __ cmp(ecx, FIRST_NONSTRING_TYPE); 584 __ cmp(ecx, FIRST_NONSTRING_TYPE);
571 __ j(above_equal, &miss, not_taken); 585 __ j(above_equal, &miss, not_taken);
572 // Check that the maps starting from the prototype haven't changed. 586 // Check that the maps starting from the prototype haven't changed.
573 GenerateLoadGlobalFunctionPrototype(masm(), 587 GenerateLoadGlobalFunctionPrototype(masm(),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 break; 639 break;
626 640
627 default: 641 default:
628 UNREACHABLE(); 642 UNREACHABLE();
629 } 643 }
630 644
631 // Get the function and setup the context. 645 // Get the function and setup the context.
632 __ mov(Operand(edi), Immediate(Handle<JSFunction>(function))); 646 __ mov(Operand(edi), Immediate(Handle<JSFunction>(function)));
633 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 647 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
634 648
635 if (object->IsGlobalObject()) {
636 // TODO(120): Patch receiver with the global proxy.
637 }
638
639 // Jump to the cached code (tail call). 649 // Jump to the cached code (tail call).
640 Handle<Code> code(function->code()); 650 Handle<Code> code(function->code());
641 ParameterCount expected(function->shared()->formal_parameter_count()); 651 ParameterCount expected(function->shared()->formal_parameter_count());
642 __ InvokeCode(code, expected, arguments(), 652 __ InvokeCode(code, expected, arguments(),
643 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 653 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
644 654
645 // Handle call cache miss. 655 // Handle call cache miss.
646 __ bind(&miss); 656 __ bind(&miss);
647 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 657 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
648 __ jmp(ic, RelocInfo::CODE_TARGET); 658 __ jmp(ic, RelocInfo::CODE_TARGET);
(...skipping 10 matching lines...) Expand all
659 // ----------------------------------- 669 // -----------------------------------
660 670
661 HandleScope scope; 671 HandleScope scope;
662 Label miss; 672 Label miss;
663 673
664 // Get the number of arguments. 674 // Get the number of arguments.
665 const int argc = arguments().immediate(); 675 const int argc = arguments().immediate();
666 676
667 // Get the receiver from the stack. 677 // Get the receiver from the stack.
668 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); 678 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
679
669 // Check that the receiver isn't a smi. 680 // Check that the receiver isn't a smi.
670 __ test(edx, Immediate(kSmiTagMask)); 681 __ test(edx, Immediate(kSmiTagMask));
671 __ j(zero, &miss, not_taken); 682 __ j(zero, &miss, not_taken);
672 683
673 // Check that maps have not changed and compute the holder register. 684 // Check that maps have not changed and compute the holder register.
674 Register reg = 685 Register reg =
675 __ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss); 686 __ CheckMaps(JSObject::cast(object), edx, holder, ebx, ecx, &miss);
676 687
677 // Enter an internal frame. 688 // Enter an internal frame.
678 __ EnterInternalFrame(); 689 __ EnterInternalFrame();
(...skipping 20 matching lines...) Expand all
699 __ LeaveInternalFrame(); 710 __ LeaveInternalFrame();
700 711
701 // Check that the function really is a function. 712 // Check that the function really is a function.
702 __ test(edi, Immediate(kSmiTagMask)); 713 __ test(edi, Immediate(kSmiTagMask));
703 __ j(zero, &miss, not_taken); 714 __ j(zero, &miss, not_taken);
704 __ mov(ebx, FieldOperand(edi, HeapObject::kMapOffset)); 715 __ mov(ebx, FieldOperand(edi, HeapObject::kMapOffset));
705 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 716 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
706 __ cmp(ebx, JS_FUNCTION_TYPE); 717 __ cmp(ebx, JS_FUNCTION_TYPE);
707 __ j(not_equal, &miss, not_taken); 718 __ j(not_equal, &miss, not_taken);
708 719
720 // Patch the receiver on the stack with the global proxy if
721 // necessary.
709 if (object->IsGlobalObject()) { 722 if (object->IsGlobalObject()) {
710 // TODO(120): Patch receiver with the global proxy. 723 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
724 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
711 } 725 }
712 726
713 // Invoke the function. 727 // Invoke the function.
714 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); 728 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
715 729
716 // Handle load cache miss. 730 // Handle load cache miss.
717 __ bind(&miss); 731 __ bind(&miss);
718 Handle<Code> ic = ComputeCallMiss(argc); 732 Handle<Code> ic = ComputeCallMiss(argc);
719 __ jmp(ic, RelocInfo::CODE_TARGET); 733 __ jmp(ic, RelocInfo::CODE_TARGET);
720 734
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 1271 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
1258 1272
1259 // Return the generated code. 1273 // Return the generated code.
1260 return GetCode(CALLBACKS); 1274 return GetCode(CALLBACKS);
1261 } 1275 }
1262 1276
1263 1277
1264 #undef __ 1278 #undef __
1265 1279
1266 } } // namespace v8::internal 1280 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698