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

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

Issue 2624903003: [runtime] Use PropertyKind/PropertyLocation instead of PropertyType. (Closed)
Patch Set: Addressing comments Created 3 years, 11 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
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/json-stringifier.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 // 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/ic/ic.h" 5 #include "src/ic/ic.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/api-arguments-inl.h" 10 #include "src/api-arguments-inl.h"
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 return LoadFromPrototype(map, holder, lookup->name(), smi_handler); 1389 return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
1390 } 1390 }
1391 break; // Custom-compiled handler. 1391 break; // Custom-compiled handler.
1392 } 1392 }
1393 } 1393 }
1394 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); 1394 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
1395 return slow_stub(); 1395 return slow_stub();
1396 } 1396 }
1397 1397
1398 case LookupIterator::DATA: { 1398 case LookupIterator::DATA: {
1399 DCHECK_EQ(kData, lookup->property_details().kind());
1399 if (lookup->is_dictionary_holder()) { 1400 if (lookup->is_dictionary_holder()) {
1400 if (kind() != Code::LOAD_IC && kind() != Code::LOAD_GLOBAL_IC) { 1401 if (kind() != Code::LOAD_IC && kind() != Code::LOAD_GLOBAL_IC) {
1401 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); 1402 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
1402 return slow_stub(); 1403 return slow_stub();
1403 } 1404 }
1404 if (holder->IsJSGlobalObject()) { 1405 if (holder->IsJSGlobalObject()) {
1405 break; // Custom-compiled handler. 1406 break; // Custom-compiled handler.
1406 } 1407 }
1407 // There is only one shared stub for loading normalized 1408 // There is only one shared stub for loading normalized
1408 // properties. It does not traverse the prototype chain, so the 1409 // properties. It does not traverse the prototype chain, so the
1409 // property must be found in the object for the stub to be 1410 // property must be found in the object for the stub to be
1410 // applicable. 1411 // applicable.
1411 if (!receiver_is_holder) { 1412 if (!receiver_is_holder) {
1412 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); 1413 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub);
1413 return slow_stub(); 1414 return slow_stub();
1414 } 1415 }
1415 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormal); 1416 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormal);
1416 return isolate()->builtins()->LoadIC_Normal(); 1417 return isolate()->builtins()->LoadIC_Normal();
1417 } 1418 }
1418 1419
1419 // -------------- Fields -------------- 1420 // -------------- Fields --------------
1420 if (lookup->property_details().type() == DATA) { 1421 if (lookup->property_details().location() == kField) {
1421 FieldIndex field = lookup->GetFieldIndex(); 1422 FieldIndex field = lookup->GetFieldIndex();
1422 Handle<Object> smi_handler = SimpleFieldLoad(isolate(), field); 1423 Handle<Object> smi_handler = SimpleFieldLoad(isolate(), field);
1423 if (receiver_is_holder) { 1424 if (receiver_is_holder) {
1424 return smi_handler; 1425 return smi_handler;
1425 } 1426 }
1426 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH); 1427 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH);
1427 return LoadFromPrototype(map, holder, lookup->name(), smi_handler); 1428 return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
1428 } 1429 }
1429 1430
1430 // -------------- Constant properties -------------- 1431 // -------------- Constant properties --------------
1431 DCHECK(lookup->property_details().type() == DATA_CONSTANT); 1432 DCHECK_EQ(kDescriptor, lookup->property_details().location());
1432 Handle<Object> smi_handler = 1433 Handle<Object> smi_handler =
1433 LoadHandler::LoadConstant(isolate(), lookup->GetConstantIndex()); 1434 LoadHandler::LoadConstant(isolate(), lookup->GetConstantIndex());
1434 if (receiver_is_holder) { 1435 if (receiver_is_holder) {
1435 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantDH); 1436 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantDH);
1436 return smi_handler; 1437 return smi_handler;
1437 } 1438 }
1438 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantFromPrototypeDH); 1439 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantFromPrototypeDH);
1439 return LoadFromPrototype(map, holder, lookup->name(), smi_handler); 1440 return LoadFromPrototype(map, holder, lookup->name(), smi_handler);
1440 } 1441 }
1441 1442
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 int descriptor = transition->LastAdded(); 1872 int descriptor = transition->LastAdded();
1872 Handle<DescriptorArray> descriptors(transition->instance_descriptors()); 1873 Handle<DescriptorArray> descriptors(transition->instance_descriptors());
1873 PropertyDetails details = descriptors->GetDetails(descriptor); 1874 PropertyDetails details = descriptors->GetDetails(descriptor);
1874 Representation representation = details.representation(); 1875 Representation representation = details.representation();
1875 DCHECK(!representation.IsNone()); 1876 DCHECK(!representation.IsNone());
1876 1877
1877 // Declarative handlers don't support access checks. 1878 // Declarative handlers don't support access checks.
1878 DCHECK(!transition->is_access_check_needed()); 1879 DCHECK(!transition->is_access_check_needed());
1879 1880
1880 Handle<Object> smi_handler; 1881 Handle<Object> smi_handler;
1881 if (details.type() == DATA_CONSTANT) { 1882 DCHECK_EQ(kData, details.kind());
1883 if (details.location() == kDescriptor) {
1882 smi_handler = StoreHandler::TransitionToConstant(isolate(), descriptor); 1884 smi_handler = StoreHandler::TransitionToConstant(isolate(), descriptor);
1883 1885
1884 } else { 1886 } else {
1885 DCHECK_EQ(DATA, details.type()); 1887 DCHECK_EQ(kField, details.location());
1886 bool extend_storage = 1888 bool extend_storage =
1887 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0; 1889 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0;
1888 1890
1889 FieldIndex index = FieldIndex::ForDescriptor(*transition, descriptor); 1891 FieldIndex index = FieldIndex::ForDescriptor(*transition, descriptor);
1890 smi_handler = StoreHandler::TransitionToField( 1892 smi_handler = StoreHandler::TransitionToField(
1891 isolate(), descriptor, index, representation, extend_storage); 1893 isolate(), descriptor, index, representation, extend_storage);
1892 } 1894 }
1893 // |holder| is either a receiver if the property is non-existent or 1895 // |holder| is either a receiver if the property is non-existent or
1894 // one of the prototypes. 1896 // one of the prototypes.
1895 DCHECK(!holder.is_null()); 1897 DCHECK(!holder.is_null());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub); 2024 TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub);
2023 return slow_stub(); 2025 return slow_stub();
2024 } 2026 }
2025 break; // Custom-compiled handler. 2027 break; // Custom-compiled handler.
2026 } 2028 }
2027 TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub); 2029 TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub);
2028 return slow_stub(); 2030 return slow_stub();
2029 } 2031 }
2030 2032
2031 case LookupIterator::DATA: { 2033 case LookupIterator::DATA: {
2034 DCHECK_EQ(kData, lookup->property_details().kind());
2032 if (lookup->is_dictionary_holder()) { 2035 if (lookup->is_dictionary_holder()) {
2033 if (holder->IsJSGlobalObject()) { 2036 if (holder->IsJSGlobalObject()) {
2034 break; // Custom-compiled handler. 2037 break; // Custom-compiled handler.
2035 } 2038 }
2036 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreNormal); 2039 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreNormal);
2037 DCHECK(holder.is_identical_to(receiver)); 2040 DCHECK(holder.is_identical_to(receiver));
2038 return isolate()->builtins()->StoreIC_Normal(); 2041 return isolate()->builtins()->StoreIC_Normal();
2039 } 2042 }
2040 2043
2041 // -------------- Fields -------------- 2044 // -------------- Fields --------------
2042 if (lookup->property_details().type() == DATA) { 2045 if (lookup->property_details().location() == kField) {
2043 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreFieldDH); 2046 TRACE_HANDLER_STATS(isolate(), StoreIC_StoreFieldDH);
2044 int descriptor = lookup->GetFieldDescriptorIndex(); 2047 int descriptor = lookup->GetFieldDescriptorIndex();
2045 FieldIndex index = lookup->GetFieldIndex(); 2048 FieldIndex index = lookup->GetFieldIndex();
2046 return StoreHandler::StoreField(isolate(), descriptor, index, 2049 return StoreHandler::StoreField(isolate(), descriptor, index,
2047 lookup->representation()); 2050 lookup->representation());
2048 } 2051 }
2049 2052
2050 // -------------- Constant properties -------------- 2053 // -------------- Constant properties --------------
2051 DCHECK(lookup->property_details().type() == DATA_CONSTANT); 2054 DCHECK_EQ(kDescriptor, lookup->property_details().location());
2052 TRACE_GENERIC_IC(isolate(), "StoreIC", "constant property"); 2055 TRACE_GENERIC_IC(isolate(), "StoreIC", "constant property");
2053 TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub); 2056 TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub);
2054 return slow_stub(); 2057 return slow_stub();
2055 } 2058 }
2056 2059
2057 case LookupIterator::INTEGER_INDEXED_EXOTIC: 2060 case LookupIterator::INTEGER_INDEXED_EXOTIC:
2058 case LookupIterator::ACCESS_CHECK: 2061 case LookupIterator::ACCESS_CHECK:
2059 case LookupIterator::JSPROXY: 2062 case LookupIterator::JSPROXY:
2060 case LookupIterator::NOT_FOUND: 2063 case LookupIterator::NOT_FOUND:
2061 UNREACHABLE(); 2064 UNREACHABLE();
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3217 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3215 it.Next(); 3218 it.Next();
3216 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3219 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3217 Object::GetProperty(&it)); 3220 Object::GetProperty(&it));
3218 } 3221 }
3219 3222
3220 return *result; 3223 return *result;
3221 } 3224 }
3222 } // namespace internal 3225 } // namespace internal
3223 } // namespace v8 3226 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/json-stringifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698