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

Side by Side Diff: src/ic.cc

Issue 8356041: Handlify KeyedIC::ComputeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase and address comments. Created 9 years, 2 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.h ('k') | src/list.h » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } else if (state == MEGAMORPHIC) { 964 } else if (state == MEGAMORPHIC) {
965 // Cache code holding map should be consistent with 965 // Cache code holding map should be consistent with
966 // GenerateMonomorphicCacheProbe. 966 // GenerateMonomorphicCacheProbe.
967 isolate()->stub_cache()->Set(*name, receiver->map(), *code); 967 isolate()->stub_cache()->Set(*name, receiver->map(), *code);
968 } 968 }
969 969
970 TRACE_IC("LoadIC", name, state, target()); 970 TRACE_IC("LoadIC", name, state, target());
971 } 971 }
972 972
973 973
974 MaybeObject* KeyedLoadIC::GetElementStubWithoutMapCheck( 974 Handle<Code> KeyedLoadIC::GetElementStubWithoutMapCheck(
975 bool is_js_array, 975 bool is_js_array,
976 ElementsKind elements_kind) { 976 ElementsKind elements_kind) {
977 return KeyedLoadElementStub(elements_kind).TryGetCode(); 977 return KeyedLoadElementStub(elements_kind).GetCode();
978 } 978 }
979 979
980 980
981 MaybeObject* KeyedLoadIC::ComputePolymorphicStub( 981 Handle<Code> KeyedLoadIC::ComputePolymorphicStub(
982 MapList* receiver_maps, 982 MapHandleList* receiver_maps,
983 StrictModeFlag strict_mode) { 983 StrictModeFlag strict_mode) {
984 CodeList handler_ics(receiver_maps->length()); 984 CodeHandleList handler_ics(receiver_maps->length());
985 for (int i = 0; i < receiver_maps->length(); ++i) { 985 for (int i = 0; i < receiver_maps->length(); ++i) {
986 Map* receiver_map(receiver_maps->at(i)); 986 Handle<Map> receiver_map = receiver_maps->at(i);
987 MaybeObject* maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck( 987 Handle<Code> cached_stub = ComputeMonomorphicStubWithoutMapCheck(
988 receiver_map, strict_mode); 988 receiver_map, strict_mode);
989 Code* cached_stub;
990 if (!maybe_cached_stub->To(&cached_stub)) return maybe_cached_stub;
991 handler_ics.Add(cached_stub); 989 handler_ics.Add(cached_stub);
992 } 990 }
993 Object* object;
994 HandleScope scope(isolate());
995 KeyedLoadStubCompiler compiler(isolate()); 991 KeyedLoadStubCompiler compiler(isolate());
996 MaybeObject* maybe_code = compiler.CompileLoadPolymorphic(receiver_maps, 992 Handle<Code> code = compiler.CompileLoadPolymorphic(
997 &handler_ics); 993 receiver_maps, &handler_ics);
998 if (!maybe_code->ToObject(&object)) return maybe_code;
999 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); 994 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
1000 PROFILE(isolate(), CodeCreateEvent( 995 PROFILE(isolate(),
1001 Logger::KEYED_LOAD_MEGAMORPHIC_IC_TAG, 996 CodeCreateEvent(Logger::KEYED_LOAD_MEGAMORPHIC_IC_TAG, *code, 0));
1002 Code::cast(object), 0)); 997 return code;
1003 return object;
1004 } 998 }
1005 999
1006 1000
1007 MaybeObject* KeyedLoadIC::Load(State state, 1001 MaybeObject* KeyedLoadIC::Load(State state,
1008 Handle<Object> object, 1002 Handle<Object> object,
1009 Handle<Object> key, 1003 Handle<Object> key,
1010 bool force_generic_stub) { 1004 bool force_generic_stub) {
1011 // Check for values that can be converted into a symbol. 1005 // Check for values that can be converted into a symbol.
1012 // TODO(1295): Remove this code. 1006 // TODO(1295): Remove this code.
1013 if (key->IsHeapNumber() && 1007 if (key->IsHeapNumber() &&
(...skipping 13 matching lines...) Expand all
1027 } 1021 }
1028 1022
1029 if (FLAG_use_ic) { 1023 if (FLAG_use_ic) {
1030 // TODO(1073): don't ignore the current stub state. 1024 // TODO(1073): don't ignore the current stub state.
1031 1025
1032 // Use specialized code for getting the length of strings. 1026 // Use specialized code for getting the length of strings.
1033 if (object->IsString() && 1027 if (object->IsString() &&
1034 name->Equals(isolate()->heap()->length_symbol())) { 1028 name->Equals(isolate()->heap()->length_symbol())) {
1035 Handle<String> string = Handle<String>::cast(object); 1029 Handle<String> string = Handle<String>::cast(object);
1036 Handle<Code> code = 1030 Handle<Code> code =
1037 isolate()->stub_cache()->ComputeKeyedLoadStringLength(name, 1031 isolate()->stub_cache()->ComputeKeyedLoadStringLength(name, string);
1038 string);
1039 ASSERT(!code.is_null()); 1032 ASSERT(!code.is_null());
1040 set_target(*code); 1033 set_target(*code);
1041 TRACE_IC("KeyedLoadIC", name, state, target()); 1034 TRACE_IC("KeyedLoadIC", name, state, target());
1042 return Smi::FromInt(string->length()); 1035 return Smi::FromInt(string->length());
1043 } 1036 }
1044 1037
1045 // Use specialized code for getting the length of arrays. 1038 // Use specialized code for getting the length of arrays.
1046 if (object->IsJSArray() && 1039 if (object->IsJSArray() &&
1047 name->Equals(isolate()->heap()->length_symbol())) { 1040 name->Equals(isolate()->heap()->length_symbol())) {
1048 Handle<JSArray> array = Handle<JSArray>::cast(object); 1041 Handle<JSArray> array = Handle<JSArray>::cast(object);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 } 1406 }
1414 } else if (state == MEGAMORPHIC) { 1407 } else if (state == MEGAMORPHIC) {
1415 // Update the stub cache. 1408 // Update the stub cache.
1416 isolate()->stub_cache()->Set(*name, receiver->map(), *code); 1409 isolate()->stub_cache()->Set(*name, receiver->map(), *code);
1417 } 1410 }
1418 1411
1419 TRACE_IC("StoreIC", name, state, target()); 1412 TRACE_IC("StoreIC", name, state, target());
1420 } 1413 }
1421 1414
1422 1415
1423 static bool AddOneReceiverMapIfMissing(MapList* receiver_maps, 1416 static bool AddOneReceiverMapIfMissing(MapHandleList* receiver_maps,
1424 Map* new_receiver_map) { 1417 Handle<Map> new_receiver_map) {
1418 ASSERT(!new_receiver_map.is_null());
1425 for (int current = 0; current < receiver_maps->length(); ++current) { 1419 for (int current = 0; current < receiver_maps->length(); ++current) {
1426 if (receiver_maps->at(current) == new_receiver_map) { 1420 if (!receiver_maps->at(current).is_null() &&
1421 receiver_maps->at(current).is_identical_to(new_receiver_map)) {
1427 return false; 1422 return false;
1428 } 1423 }
1429 } 1424 }
1430 receiver_maps->Add(new_receiver_map); 1425 receiver_maps->Add(new_receiver_map);
1431 return true; 1426 return true;
1432 } 1427 }
1433 1428
1434 1429
1435 void KeyedIC::GetReceiverMapsForStub(Code* stub, MapList* result) { 1430 void KeyedIC::GetReceiverMapsForStub(Handle<Code> stub,
1431 MapHandleList* result) {
1436 ASSERT(stub->is_inline_cache_stub()); 1432 ASSERT(stub->is_inline_cache_stub());
1437 if (!string_stub().is_null() && stub == *string_stub()) { 1433 if (!string_stub().is_null() && stub.is_identical_to(string_stub())) {
1438 return result->Add(isolate()->heap()->string_map()); 1434 return result->Add(isolate()->factory()->string_map());
1439 } else if (stub->is_keyed_load_stub() || stub->is_keyed_store_stub()) { 1435 } else if (stub->is_keyed_load_stub() || stub->is_keyed_store_stub()) {
1440 if (stub->ic_state() == MONOMORPHIC) { 1436 if (stub->ic_state() == MONOMORPHIC) {
1441 result->Add(Map::cast(stub->FindFirstMap())); 1437 result->Add(Handle<Map>(stub->FindFirstMap()));
1442 } else { 1438 } else {
1443 ASSERT(stub->ic_state() == MEGAMORPHIC); 1439 ASSERT(stub->ic_state() == MEGAMORPHIC);
1444 AssertNoAllocation no_allocation; 1440 AssertNoAllocation no_allocation;
1445 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 1441 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
1446 for (RelocIterator it(stub, mask); !it.done(); it.next()) { 1442 for (RelocIterator it(*stub, mask); !it.done(); it.next()) {
1447 RelocInfo* info = it.rinfo(); 1443 RelocInfo* info = it.rinfo();
1448 Object* object = info->target_object(); 1444 Handle<Object> object(info->target_object());
1449 ASSERT(object->IsMap()); 1445 ASSERT(object->IsMap());
1450 AddOneReceiverMapIfMissing(result, Map::cast(object)); 1446 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object));
1451 } 1447 }
1452 } 1448 }
1453 } 1449 }
1454 } 1450 }
1455 1451
1456 1452
1457 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, 1453 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver,
1458 StubKind stub_kind, 1454 StubKind stub_kind,
1459 StrictModeFlag strict_mode, 1455 StrictModeFlag strict_mode,
1460 Handle<Code> generic_stub) { 1456 Handle<Code> generic_stub) {
1461 CALL_HEAP_FUNCTION(isolate(),
1462 ComputeStub(*receiver,
1463 stub_kind,
1464 strict_mode,
1465 *generic_stub),
1466 Code);
1467 }
1468
1469
1470
1471 MaybeObject* KeyedIC::ComputeStub(JSObject* receiver,
1472 StubKind stub_kind,
1473 StrictModeFlag strict_mode,
1474 Code* generic_stub) {
1475 State ic_state = target()->ic_state(); 1457 State ic_state = target()->ic_state();
1476 if ((ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) && 1458 if ((ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) &&
1477 !IsTransitionStubKind(stub_kind)) { 1459 !IsTransitionStubKind(stub_kind)) {
1478 Code* monomorphic_stub; 1460 return ComputeMonomorphicStub(
1479 MaybeObject* maybe_stub = ComputeMonomorphicStub(receiver, 1461 receiver, stub_kind, strict_mode, generic_stub);
1480 stub_kind,
1481 strict_mode,
1482 generic_stub);
1483 if (!maybe_stub->To(&monomorphic_stub)) return maybe_stub;
1484
1485 return monomorphic_stub;
1486 } 1462 }
1487 ASSERT(target() != generic_stub); 1463 ASSERT(target() != *generic_stub);
1488 1464
1489 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS 1465 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS
1490 // via megamorphic stubs, since they don't have a map in their relocation info 1466 // via megamorphic stubs, since they don't have a map in their relocation info
1491 // and so the stubs can't be harvested for the object needed for a map check. 1467 // and so the stubs can't be harvested for the object needed for a map check.
1492 if (target()->type() != NORMAL) { 1468 if (target()->type() != NORMAL) {
1493 return generic_stub; 1469 return generic_stub;
1494 } 1470 }
1495 1471
1496 // Determine the list of receiver maps that this call site has seen, 1472 // Determine the list of receiver maps that this call site has seen,
1497 // adding the map that was just encountered. 1473 // adding the map that was just encountered.
1498 MapList target_receiver_maps; 1474 MapHandleList target_receiver_maps;
1475 Handle<Map> receiver_map(receiver->map());
1499 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { 1476 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) {
1500 target_receiver_maps.Add(receiver->map()); 1477 target_receiver_maps.Add(receiver_map);
1501 } else { 1478 } else {
1502 GetReceiverMapsForStub(target(), &target_receiver_maps); 1479 GetReceiverMapsForStub(Handle<Code>(target()), &target_receiver_maps);
1503 } 1480 }
1504 bool map_added = 1481 bool map_added =
1505 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver->map()); 1482 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map);
1506 if (IsTransitionStubKind(stub_kind)) { 1483 if (IsTransitionStubKind(stub_kind)) {
1507 MaybeObject* maybe_map = ComputeTransitionedMap(receiver, stub_kind); 1484 Handle<Map> new_map = ComputeTransitionedMap(receiver, stub_kind);
1508 Map* new_map = NULL;
1509 if (!maybe_map->To(&new_map)) return maybe_map;
1510 map_added |= AddOneReceiverMapIfMissing(&target_receiver_maps, new_map); 1485 map_added |= AddOneReceiverMapIfMissing(&target_receiver_maps, new_map);
1511 } 1486 }
1512 if (!map_added) { 1487 if (!map_added) {
1513 // If the miss wasn't due to an unseen map, a polymorphic stub 1488 // If the miss wasn't due to an unseen map, a polymorphic stub
1514 // won't help, use the generic stub. 1489 // won't help, use the generic stub.
1515 return generic_stub; 1490 return generic_stub;
1516 } 1491 }
1517 1492
1518 // If the maximum number of receiver maps has been exceeded, use the generic 1493 // If the maximum number of receiver maps has been exceeded, use the generic
1519 // version of the IC. 1494 // version of the IC.
1520 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { 1495 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) {
1521 return generic_stub; 1496 return generic_stub;
1522 } 1497 }
1523 1498
1524 PolymorphicCodeCache* cache = isolate()->heap()->polymorphic_code_cache(); 1499 Handle<PolymorphicCodeCache> cache =
1525 Code::Flags flags = Code::ComputeFlags(this->kind(), 1500 isolate()->factory()->polymorphic_code_cache();
1526 MEGAMORPHIC, 1501 Code::Flags flags = Code::ComputeFlags(kind(), MEGAMORPHIC, strict_mode);
1527 strict_mode); 1502 Handle<Object> probe = cache->Lookup(&target_receiver_maps, flags);
1528 Object* maybe_cached_stub = cache->Lookup(&target_receiver_maps, flags); 1503 if (probe->IsCode()) return Handle<Code>::cast(probe);
1529 // If there is a cached stub, use it. 1504
1530 if (!maybe_cached_stub->IsUndefined()) { 1505 Handle<Code> stub =
1531 ASSERT(maybe_cached_stub->IsCode());
1532 return Code::cast(maybe_cached_stub);
1533 }
1534 MaybeObject* maybe_stub =
1535 ComputePolymorphicStub(&target_receiver_maps, strict_mode); 1506 ComputePolymorphicStub(&target_receiver_maps, strict_mode);
1536 Code* stub; 1507 PolymorphicCodeCache::Update(cache, &target_receiver_maps, flags, stub);
1537 if (!maybe_stub->To(&stub)) return maybe_stub;
1538 MaybeObject* maybe_update = cache->Update(&target_receiver_maps, flags, stub);
1539 if (maybe_update->IsFailure()) return maybe_update;
1540 return stub; 1508 return stub;
1541 } 1509 }
1542 1510
1543 1511
1544 MaybeObject* KeyedIC::ComputeMonomorphicStubWithoutMapCheck( 1512 Handle<Code> KeyedIC::ComputeMonomorphicStubWithoutMapCheck(
1545 Map* receiver_map, 1513 Handle<Map> receiver_map,
1546 StrictModeFlag strict_mode) { 1514 StrictModeFlag strict_mode) {
1547 if ((receiver_map->instance_type() & kNotStringTag) == 0) { 1515 if ((receiver_map->instance_type() & kNotStringTag) == 0) {
1548 ASSERT(!string_stub().is_null()); 1516 ASSERT(!string_stub().is_null());
1549 return *string_stub(); 1517 return string_stub();
1550 } else { 1518 } else {
1551 ASSERT(receiver_map->has_dictionary_elements() || 1519 ASSERT(receiver_map->has_dictionary_elements() ||
1552 receiver_map->has_fast_elements() || 1520 receiver_map->has_fast_elements() ||
1553 receiver_map->has_fast_smi_only_elements() || 1521 receiver_map->has_fast_smi_only_elements() ||
1554 receiver_map->has_fast_double_elements() || 1522 receiver_map->has_fast_double_elements() ||
1555 receiver_map->has_external_array_elements()); 1523 receiver_map->has_external_array_elements());
1556 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1524 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1557 return GetElementStubWithoutMapCheck(is_js_array, 1525 return GetElementStubWithoutMapCheck(is_js_array,
1558 receiver_map->elements_kind()); 1526 receiver_map->elements_kind());
1559 } 1527 }
1560 } 1528 }
1561 1529
1562 1530
1563 MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver, 1531 Handle<Code> KeyedIC::ComputeMonomorphicStub(Handle<JSObject> receiver,
1564 StubKind stub_kind, 1532 StubKind stub_kind,
1565 StrictModeFlag strict_mode, 1533 StrictModeFlag strict_mode,
1566 Code* generic_stub) { 1534 Handle<Code> generic_stub) {
1567 Code* result = NULL;
1568 if (receiver->HasFastElements() || 1535 if (receiver->HasFastElements() ||
1569 receiver->HasFastSmiOnlyElements() || 1536 receiver->HasFastSmiOnlyElements() ||
1570 receiver->HasExternalArrayElements() || 1537 receiver->HasExternalArrayElements() ||
1571 receiver->HasFastDoubleElements() || 1538 receiver->HasFastDoubleElements() ||
1572 receiver->HasDictionaryElements()) { 1539 receiver->HasDictionaryElements()) {
1573 MaybeObject* maybe_stub = 1540 return isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement(
1574 isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement( 1541 receiver, stub_kind, strict_mode);
1575 receiver, stub_kind, strict_mode);
1576 if (!maybe_stub->To(&result)) return maybe_stub;
1577 } else { 1542 } else {
1578 result = generic_stub; 1543 return generic_stub;
1579 }
1580 return result;
1581 }
1582
1583
1584 MaybeObject* KeyedIC::ComputeTransitionedMap(JSObject* receiver,
1585 StubKind stub_kind) {
1586 switch (stub_kind) {
1587 case KeyedIC::STORE_TRANSITION_SMI_TO_OBJECT:
1588 case KeyedIC::STORE_TRANSITION_DOUBLE_TO_OBJECT:
1589 return receiver->GetElementsTransitionMap(FAST_ELEMENTS);
1590 case KeyedIC::STORE_TRANSITION_SMI_TO_DOUBLE:
1591 return receiver->GetElementsTransitionMap(FAST_DOUBLE_ELEMENTS);
1592 default:
1593 UNREACHABLE();
1594 return NULL;
1595 } 1544 }
1596 } 1545 }
1597 1546
1598 1547
1599 MaybeObject* KeyedStoreIC::GetElementStubWithoutMapCheck( 1548 Handle<Map> KeyedIC::ComputeTransitionedMap(Handle<JSObject> receiver,
1600 bool is_js_array, 1549 StubKind stub_kind) {
1601 ElementsKind elements_kind) { 1550 switch (stub_kind) {
1602 return KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); 1551 case KeyedIC::STORE_TRANSITION_SMI_TO_OBJECT:
1552 case KeyedIC::STORE_TRANSITION_DOUBLE_TO_OBJECT:
1553 return JSObject::GetElementsTransitionMap(receiver, FAST_ELEMENTS);
1554 break;
1555 case KeyedIC::STORE_TRANSITION_SMI_TO_DOUBLE:
1556 return JSObject::GetElementsTransitionMap(receiver, FAST_DOUBLE_ELEMENTS);
1557 break;
1558 default:
1559 UNREACHABLE();
1560 return Handle<Map>::null();
1561 }
1603 } 1562 }
1604 1563
1605 1564
1606 MaybeObject* KeyedStoreIC::ComputePolymorphicStub( 1565 Handle<Code> KeyedStoreIC::GetElementStubWithoutMapCheck(
1607 MapList* receiver_maps, 1566 bool is_js_array,
1608 StrictModeFlag strict_mode) { 1567 ElementsKind elements_kind) {
1568 return KeyedStoreElementStub(is_js_array, elements_kind).GetCode();
1569 }
1570
1571
1572 Handle<Code> KeyedStoreIC::ComputePolymorphicStub(MapHandleList* receiver_maps,
1573 StrictModeFlag strict_mode) {
1609 // Collect MONOMORPHIC stubs for all target_receiver_maps. 1574 // Collect MONOMORPHIC stubs for all target_receiver_maps.
1610 CodeList handler_ics(receiver_maps->length()); 1575 CodeHandleList handler_ics(receiver_maps->length());
1611 MapList transitioned_maps(receiver_maps->length()); 1576 MapHandleList transitioned_maps(receiver_maps->length());
1612 for (int i = 0; i < receiver_maps->length(); ++i) { 1577 for (int i = 0; i < receiver_maps->length(); ++i) {
1613 Map* receiver_map(receiver_maps->at(i)); 1578 Handle<Map> receiver_map(receiver_maps->at(i));
1614 MaybeObject* maybe_cached_stub = NULL; 1579 Handle<Code> cached_stub;
1615 Map* transitioned_map = receiver_map->FindTransitionedMap(receiver_maps); 1580 Handle<Map> transitioned_map =
1616 if (transitioned_map != NULL) { 1581 receiver_map->FindTransitionedMap(receiver_maps);
1617 maybe_cached_stub = ElementsTransitionAndStoreStub( 1582 if (!transitioned_map.is_null()) {
1583 cached_stub = ElementsTransitionAndStoreStub(
1618 receiver_map->elements_kind(), // original elements_kind 1584 receiver_map->elements_kind(), // original elements_kind
1619 transitioned_map->elements_kind(), 1585 transitioned_map->elements_kind(),
1620 receiver_map->instance_type() == JS_ARRAY_TYPE, // is_js_array 1586 receiver_map->instance_type() == JS_ARRAY_TYPE, // is_js_array
1621 strict_mode).TryGetCode(); 1587 strict_mode).GetCode();
1622 } else { 1588 } else {
1623 maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck( 1589 cached_stub = ComputeMonomorphicStubWithoutMapCheck(receiver_map,
1624 receiver_map, strict_mode); 1590 strict_mode);
1625 } 1591 }
1626 Code* cached_stub; 1592 ASSERT(!cached_stub.is_null());
1627 if (!maybe_cached_stub->To(&cached_stub)) return maybe_cached_stub;
1628 handler_ics.Add(cached_stub); 1593 handler_ics.Add(cached_stub);
1629 transitioned_maps.Add(transitioned_map); 1594 transitioned_maps.Add(transitioned_map);
1630 } 1595 }
1631 Object* object;
1632 HandleScope scope(isolate());
1633 KeyedStoreStubCompiler compiler(isolate(), strict_mode); 1596 KeyedStoreStubCompiler compiler(isolate(), strict_mode);
1634 MaybeObject* maybe_code = compiler.CompileStorePolymorphic( 1597 Handle<Code> code = compiler.CompileStorePolymorphic(
1635 receiver_maps, &handler_ics, &transitioned_maps); 1598 receiver_maps, &handler_ics, &transitioned_maps);
1636 if (!maybe_code->ToObject(&object)) return maybe_code;
1637 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); 1599 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment();
1638 PROFILE(isolate(), CodeCreateEvent( 1600 PROFILE(isolate(),
1639 Logger::KEYED_STORE_MEGAMORPHIC_IC_TAG, 1601 CodeCreateEvent(Logger::KEYED_STORE_MEGAMORPHIC_IC_TAG, *code, 0));
1640 Code::cast(object), 0)); 1602 return code;
1641 return object;
1642 } 1603 }
1643 1604
1644 1605
1645 MaybeObject* KeyedStoreIC::Store(State state, 1606 MaybeObject* KeyedStoreIC::Store(State state,
1646 StrictModeFlag strict_mode, 1607 StrictModeFlag strict_mode,
1647 Handle<Object> object, 1608 Handle<Object> object,
1648 Handle<Object> key, 1609 Handle<Object> key,
1649 Handle<Object> value, 1610 Handle<Object> value,
1650 bool force_generic) { 1611 bool force_generic) {
1651 if (key->IsSymbol()) { 1612 if (key->IsSymbol()) {
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 #undef ADDR 2371 #undef ADDR
2411 }; 2372 };
2412 2373
2413 2374
2414 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2375 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2415 return IC_utilities[id]; 2376 return IC_utilities[id];
2416 } 2377 }
2417 2378
2418 2379
2419 } } // namespace v8::internal 2380 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/list.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698