| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/handler-compiler.h" | 5 #include "src/ic/handler-compiler.h" |
| 6 | 6 |
| 7 #include "src/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 #include "src/ic/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 int descriptor = transition->LastAdded(); | 449 int descriptor = transition->LastAdded(); |
| 450 Handle<DescriptorArray> descriptors(transition->instance_descriptors()); | 450 Handle<DescriptorArray> descriptors(transition->instance_descriptors()); |
| 451 PropertyDetails details = descriptors->GetDetails(descriptor); | 451 PropertyDetails details = descriptors->GetDetails(descriptor); |
| 452 Representation representation = details.representation(); | 452 Representation representation = details.representation(); |
| 453 DCHECK(!representation.IsNone()); | 453 DCHECK(!representation.IsNone()); |
| 454 | 454 |
| 455 // Stub is never generated for objects that require access checks. | 455 // Stub is never generated for objects that require access checks. |
| 456 DCHECK(!transition->is_access_check_needed()); | 456 DCHECK(!transition->is_access_check_needed()); |
| 457 | 457 |
| 458 // Call to respective StoreTransitionStub. | 458 // Call to respective StoreTransitionStub. |
| 459 Register transition_map_reg = StoreTransitionHelper::MapRegister(); | 459 bool virtual_args = StoreTransitionHelper::HasVirtualSlotArg(); |
| 460 bool stack_args = StoreTransitionHelper::UsesStackArgs(); | 460 Register map_reg = StoreTransitionHelper::MapRegister(); |
| 461 Register map_reg = stack_args ? scratch1() : transition_map_reg; | |
| 462 | 461 |
| 463 if (details.type() == DATA_CONSTANT) { | 462 if (details.type() == DATA_CONSTANT) { |
| 464 DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); | 463 DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); |
| 465 GenerateRestoreMap(transition, map_reg, scratch2(), &miss); | 464 Register tmp = |
| 466 GenerateConstantCheck(map_reg, descriptor, value(), scratch2(), &miss); | 465 virtual_args ? VectorStoreICDescriptor::VectorRegister() : map_reg; |
| 467 if (stack_args) { | 466 GenerateRestoreMap(transition, tmp, scratch2(), &miss); |
| 468 // Also pushes vector and slot. | 467 GenerateConstantCheck(tmp, descriptor, value(), scratch2(), &miss); |
| 469 GeneratePushMap(map_reg, scratch2()); | 468 if (virtual_args) { |
| 469 // This will move the map from tmp into map_reg. |
| 470 RearrangeVectorAndSlot(tmp, map_reg); |
| 470 } else if (FLAG_vector_stores) { | 471 } else if (FLAG_vector_stores) { |
| 471 PopVectorAndSlot(); | 472 PopVectorAndSlot(); |
| 472 } | 473 } |
| 473 GenerateRestoreName(name); | 474 GenerateRestoreName(name); |
| 474 StoreTransitionStub stub(isolate()); | 475 StoreTransitionStub stub(isolate()); |
| 475 GenerateTailCall(masm(), stub.GetCode()); | 476 GenerateTailCall(masm(), stub.GetCode()); |
| 476 | 477 |
| 477 } else { | 478 } else { |
| 478 if (representation.IsHeapObject()) { | 479 if (representation.IsHeapObject()) { |
| 479 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), | 480 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), |
| 480 &miss); | 481 &miss); |
| 481 } | 482 } |
| 482 StoreTransitionStub::StoreMode store_mode = | 483 StoreTransitionStub::StoreMode store_mode = |
| 483 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 | 484 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 |
| 484 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue | 485 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue |
| 485 : StoreTransitionStub::StoreMapAndValue; | 486 : StoreTransitionStub::StoreMapAndValue; |
| 486 | 487 |
| 487 GenerateRestoreMap(transition, map_reg, scratch2(), &miss); | 488 Register tmp = |
| 488 if (stack_args) { | 489 virtual_args ? VectorStoreICDescriptor::VectorRegister() : map_reg; |
| 489 // Also pushes vector and slot. | 490 GenerateRestoreMap(transition, tmp, scratch2(), &miss); |
| 490 GeneratePushMap(map_reg, scratch2()); | 491 if (virtual_args) { |
| 492 RearrangeVectorAndSlot(tmp, map_reg); |
| 491 } else if (FLAG_vector_stores) { | 493 } else if (FLAG_vector_stores) { |
| 492 PopVectorAndSlot(); | 494 PopVectorAndSlot(); |
| 493 } | 495 } |
| 494 GenerateRestoreName(name); | 496 GenerateRestoreName(name); |
| 495 StoreTransitionStub stub(isolate(), | 497 StoreTransitionStub stub(isolate(), |
| 496 FieldIndex::ForDescriptor(*transition, descriptor), | 498 FieldIndex::ForDescriptor(*transition, descriptor), |
| 497 representation, store_mode); | 499 representation, store_mode); |
| 498 GenerateTailCall(masm(), stub.GetCode()); | 500 GenerateTailCall(masm(), stub.GetCode()); |
| 499 } | 501 } |
| 500 | 502 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 : kNoExtraICState); | 602 : kNoExtraICState); |
| 601 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); | 603 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
| 602 } | 604 } |
| 603 } | 605 } |
| 604 | 606 |
| 605 handlers->Add(cached_stub); | 607 handlers->Add(cached_stub); |
| 606 } | 608 } |
| 607 } | 609 } |
| 608 } // namespace internal | 610 } // namespace internal |
| 609 } // namespace v8 | 611 } // namespace v8 |
| OLD | NEW |