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

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

Issue 10827220: Fix handling of accessors on trunk. This is a combination of (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 4 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/version.cc ('k') | test/cctest/test-api.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 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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 // Check the prototype chain. 1022 // Check the prototype chain.
1023 Register reg = CheckPrototypes( 1023 Register reg = CheckPrototypes(
1024 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); 1024 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1025 1025
1026 // Get the value from the properties. 1026 // Get the value from the properties.
1027 GenerateFastPropertyLoad(masm(), rax, reg, holder, index); 1027 GenerateFastPropertyLoad(masm(), rax, reg, holder, index);
1028 __ ret(0); 1028 __ ret(0);
1029 } 1029 }
1030 1030
1031 1031
1032 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1033 Register name_reg,
1034 Register scratch1,
1035 Register scratch2,
1036 Register scratch3,
1037 Handle<AccessorInfo> callback,
1038 Handle<String> name,
1039 Label* miss) {
1040 Register dictionary = scratch1;
1041 __ movq(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset));
1042
1043 // Probe the dictionary.
1044 Label probe_done;
1045 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1046 miss,
1047 &probe_done,
1048 dictionary,
1049 name_reg,
1050 scratch2,
1051 scratch3);
1052 __ bind(&probe_done);
1053
1054 // If probing finds an entry in the dictionary, scratch2 contains the
1055 // index into the dictionary. Check that the value is the callback.
1056 Register index = scratch2;
1057 const int kElementsStartOffset =
1058 StringDictionary::kHeaderSize +
1059 StringDictionary::kElementsStartIndex * kPointerSize;
1060 const int kValueOffset = kElementsStartOffset + kPointerSize;
1061 __ movq(scratch3,
1062 Operand(dictionary, index, times_8, kValueOffset - kHeapObjectTag));
1063 __ movq(scratch2, callback, RelocInfo::EMBEDDED_OBJECT);
1064 __ cmpq(scratch3, scratch2);
1065 __ j(not_equal, miss);
1066 }
1067
1068
1032 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1069 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1033 Handle<JSObject> holder, 1070 Handle<JSObject> holder,
1034 Register receiver, 1071 Register receiver,
1035 Register name_reg, 1072 Register name_reg,
1036 Register scratch1, 1073 Register scratch1,
1037 Register scratch2, 1074 Register scratch2,
1038 Register scratch3, 1075 Register scratch3,
1039 Handle<AccessorInfo> callback, 1076 Handle<AccessorInfo> callback,
1040 Handle<String> name, 1077 Handle<String> name,
1041 Label* miss) { 1078 Label* miss) {
1042 // Check that the receiver isn't a smi. 1079 // Check that the receiver isn't a smi.
1043 __ JumpIfSmi(receiver, miss); 1080 __ JumpIfSmi(receiver, miss);
1044 1081
1045 // Check that the maps haven't changed. 1082 // Check that the maps haven't changed.
1046 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1083 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1047 scratch2, scratch3, name, miss); 1084 scratch2, scratch3, name, miss);
1048 1085
1086 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1087 GenerateDictionaryLoadCallback(
1088 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss);
1089 }
1090
1049 // Insert additional parameters into the stack frame above return address. 1091 // Insert additional parameters into the stack frame above return address.
1050 ASSERT(!scratch2.is(reg)); 1092 ASSERT(!scratch2.is(reg));
1051 __ pop(scratch2); // Get return address to place it below. 1093 __ pop(scratch2); // Get return address to place it below.
1052 1094
1053 __ push(receiver); // receiver 1095 __ push(receiver); // receiver
1054 __ push(reg); // holder 1096 __ push(reg); // holder
1055 if (heap()->InNewSpace(callback->data())) { 1097 if (heap()->InNewSpace(callback->data())) {
1056 __ Move(scratch1, callback); 1098 __ Move(scratch1, callback);
1057 __ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); // data 1099 __ push(FieldOperand(scratch1, AccessorInfo::kDataOffset)); // data
1058 } else { 1100 } else {
(...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after
4001 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4043 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4002 } 4044 }
4003 } 4045 }
4004 4046
4005 4047
4006 #undef __ 4048 #undef __
4007 4049
4008 } } // namespace v8::internal 4050 } } // namespace v8::internal
4009 4051
4010 #endif // V8_TARGET_ARCH_X64 4052 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/version.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698