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

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

Issue 7059013: SMI checks for receiver in KeyedLoad/Store (done right this time) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: correct test options Created 9 years, 7 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/macro-assembler-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 2664
2665 2665
2666 MaybeObject* KeyedStoreStubCompiler::CompileStoreFastElement( 2666 MaybeObject* KeyedStoreStubCompiler::CompileStoreFastElement(
2667 Map* receiver_map) { 2667 Map* receiver_map) {
2668 // ----------- S t a t e ------------- 2668 // ----------- S t a t e -------------
2669 // -- eax : value 2669 // -- eax : value
2670 // -- ecx : key 2670 // -- ecx : key
2671 // -- edx : receiver 2671 // -- edx : receiver
2672 // -- esp[0] : return address 2672 // -- esp[0] : return address
2673 // ----------------------------------- 2673 // -----------------------------------
2674 Label miss;
2675 __ JumpIfSmi(edx, &miss);
2676
2677 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 2674 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
2678 MaybeObject* maybe_stub = 2675 MaybeObject* maybe_stub =
2679 KeyedStoreFastElementStub(is_js_array).TryGetCode(); 2676 KeyedStoreFastElementStub(is_js_array).TryGetCode();
2680 Code* stub; 2677 Code* stub;
2681 if (!maybe_stub->To(&stub)) return maybe_stub; 2678 if (!maybe_stub->To(&stub)) return maybe_stub;
2682 __ DispatchMap(edx, 2679 __ DispatchMap(edx,
2683 Handle<Map>(receiver_map), 2680 Handle<Map>(receiver_map),
2684 Handle<Code>(stub), 2681 Handle<Code>(stub),
2685 DO_SMI_CHECK); 2682 DO_SMI_CHECK);
2686 2683
2687 __ bind(&miss);
2688 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); 2684 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
2689 __ jmp(ic, RelocInfo::CODE_TARGET); 2685 __ jmp(ic, RelocInfo::CODE_TARGET);
2690 2686
2691 // Return the generated code. 2687 // Return the generated code.
2692 return GetCode(NORMAL, NULL); 2688 return GetCode(NORMAL, NULL);
2693 } 2689 }
2694 2690
2695 2691
2696 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic( 2692 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic(
2697 MapList* receiver_maps, 2693 MapList* receiver_maps,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 return GetCode(CALLBACKS, name); 3126 return GetCode(CALLBACKS, name);
3131 } 3127 }
3132 3128
3133 3129
3134 MaybeObject* KeyedLoadStubCompiler::CompileLoadFastElement(Map* receiver_map) { 3130 MaybeObject* KeyedLoadStubCompiler::CompileLoadFastElement(Map* receiver_map) {
3135 // ----------- S t a t e ------------- 3131 // ----------- S t a t e -------------
3136 // -- eax : key 3132 // -- eax : key
3137 // -- edx : receiver 3133 // -- edx : receiver
3138 // -- esp[0] : return address 3134 // -- esp[0] : return address
3139 // ----------------------------------- 3135 // -----------------------------------
3140 Label miss;
3141 __ JumpIfSmi(edx, &miss);
3142
3143 MaybeObject* maybe_stub = KeyedLoadFastElementStub().TryGetCode(); 3136 MaybeObject* maybe_stub = KeyedLoadFastElementStub().TryGetCode();
3144 Code* stub; 3137 Code* stub;
3145 if (!maybe_stub->To(&stub)) return maybe_stub; 3138 if (!maybe_stub->To(&stub)) return maybe_stub;
3146 __ DispatchMap(edx, 3139 __ DispatchMap(edx,
3147 Handle<Map>(receiver_map), 3140 Handle<Map>(receiver_map),
3148 Handle<Code>(stub), 3141 Handle<Code>(stub),
3149 DO_SMI_CHECK); 3142 DO_SMI_CHECK);
3150 3143
3151 __ bind(&miss);
3152 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 3144 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3153 3145
3154 // Return the generated code. 3146 // Return the generated code.
3155 return GetCode(NORMAL, NULL); 3147 return GetCode(NORMAL, NULL);
3156 } 3148 }
3157 3149
3158 3150
3159 MaybeObject* KeyedLoadStubCompiler::CompileLoadMegamorphic( 3151 MaybeObject* KeyedLoadStubCompiler::CompileLoadMegamorphic(
3160 MapList* receiver_maps, 3152 MapList* receiver_maps,
3161 CodeList* handler_ics) { 3153 CodeList* handler_ics) {
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
3834 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 3826 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3835 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); 3827 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3836 } 3828 }
3837 3829
3838 3830
3839 #undef __ 3831 #undef __
3840 3832
3841 } } // namespace v8::internal 3833 } } // namespace v8::internal
3842 3834
3843 #endif // V8_TARGET_ARCH_IA32 3835 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698