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

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

Issue 155283: Allow access through the global proxy to use ICs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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 | « no previous file | src/ia32/stub-cache-ia32.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 // Handle call cache miss. 678 // Handle call cache miss.
679 __ bind(&miss); 679 __ bind(&miss);
680 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 680 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
681 __ Jump(ic, RelocInfo::CODE_TARGET); 681 __ Jump(ic, RelocInfo::CODE_TARGET);
682 682
683 // Return the generated code. 683 // Return the generated code.
684 return GetCode(INTERCEPTOR, name); 684 return GetCode(INTERCEPTOR, name);
685 } 685 }
686 686
687 687
688 Object* CallStubCompiler::CompileCallGlobal(GlobalObject* object, 688 Object* CallStubCompiler::CompileCallGlobal(JSObject* object,
689 GlobalObject* holder,
689 JSGlobalPropertyCell* cell, 690 JSGlobalPropertyCell* cell,
690 JSFunction* function, 691 JSFunction* function,
691 String* name) { 692 String* name) {
692 // ----------- S t a t e ------------- 693 // ----------- S t a t e -------------
693 // -- lr: return address 694 // -- lr: return address
694 // ----------------------------------- 695 // -----------------------------------
695 Label miss; 696 Label miss;
696 697
697 __ IncrementCounter(&Counters::call_global_inline, 1, r1, r3); 698 __ IncrementCounter(&Counters::call_global_inline, 1, r1, r3);
698 699
699 // Get the number of arguments. 700 // Get the number of arguments.
700 const int argc = arguments().immediate(); 701 const int argc = arguments().immediate();
701 702
702 // Check that the map of the global has not changed. 703 // Get the receiver from the stack.
703 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); 704 __ ldr(r0, MemOperand(sp, argc * kPointerSize));
704 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); 705
705 __ cmp(r3, Operand(Handle<Map>(object->map()))); 706 // If the object is the holder then we know that it's a global
706 __ b(ne, &miss); 707 // object which can only happen for contextual calls. In this case,
708 // the receiver cannot be a smi.
709 if (object != holder) {
710 __ tst(r0, Operand(kSmiTagMask));
711 __ b(eq, &miss);
712 }
713
714 // Check that the maps haven't changed.
715 masm()->CheckMaps(object, r0, holder, r3, r2, &miss);
707 716
708 // Get the value from the cell. 717 // Get the value from the cell.
709 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell))); 718 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell)));
710 __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); 719 __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
711 720
712 // Check that the cell contains the same function. 721 // Check that the cell contains the same function.
713 __ cmp(r1, Operand(Handle<JSFunction>(function))); 722 __ cmp(r1, Operand(Handle<JSFunction>(function)));
714 __ b(ne, &miss); 723 __ b(ne, &miss);
715 724
716 // Patch the receiver on the stack with the global proxy if 725 // Patch the receiver on the stack with the global proxy if
717 // necessary. 726 // necessary.
718 __ ldr(r3, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); 727 if (object->IsGlobalObject()) {
719 __ str(r3, MemOperand(sp, argc * kPointerSize)); 728 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset));
729 __ str(r3, MemOperand(sp, argc * kPointerSize));
730 }
720 731
721 // Setup the context (function already in r1). 732 // Setup the context (function already in r1).
722 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 733 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
723 734
724 // Jump to the cached code (tail call). 735 // Jump to the cached code (tail call).
725 ASSERT(function->is_compiled()); 736 ASSERT(function->is_compiled());
726 Handle<Code> code(function->code()); 737 Handle<Code> code(function->code());
727 ParameterCount expected(function->shared()->formal_parameter_count()); 738 ParameterCount expected(function->shared()->formal_parameter_count());
728 __ InvokeCode(code, expected, arguments(), 739 __ InvokeCode(code, expected, arguments(),
729 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 740 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 r1, 1017 r1,
1007 &miss); 1018 &miss);
1008 __ bind(&miss); 1019 __ bind(&miss);
1009 GenerateLoadMiss(masm(), Code::LOAD_IC); 1020 GenerateLoadMiss(masm(), Code::LOAD_IC);
1010 1021
1011 // Return the generated code. 1022 // Return the generated code.
1012 return GetCode(INTERCEPTOR, name); 1023 return GetCode(INTERCEPTOR, name);
1013 } 1024 }
1014 1025
1015 1026
1016 Object* LoadStubCompiler::CompileLoadGlobal(GlobalObject* object, 1027 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
1028 GlobalObject* holder,
1017 JSGlobalPropertyCell* cell, 1029 JSGlobalPropertyCell* cell,
1018 String* name, 1030 String* name,
1019 bool is_dont_delete) { 1031 bool is_dont_delete) {
1020 // ----------- S t a t e ------------- 1032 // ----------- S t a t e -------------
1021 // -- r2 : name 1033 // -- r2 : name
1022 // -- lr : return address 1034 // -- lr : return address
1023 // -- [sp] : receiver 1035 // -- [sp] : receiver
1024 // ----------------------------------- 1036 // -----------------------------------
1025 Label miss; 1037 Label miss;
1026 1038
1027 __ IncrementCounter(&Counters::named_load_global_inline, 1, r1, r3); 1039 __ IncrementCounter(&Counters::named_load_global_inline, 1, r1, r3);
1028 1040
1041 // Get the receiver from the stack.
Erik Corry 2009/07/09 11:15:04 Is receiver the right word here?
1042 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
1043
1044 // If the object is the holder then we know that it's a global
1045 // object which can only happen for contextual calls. In this case,
1046 // the receiver cannot be a smi.
1047 if (object != holder) {
1048 __ tst(r1, Operand(kSmiTagMask));
1049 __ b(eq, &miss);
1050 }
1051
1029 // Check that the map of the global has not changed. 1052 // Check that the map of the global has not changed.
1030 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); 1053 masm()->CheckMaps(object, r1, holder, r3, r0, &miss);
1031 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
1032 __ cmp(r3, Operand(Handle<Map>(object->map())));
1033 __ b(ne, &miss);
1034 1054
1035 // Get the value from the cell. 1055 // Get the value from the cell.
1036 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell))); 1056 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell)));
1037 __ ldr(r0, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); 1057 __ ldr(r0, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
1038 1058
1039 // Check for deleted property if property can actually be deleted. 1059 // Check for deleted property if property can actually be deleted.
1040 if (!is_dont_delete) { 1060 if (!is_dont_delete) {
1041 __ cmp(r0, Operand(Factory::the_hole_value())); 1061 __ cmp(r0, Operand(Factory::the_hole_value()));
1042 __ b(eq, &miss); 1062 __ b(eq, &miss);
1043 } 1063 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 __ Jump(ic, RelocInfo::CODE_TARGET); 1284 __ Jump(ic, RelocInfo::CODE_TARGET);
1265 1285
1266 // Return the generated code. 1286 // Return the generated code.
1267 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 1287 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
1268 } 1288 }
1269 1289
1270 1290
1271 #undef __ 1291 #undef __
1272 1292
1273 } } // namespace v8::internal 1293 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698