| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
| 8 #include "src/ic/call-optimization.h" | 8 #include "src/ic/call-optimization.h" |
| 9 #include "src/ic/handler-compiler.h" | 9 #include "src/ic/handler-compiler.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 int descriptor = transition->LastAdded(); | 458 int descriptor = transition->LastAdded(); |
| 459 Handle<DescriptorArray> descriptors(transition->instance_descriptors()); | 459 Handle<DescriptorArray> descriptors(transition->instance_descriptors()); |
| 460 PropertyDetails details = descriptors->GetDetails(descriptor); | 460 PropertyDetails details = descriptors->GetDetails(descriptor); |
| 461 Representation representation = details.representation(); | 461 Representation representation = details.representation(); |
| 462 DCHECK(!representation.IsNone()); | 462 DCHECK(!representation.IsNone()); |
| 463 | 463 |
| 464 // Stub is never generated for objects that require access checks. | 464 // Stub is never generated for objects that require access checks. |
| 465 DCHECK(!transition->is_access_check_needed()); | 465 DCHECK(!transition->is_access_check_needed()); |
| 466 | 466 |
| 467 // Call to respective StoreTransitionStub. | 467 // Call to respective StoreTransitionStub. |
| 468 Register transition_map_reg = StoreTransitionDescriptor::MapRegister(); |
| 469 bool push_map_on_stack = transition_map_reg.is(no_reg); |
| 470 Register map_reg = push_map_on_stack ? scratch1() : transition_map_reg; |
| 471 |
| 468 if (details.type() == DATA_CONSTANT) { | 472 if (details.type() == DATA_CONSTANT) { |
| 469 GenerateRestoreMap(transition, scratch2(), &miss); | |
| 470 DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); | 473 DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); |
| 471 Register map_reg = StoreTransitionDescriptor::MapRegister(); | 474 GenerateRestoreMap(transition, map_reg, scratch2(), &miss); |
| 472 GenerateConstantCheck(map_reg, descriptor, value(), scratch2(), &miss); | 475 GenerateConstantCheck(map_reg, descriptor, value(), scratch2(), &miss); |
| 476 if (push_map_on_stack) { |
| 477 GeneratePushMap(map_reg, scratch2()); |
| 478 } |
| 473 GenerateRestoreName(name); | 479 GenerateRestoreName(name); |
| 474 StoreTransitionStub stub(isolate()); | 480 StoreTransitionStub stub(isolate()); |
| 475 GenerateTailCall(masm(), stub.GetCode()); | 481 GenerateTailCall(masm(), stub.GetCode()); |
| 476 | 482 |
| 477 } else { | 483 } else { |
| 478 if (representation.IsHeapObject()) { | 484 if (representation.IsHeapObject()) { |
| 479 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), | 485 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), |
| 480 &miss); | 486 &miss); |
| 481 } | 487 } |
| 482 StoreTransitionStub::StoreMode store_mode = | 488 StoreTransitionStub::StoreMode store_mode = |
| 483 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 | 489 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 |
| 484 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue | 490 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue |
| 485 : StoreTransitionStub::StoreMapAndValue; | 491 : StoreTransitionStub::StoreMapAndValue; |
| 486 | 492 |
| 487 GenerateRestoreMap(transition, scratch2(), &miss); | 493 GenerateRestoreMap(transition, map_reg, scratch2(), &miss); |
| 494 if (push_map_on_stack) { |
| 495 GeneratePushMap(map_reg, scratch2()); |
| 496 } |
| 488 GenerateRestoreName(name); | 497 GenerateRestoreName(name); |
| 489 StoreTransitionStub stub(isolate(), | 498 StoreTransitionStub stub(isolate(), |
| 490 FieldIndex::ForDescriptor(*transition, descriptor), | 499 FieldIndex::ForDescriptor(*transition, descriptor), |
| 491 representation, store_mode); | 500 representation, store_mode); |
| 492 GenerateTailCall(masm(), stub.GetCode()); | 501 GenerateTailCall(masm(), stub.GetCode()); |
| 493 } | 502 } |
| 494 | 503 |
| 495 GenerateRestoreName(&miss, name); | 504 GenerateRestoreName(&miss, name); |
| 496 TailCallBuiltin(masm(), MissBuiltin(kind())); | 505 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 497 | 506 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 : kNoExtraICState); | 588 : kNoExtraICState); |
| 580 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); | 589 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
| 581 } | 590 } |
| 582 } | 591 } |
| 583 | 592 |
| 584 handlers->Add(cached_stub); | 593 handlers->Add(cached_stub); |
| 585 } | 594 } |
| 586 } | 595 } |
| 587 } // namespace internal | 596 } // namespace internal |
| 588 } // namespace v8 | 597 } // namespace v8 |
| OLD | NEW |