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

Side by Side Diff: src/ic/ic.cc

Issue 570293002: Simplify the LookupIterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/ic/handler-compiler.cc ('k') | src/lookup.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 DCHECK(original_code->IsCode()); 208 DCHECK(original_code->IsCode());
209 return original_code; 209 return original_code;
210 } 210 }
211 211
212 212
213 static void LookupForRead(LookupIterator* it) { 213 static void LookupForRead(LookupIterator* it) {
214 for (; it->IsFound(); it->Next()) { 214 for (; it->IsFound(); it->Next()) {
215 switch (it->state()) { 215 switch (it->state()) {
216 case LookupIterator::NOT_FOUND: 216 case LookupIterator::NOT_FOUND:
217 case LookupIterator::TRANSITION: 217 case LookupIterator::TRANSITION:
218 case LookupIterator::UNKNOWN:
219 UNREACHABLE(); 218 UNREACHABLE();
220 case LookupIterator::JSPROXY: 219 case LookupIterator::JSPROXY:
221 return; 220 return;
222 case LookupIterator::INTERCEPTOR: { 221 case LookupIterator::INTERCEPTOR: {
223 // If there is a getter, return; otherwise loop to perform the lookup. 222 // If there is a getter, return; otherwise loop to perform the lookup.
224 Handle<JSObject> holder = it->GetHolder<JSObject>(); 223 Handle<JSObject> holder = it->GetHolder<JSObject>();
225 if (!holder->GetNamedInterceptor()->getter()->IsUndefined()) { 224 if (!holder->GetNamedInterceptor()->getter()->IsUndefined()) {
226 return; 225 return;
227 } 226 }
228 break; 227 break;
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder, 1074 NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
1076 cache_holder); 1075 cache_holder);
1077 return compiler.CompileLoadConstant(lookup->name(), 1076 return compiler.CompileLoadConstant(lookup->name(),
1078 lookup->GetConstantIndex()); 1077 lookup->GetConstantIndex());
1079 } 1078 }
1080 1079
1081 case LookupIterator::ACCESS_CHECK: 1080 case LookupIterator::ACCESS_CHECK:
1082 case LookupIterator::JSPROXY: 1081 case LookupIterator::JSPROXY:
1083 case LookupIterator::NOT_FOUND: 1082 case LookupIterator::NOT_FOUND:
1084 case LookupIterator::TRANSITION: 1083 case LookupIterator::TRANSITION:
1085 case LookupIterator::UNKNOWN:
1086 UNREACHABLE(); 1084 UNREACHABLE();
1087 } 1085 }
1088 1086
1089 return slow_stub(); 1087 return slow_stub();
1090 } 1088 }
1091 1089
1092 1090
1093 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { 1091 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) {
1094 // This helper implements a few common fast cases for converting 1092 // This helper implements a few common fast cases for converting
1095 // non-smi keys of keyed loads/stores to a smi or a string. 1093 // non-smi keys of keyed loads/stores to a smi or a string.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 JSReceiver::StoreFromKeyed store_mode) { 1223 JSReceiver::StoreFromKeyed store_mode) {
1226 // Disable ICs for non-JSObjects for now. 1224 // Disable ICs for non-JSObjects for now.
1227 Handle<Object> receiver = it->GetReceiver(); 1225 Handle<Object> receiver = it->GetReceiver();
1228 if (!receiver->IsJSObject()) return false; 1226 if (!receiver->IsJSObject()) return false;
1229 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); 1227 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated());
1230 1228
1231 for (; it->IsFound(); it->Next()) { 1229 for (; it->IsFound(); it->Next()) {
1232 switch (it->state()) { 1230 switch (it->state()) {
1233 case LookupIterator::NOT_FOUND: 1231 case LookupIterator::NOT_FOUND:
1234 case LookupIterator::TRANSITION: 1232 case LookupIterator::TRANSITION:
1235 case LookupIterator::UNKNOWN:
1236 UNREACHABLE(); 1233 UNREACHABLE();
1237 case LookupIterator::JSPROXY: 1234 case LookupIterator::JSPROXY:
1238 return false; 1235 return false;
1239 case LookupIterator::INTERCEPTOR: { 1236 case LookupIterator::INTERCEPTOR: {
1240 Handle<JSObject> holder = it->GetHolder<JSObject>(); 1237 Handle<JSObject> holder = it->GetHolder<JSObject>();
1241 InterceptorInfo* info = holder->GetNamedInterceptor(); 1238 InterceptorInfo* info = holder->GetNamedInterceptor();
1242 if (it->HolderIsReceiverOrHiddenPrototype()) { 1239 if (it->HolderIsReceiverOrHiddenPrototype()) {
1243 if (!info->setter()->IsUndefined()) return true; 1240 if (!info->setter()->IsUndefined()) return true;
1244 } else if (!info->getter()->IsUndefined() || 1241 } else if (!info->getter()->IsUndefined() ||
1245 !info->query()->IsUndefined()) { 1242 !info->query()->IsUndefined()) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 } 1493 }
1497 1494
1498 // -------------- Constant properties -------------- 1495 // -------------- Constant properties --------------
1499 DCHECK(lookup->property_details().type() == CONSTANT); 1496 DCHECK(lookup->property_details().type() == CONSTANT);
1500 break; 1497 break;
1501 } 1498 }
1502 1499
1503 case LookupIterator::ACCESS_CHECK: 1500 case LookupIterator::ACCESS_CHECK:
1504 case LookupIterator::JSPROXY: 1501 case LookupIterator::JSPROXY:
1505 case LookupIterator::NOT_FOUND: 1502 case LookupIterator::NOT_FOUND:
1506 case LookupIterator::UNKNOWN:
1507 UNREACHABLE(); 1503 UNREACHABLE();
1508 } 1504 }
1509 return slow_stub(); 1505 return slow_stub();
1510 } 1506 }
1511 1507
1512 1508
1513 Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver, 1509 Handle<Code> KeyedStoreIC::StoreElementStub(Handle<JSObject> receiver,
1514 KeyedAccessStoreMode store_mode) { 1510 KeyedAccessStoreMode store_mode) {
1515 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS 1511 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS
1516 // via megamorphic stubs, since they don't have a map in their relocation info 1512 // via megamorphic stubs, since they don't have a map in their relocation info
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 static const Address IC_utilities[] = { 3201 static const Address IC_utilities[] = {
3206 #define ADDR(name) FUNCTION_ADDR(name), 3202 #define ADDR(name) FUNCTION_ADDR(name),
3207 IC_UTIL_LIST(ADDR) NULL 3203 IC_UTIL_LIST(ADDR) NULL
3208 #undef ADDR 3204 #undef ADDR
3209 }; 3205 };
3210 3206
3211 3207
3212 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3208 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3213 } 3209 }
3214 } // namespace v8::internal 3210 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/lookup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698