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

Side by Side Diff: src/ic.cc

Issue 23699002: load ics for js api accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/ia32/stub-cache-ia32.cc ('k') | src/stub-cache.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 // 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 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 if (v8::ToCData<Address>(info->getter()) == 0) break; 1350 if (v8::ToCData<Address>(info->getter()) == 0) break;
1351 if (!info->IsCompatibleReceiver(*receiver)) break; 1351 if (!info->IsCompatibleReceiver(*receiver)) break;
1352 return isolate()->stub_cache()->ComputeLoadCallback( 1352 return isolate()->stub_cache()->ComputeLoadCallback(
1353 name, receiver, holder, info); 1353 name, receiver, holder, info);
1354 } else if (callback->IsAccessorPair()) { 1354 } else if (callback->IsAccessorPair()) {
1355 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), 1355 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(),
1356 isolate()); 1356 isolate());
1357 if (!getter->IsJSFunction()) break; 1357 if (!getter->IsJSFunction()) break;
1358 if (holder->IsGlobalObject()) break; 1358 if (holder->IsGlobalObject()) break;
1359 if (!holder->HasFastProperties()) break; 1359 if (!holder->HasFastProperties()) break;
1360 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
1361 CallOptimization call_optimization(function);
1362 if (call_optimization.is_simple_api_call() &&
1363 call_optimization.IsCompatibleReceiver(*receiver)) {
1364 return isolate()->stub_cache()->ComputeLoadCallback(
1365 name, receiver, holder, call_optimization);
1366 }
1360 return isolate()->stub_cache()->ComputeLoadViaGetter( 1367 return isolate()->stub_cache()->ComputeLoadViaGetter(
1361 name, receiver, holder, Handle<JSFunction>::cast(getter)); 1368 name, receiver, holder, function);
1362 } else if (receiver->IsJSArray() && 1369 } else if (receiver->IsJSArray() &&
1363 name->Equals(isolate()->heap()->length_string())) { 1370 name->Equals(isolate()->heap()->length_string())) {
1364 PropertyIndex lengthIndex = 1371 PropertyIndex lengthIndex =
1365 PropertyIndex::NewHeaderIndex(JSArray::kLengthOffset / kPointerSize); 1372 PropertyIndex::NewHeaderIndex(JSArray::kLengthOffset / kPointerSize);
1366 return isolate()->stub_cache()->ComputeLoadField( 1373 return isolate()->stub_cache()->ComputeLoadField(
1367 name, receiver, holder, lengthIndex, Representation::Tagged()); 1374 name, receiver, holder, lengthIndex, Representation::Tagged());
1368 } 1375 }
1369 // TODO(dcarney): Handle correctly. 1376 // TODO(dcarney): Handle correctly.
1370 if (callback->IsDeclaredAccessorInfo()) break; 1377 if (callback->IsDeclaredAccessorInfo()) break;
1371 ASSERT(callback->IsForeign()); 1378 ASSERT(callback->IsForeign());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 Handle<Object> constant(lookup->GetConstant(), isolate()); 1544 Handle<Object> constant(lookup->GetConstant(), isolate());
1538 // TODO(2803): Don't compute a stub for cons strings because they cannot 1545 // TODO(2803): Don't compute a stub for cons strings because they cannot
1539 // be embedded into code. 1546 // be embedded into code.
1540 if (constant->IsConsString()) return Handle<Code>::null(); 1547 if (constant->IsConsString()) return Handle<Code>::null();
1541 return isolate()->stub_cache()->ComputeKeyedLoadConstant( 1548 return isolate()->stub_cache()->ComputeKeyedLoadConstant(
1542 name, receiver, holder, constant); 1549 name, receiver, holder, constant);
1543 } 1550 }
1544 case CALLBACKS: { 1551 case CALLBACKS: {
1545 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate()); 1552 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate());
1546 // TODO(dcarney): Handle DeclaredAccessorInfo correctly. 1553 // TODO(dcarney): Handle DeclaredAccessorInfo correctly.
1547 if (!callback_object->IsExecutableAccessorInfo()) break; 1554 if (callback_object->IsExecutableAccessorInfo()) {
1548 Handle<ExecutableAccessorInfo> callback = 1555 Handle<ExecutableAccessorInfo> callback =
1549 Handle<ExecutableAccessorInfo>::cast(callback_object); 1556 Handle<ExecutableAccessorInfo>::cast(callback_object);
1550 if (v8::ToCData<Address>(callback->getter()) == 0) break; 1557 if (v8::ToCData<Address>(callback->getter()) == 0) break;
1551 if (!callback->IsCompatibleReceiver(*receiver)) break; 1558 if (!callback->IsCompatibleReceiver(*receiver)) break;
1552 return isolate()->stub_cache()->ComputeKeyedLoadCallback( 1559 return isolate()->stub_cache()->ComputeKeyedLoadCallback(
1553 name, receiver, holder, callback); 1560 name, receiver, holder, callback);
1561 } else if (callback_object->IsAccessorPair()) {
1562 Handle<Object> getter(
1563 Handle<AccessorPair>::cast(callback_object)->getter(),
1564 isolate());
1565 if (!getter->IsJSFunction()) break;
1566 if (holder->IsGlobalObject()) break;
1567 if (!holder->HasFastProperties()) break;
1568 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
1569 CallOptimization call_optimization(function);
1570 if (call_optimization.is_simple_api_call() &&
1571 call_optimization.IsCompatibleReceiver(*receiver)) {
1572 return isolate()->stub_cache()->ComputeKeyedLoadCallback(
1573 name, receiver, holder, call_optimization);
1574 }
1575 }
1576 break;
1554 } 1577 }
1555 case INTERCEPTOR: 1578 case INTERCEPTOR:
1556 ASSERT(HasInterceptorGetter(lookup->holder())); 1579 ASSERT(HasInterceptorGetter(lookup->holder()));
1557 return isolate()->stub_cache()->ComputeKeyedLoadInterceptor( 1580 return isolate()->stub_cache()->ComputeKeyedLoadInterceptor(
1558 name, receiver, holder); 1581 name, receiver, holder);
1559 default: 1582 default:
1560 // Always rewrite to the generic case so that we do not 1583 // Always rewrite to the generic case so that we do not
1561 // repeatedly try to rewrite. 1584 // repeatedly try to rewrite.
1562 return generic_stub(); 1585 return generic_stub();
1563 } 1586 }
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
3105 #undef ADDR 3128 #undef ADDR
3106 }; 3129 };
3107 3130
3108 3131
3109 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3132 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3110 return IC_utilities[id]; 3133 return IC_utilities[id];
3111 } 3134 }
3112 3135
3113 3136
3114 } } // namespace v8::internal 3137 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698