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

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

Issue 10831153: Improve load IC so it can call a native accessor even if the holder is (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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
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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 // Check the prototype chain. 1045 // Check the prototype chain.
1046 Register reg = CheckPrototypes( 1046 Register reg = CheckPrototypes(
1047 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); 1047 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1048 1048
1049 // Get the value from the properties. 1049 // Get the value from the properties.
1050 GenerateFastPropertyLoad(masm(), eax, reg, holder, index); 1050 GenerateFastPropertyLoad(masm(), eax, reg, holder, index);
1051 __ ret(0); 1051 __ ret(0);
1052 } 1052 }
1053 1053
1054 1054
1055 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1056 Register name_reg,
1057 Register scratch1,
1058 Register scratch2,
1059 Register scratch3,
1060 Handle<AccessorInfo> callback,
1061 Handle<String> name,
1062 Label* miss) {
1063 Register dictionary = scratch1;
1064 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset));
1065
1066 // Probe the dictionary.
1067 Label probe_done;
1068 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1069 miss,
1070 &probe_done,
1071 dictionary,
1072 name_reg,
1073 scratch2,
1074 scratch3);
1075 __ bind(&probe_done);
1076
1077 // If probing finds an entry in the dictionary, scratch2 contains the
1078 // index into the dictionary. Check that the value is the callback.
1079 Register index = scratch2;
1080 const int kElementsStartOffset =
1081 StringDictionary::kHeaderSize +
1082 StringDictionary::kElementsStartIndex * kPointerSize;
1083 const int kValueOffset = kElementsStartOffset + kPointerSize;
1084 __ mov(scratch3,
1085 Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag));
1086 __ cmp(scratch3, callback);
1087 __ j(not_equal, miss);
1088 }
1089
1090
1055 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1091 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1056 Handle<JSObject> holder, 1092 Handle<JSObject> holder,
1057 Register receiver, 1093 Register receiver,
1058 Register name_reg, 1094 Register name_reg,
1059 Register scratch1, 1095 Register scratch1,
1060 Register scratch2, 1096 Register scratch2,
1061 Register scratch3, 1097 Register scratch3,
1062 Handle<AccessorInfo> callback, 1098 Handle<AccessorInfo> callback,
1063 Handle<String> name, 1099 Handle<String> name,
1064 Label* miss) { 1100 Label* miss) {
1065 // Check that the receiver isn't a smi. 1101 // Check that the receiver isn't a smi.
1066 __ JumpIfSmi(receiver, miss); 1102 __ JumpIfSmi(receiver, miss);
1067 1103
1068 // Check that the maps haven't changed. 1104 // Check that the maps haven't changed.
1069 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1105 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1070 scratch2, scratch3, name, miss); 1106 scratch2, scratch3, name, miss);
1071 1107
1108 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1109 GenerateDictionaryLoadCallback(
1110 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss);
Michael Starzinger 2012/08/13 17:47:16 This performs a dictionary lookup on the receiver,
1111 }
1112
1072 // Insert additional parameters into the stack frame above return address. 1113 // Insert additional parameters into the stack frame above return address.
1073 ASSERT(!scratch3.is(reg)); 1114 ASSERT(!scratch3.is(reg));
1074 __ pop(scratch3); // Get return address to place it below. 1115 __ pop(scratch3); // Get return address to place it below.
1075 1116
1076 __ push(receiver); // receiver 1117 __ push(receiver); // receiver
1077 __ mov(scratch2, esp); 1118 __ mov(scratch2, esp);
1078 ASSERT(!scratch2.is(reg)); 1119 ASSERT(!scratch2.is(reg));
1079 __ push(reg); // holder 1120 __ push(reg); // holder
1080 // Push data from AccessorInfo. 1121 // Push data from AccessorInfo.
1081 if (isolate()->heap()->InNewSpace(callback->data())) { 1122 if (isolate()->heap()->InNewSpace(callback->data())) {
(...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4246 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4287 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4247 } 4288 }
4248 } 4289 }
4249 4290
4250 4291
4251 #undef __ 4292 #undef __
4252 4293
4253 } } // namespace v8::internal 4294 } } // namespace v8::internal
4254 4295
4255 #endif // V8_TARGET_ARCH_IA32 4296 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698