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

Side by Side Diff: src/x64/stub-cache-x64.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/stub-cache-ia32.cc ('k') | test/mjsunit/external-array.js » ('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 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 2494
2495 2495
2496 MaybeObject* KeyedStoreStubCompiler::CompileStoreFastElement( 2496 MaybeObject* KeyedStoreStubCompiler::CompileStoreFastElement(
2497 Map* receiver_map) { 2497 Map* receiver_map) {
2498 // ----------- S t a t e ------------- 2498 // ----------- S t a t e -------------
2499 // -- rax : value 2499 // -- rax : value
2500 // -- rcx : key 2500 // -- rcx : key
2501 // -- rdx : receiver 2501 // -- rdx : receiver
2502 // -- rsp[0] : return address 2502 // -- rsp[0] : return address
2503 // ----------------------------------- 2503 // -----------------------------------
2504 Label miss;
2505 __ JumpIfSmi(rdx, &miss);
2506
2507 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 2504 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
2508 MaybeObject* maybe_stub = 2505 MaybeObject* maybe_stub =
2509 KeyedStoreFastElementStub(is_js_array).TryGetCode(); 2506 KeyedStoreFastElementStub(is_js_array).TryGetCode();
2510 Code* stub; 2507 Code* stub;
2511 if (!maybe_stub->To(&stub)) return maybe_stub; 2508 if (!maybe_stub->To(&stub)) return maybe_stub;
2512 __ DispatchMap(rdx, 2509 __ DispatchMap(rdx,
2513 Handle<Map>(receiver_map), 2510 Handle<Map>(receiver_map),
2514 Handle<Code>(stub), 2511 Handle<Code>(stub),
2515 DO_SMI_CHECK); 2512 DO_SMI_CHECK);
2516 2513
2517 __ bind(&miss);
2518 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); 2514 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
2519 __ jmp(ic, RelocInfo::CODE_TARGET); 2515 __ jmp(ic, RelocInfo::CODE_TARGET);
2520 2516
2521 // Return the generated code. 2517 // Return the generated code.
2522 return GetCode(NORMAL, NULL); 2518 return GetCode(NORMAL, NULL);
2523 } 2519 }
2524 2520
2525 2521
2526 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic( 2522 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic(
2527 MapList* receiver_maps, 2523 MapList* receiver_maps,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 return GetCode(CALLBACKS, name); 2952 return GetCode(CALLBACKS, name);
2957 } 2953 }
2958 2954
2959 2955
2960 MaybeObject* KeyedLoadStubCompiler::CompileLoadFastElement(Map* receiver_map) { 2956 MaybeObject* KeyedLoadStubCompiler::CompileLoadFastElement(Map* receiver_map) {
2961 // ----------- S t a t e ------------- 2957 // ----------- S t a t e -------------
2962 // -- rax : key 2958 // -- rax : key
2963 // -- rdx : receiver 2959 // -- rdx : receiver
2964 // -- rsp[0] : return address 2960 // -- rsp[0] : return address
2965 // ----------------------------------- 2961 // -----------------------------------
2966 Label miss;
2967 __ JumpIfSmi(rdx, &miss);
2968
2969 MaybeObject* maybe_stub = KeyedLoadFastElementStub().TryGetCode(); 2962 MaybeObject* maybe_stub = KeyedLoadFastElementStub().TryGetCode();
2970 Code* stub; 2963 Code* stub;
2971 if (!maybe_stub->To(&stub)) return maybe_stub; 2964 if (!maybe_stub->To(&stub)) return maybe_stub;
2972 __ DispatchMap(rdx, 2965 __ DispatchMap(rdx,
2973 Handle<Map>(receiver_map), 2966 Handle<Map>(receiver_map),
2974 Handle<Code>(stub), 2967 Handle<Code>(stub),
2975 DO_SMI_CHECK); 2968 DO_SMI_CHECK);
2976 2969
2977 __ bind(&miss);
2978 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); 2970 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss();
2979 __ jmp(ic, RelocInfo::CODE_TARGET); 2971 __ jmp(ic, RelocInfo::CODE_TARGET);
2980 2972
2981 // Return the generated code. 2973 // Return the generated code.
2982 return GetCode(NORMAL, NULL); 2974 return GetCode(NORMAL, NULL);
2983 } 2975 }
2984 2976
2985 2977
2986 MaybeObject* KeyedLoadStubCompiler::CompileLoadMegamorphic( 2978 MaybeObject* KeyedLoadStubCompiler::CompileLoadMegamorphic(
2987 MapList* receiver_maps, 2979 MapList* receiver_maps,
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 3588 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3597 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); 3589 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3598 } 3590 }
3599 3591
3600 3592
3601 #undef __ 3593 #undef __
3602 3594
3603 } } // namespace v8::internal 3595 } } // namespace v8::internal
3604 3596
3605 #endif // V8_TARGET_ARCH_X64 3597 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | test/mjsunit/external-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698