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

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

Issue 9691038: Ensure there is a smi check of the receiver for global load and call ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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/mips/stub-cache-mips.cc ('k') | test/mjsunit/regress/regress-117794.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 Handle<String> name, 1217 Handle<String> name,
1218 Label* miss) { 1218 Label* miss) {
1219 ASSERT(holder->IsGlobalObject()); 1219 ASSERT(holder->IsGlobalObject());
1220 1220
1221 // Get the number of arguments. 1221 // Get the number of arguments.
1222 const int argc = arguments().immediate(); 1222 const int argc = arguments().immediate();
1223 1223
1224 // Get the receiver from the stack. 1224 // Get the receiver from the stack.
1225 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 1225 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
1226 1226
1227 // If the object is the holder then we know that it's a global
1228 // object which can only happen for contextual calls. In this case,
1229 // the receiver cannot be a smi.
1230 if (!object.is_identical_to(holder)) {
1231 __ JumpIfSmi(rdx, miss);
1232 }
1233 1227
1234 // Check that the maps haven't changed. 1228 // Check that the maps haven't changed.
1229 __ JumpIfSmi(rdx, miss);
1235 CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss); 1230 CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss);
1236 } 1231 }
1237 1232
1238 1233
1239 void CallStubCompiler::GenerateLoadFunctionFromCell( 1234 void CallStubCompiler::GenerateLoadFunctionFromCell(
1240 Handle<JSGlobalPropertyCell> cell, 1235 Handle<JSGlobalPropertyCell> cell,
1241 Handle<JSFunction> function, 1236 Handle<JSFunction> function,
1242 Label* miss) { 1237 Label* miss) {
1243 // Get the value from the cell. 1238 // Get the value from the cell.
1244 __ Move(rdi, cell); 1239 __ Move(rdi, cell);
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 Handle<JSGlobalPropertyCell> cell, 2653 Handle<JSGlobalPropertyCell> cell,
2659 Handle<String> name, 2654 Handle<String> name,
2660 bool is_dont_delete) { 2655 bool is_dont_delete) {
2661 // ----------- S t a t e ------------- 2656 // ----------- S t a t e -------------
2662 // -- rax : receiver 2657 // -- rax : receiver
2663 // -- rcx : name 2658 // -- rcx : name
2664 // -- rsp[0] : return address 2659 // -- rsp[0] : return address
2665 // ----------------------------------- 2660 // -----------------------------------
2666 Label miss; 2661 Label miss;
2667 2662
2668 // If the object is the holder then we know that it's a global
2669 // object which can only happen for contextual loads. In this case,
2670 // the receiver cannot be a smi.
2671 if (!object.is_identical_to(holder)) {
2672 __ JumpIfSmi(rax, &miss);
2673 }
2674
2675 // Check that the maps haven't changed. 2663 // Check that the maps haven't changed.
2664 __ JumpIfSmi(rax, &miss);
2676 CheckPrototypes(object, rax, holder, rbx, rdx, rdi, name, &miss); 2665 CheckPrototypes(object, rax, holder, rbx, rdx, rdi, name, &miss);
2677 2666
2678 // Get the value from the cell. 2667 // Get the value from the cell.
2679 __ Move(rbx, cell); 2668 __ Move(rbx, cell);
2680 __ movq(rbx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset)); 2669 __ movq(rbx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset));
2681 2670
2682 // Check for deleted property if property can actually be deleted. 2671 // Check for deleted property if property can actually be deleted.
2683 if (!is_dont_delete) { 2672 if (!is_dont_delete) {
2684 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); 2673 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex);
2685 __ j(equal, &miss); 2674 __ j(equal, &miss);
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3797 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 3786 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
3798 } 3787 }
3799 } 3788 }
3800 3789
3801 3790
3802 #undef __ 3791 #undef __
3803 3792
3804 } } // namespace v8::internal 3793 } } // namespace v8::internal
3805 3794
3806 #endif // V8_TARGET_ARCH_X64 3795 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | test/mjsunit/regress/regress-117794.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698