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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 196653015: Fixed spec violation of storing to length of a frozen object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review notes applied Created 6 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/stub-cache.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 receiver = rax; 926 receiver = rax;
927 } 927 }
928 928
929 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, r9, &miss); 929 StubCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, r9, &miss);
930 __ bind(&miss); 930 __ bind(&miss);
931 StubCompiler::TailCallBuiltin( 931 StubCompiler::TailCallBuiltin(
932 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); 932 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind()));
933 } 933 }
934 934
935 935
936 void StoreArrayLengthStub::Generate(MacroAssembler* masm) {
937 // ----------- S t a t e -------------
938 // -- rax : value
939 // -- rcx : key
940 // -- rdx : receiver
941 // -- rsp[0] : return address
942 // -----------------------------------
943 //
944 // This accepts as a receiver anything JSArray::SetElementsLength accepts
945 // (currently anything except for external arrays which means anything with
946 // elements of FixedArray type). Value must be a number, but only smis are
947 // accepted as the most common case.
948
949 Label miss;
950
951 Register receiver = rdx;
952 Register value = rax;
953 Register scratch = rbx;
954 if (kind() == Code::KEYED_STORE_IC) {
955 __ Cmp(rcx, masm->isolate()->factory()->length_string());
956 __ j(not_equal, &miss);
957 }
958
959 // Check that the receiver isn't a smi.
960 __ JumpIfSmi(receiver, &miss);
961
962 // Check that the object is a JS array.
963 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
964 __ j(not_equal, &miss);
965
966 // Check that elements are FixedArray.
967 // We rely on StoreIC_ArrayLength below to deal with all types of
968 // fast elements (including COW).
969 __ movp(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
970 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
971 __ j(not_equal, &miss);
972
973 // Check that the array has fast properties, otherwise the length
974 // property might have been redefined.
975 __ movp(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
976 __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
977 Heap::kHashTableMapRootIndex);
978 __ j(equal, &miss);
979
980 // Check that value is a smi.
981 __ JumpIfNotSmi(value, &miss);
982
983 // Prepare tail call to StoreIC_ArrayLength.
984 __ PopReturnAddressTo(scratch);
985 __ push(receiver);
986 __ push(value);
987 __ PushReturnAddressFrom(scratch);
988
989 ExternalReference ref =
990 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate());
991 __ TailCallExternalReference(ref, 2, 1);
992
993 __ bind(&miss);
994
995 StubCompiler::TailCallBuiltin(
996 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind()));
997 }
998
999
1000 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 936 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
1001 // The key is in rdx and the parameter count is in rax. 937 // The key is in rdx and the parameter count is in rax.
1002 938
1003 // Check that the key is a smi. 939 // Check that the key is a smi.
1004 Label slow; 940 Label slow;
1005 __ JumpIfNotSmi(rdx, &slow); 941 __ JumpIfNotSmi(rdx, &slow);
1006 942
1007 // Check if the calling frame is an arguments adaptor frame. We look at the 943 // Check if the calling frame is an arguments adaptor frame. We look at the
1008 // context offset, and if the frame is not a regular one, then we find a 944 // context offset, and if the frame is not a regular one, then we find a
1009 // Smi instead of the context. We can't use SmiCompare here, because that 945 // Smi instead of the context. We can't use SmiCompare here, because that
(...skipping 4305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5315 return_value_operand, 5251 return_value_operand,
5316 NULL); 5252 NULL);
5317 } 5253 }
5318 5254
5319 5255
5320 #undef __ 5256 #undef __
5321 5257
5322 } } // namespace v8::internal 5258 } } // namespace v8::internal
5323 5259
5324 #endif // V8_TARGET_ARCH_X64 5260 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698