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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 expected_arguments, scratch2()); | 420 expected_arguments, scratch2()); |
421 return GetCode(kind(), Code::FAST, name); | 421 return GetCode(kind(), Code::FAST, name); |
422 } | 422 } |
423 | 423 |
424 | 424 |
425 // TODO(verwaest): Cleanup. holder() is actually the receiver. | 425 // TODO(verwaest): Cleanup. holder() is actually the receiver. |
426 Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( | 426 Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( |
427 Handle<Map> transition, Handle<Name> name) { | 427 Handle<Map> transition, Handle<Name> name) { |
428 Label miss; | 428 Label miss; |
429 | 429 |
430 if (FLAG_vector_stores) PushVectorAndSlot(); | 430 PushVectorAndSlot(); |
431 | 431 |
432 // Check that we are allowed to write this. | 432 // Check that we are allowed to write this. |
433 bool is_nonexistent = holder()->map() == transition->GetBackPointer(); | 433 bool is_nonexistent = holder()->map() == transition->GetBackPointer(); |
434 if (is_nonexistent) { | 434 if (is_nonexistent) { |
435 // Find the top object. | 435 // Find the top object. |
436 Handle<JSObject> last; | 436 Handle<JSObject> last; |
437 PrototypeIterator::WhereToEnd end = | 437 PrototypeIterator::WhereToEnd end = |
438 name->IsPrivate() ? PrototypeIterator::END_AT_NON_HIDDEN | 438 name->IsPrivate() ? PrototypeIterator::END_AT_NON_HIDDEN |
439 : PrototypeIterator::END_AT_NULL; | 439 : PrototypeIterator::END_AT_NULL; |
440 PrototypeIterator iter(isolate(), holder()); | 440 PrototypeIterator iter(isolate(), holder()); |
(...skipping 23 matching lines...) Expand all Loading... |
464 | 464 |
465 if (details.type() == DATA_CONSTANT) { | 465 if (details.type() == DATA_CONSTANT) { |
466 DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); | 466 DCHECK(descriptors->GetValue(descriptor)->IsJSFunction()); |
467 Register tmp = | 467 Register tmp = |
468 virtual_args ? VectorStoreICDescriptor::VectorRegister() : map_reg; | 468 virtual_args ? VectorStoreICDescriptor::VectorRegister() : map_reg; |
469 GenerateRestoreMap(transition, tmp, scratch2(), &miss); | 469 GenerateRestoreMap(transition, tmp, scratch2(), &miss); |
470 GenerateConstantCheck(tmp, descriptor, value(), scratch2(), &miss); | 470 GenerateConstantCheck(tmp, descriptor, value(), scratch2(), &miss); |
471 if (virtual_args) { | 471 if (virtual_args) { |
472 // This will move the map from tmp into map_reg. | 472 // This will move the map from tmp into map_reg. |
473 RearrangeVectorAndSlot(tmp, map_reg); | 473 RearrangeVectorAndSlot(tmp, map_reg); |
474 } else if (FLAG_vector_stores) { | 474 } else { |
475 PopVectorAndSlot(); | 475 PopVectorAndSlot(); |
476 } | 476 } |
477 GenerateRestoreName(name); | 477 GenerateRestoreName(name); |
478 StoreTransitionStub stub(isolate()); | 478 StoreTransitionStub stub(isolate()); |
479 GenerateTailCall(masm(), stub.GetCode()); | 479 GenerateTailCall(masm(), stub.GetCode()); |
480 | 480 |
481 } else { | 481 } else { |
482 if (representation.IsHeapObject()) { | 482 if (representation.IsHeapObject()) { |
483 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), | 483 GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), |
484 &miss); | 484 &miss); |
485 } | 485 } |
486 StoreTransitionStub::StoreMode store_mode = | 486 StoreTransitionStub::StoreMode store_mode = |
487 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 | 487 Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 |
488 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue | 488 ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue |
489 : StoreTransitionStub::StoreMapAndValue; | 489 : StoreTransitionStub::StoreMapAndValue; |
490 | 490 |
491 Register tmp = | 491 Register tmp = |
492 virtual_args ? VectorStoreICDescriptor::VectorRegister() : map_reg; | 492 virtual_args ? VectorStoreICDescriptor::VectorRegister() : map_reg; |
493 GenerateRestoreMap(transition, tmp, scratch2(), &miss); | 493 GenerateRestoreMap(transition, tmp, scratch2(), &miss); |
494 if (virtual_args) { | 494 if (virtual_args) { |
495 RearrangeVectorAndSlot(tmp, map_reg); | 495 RearrangeVectorAndSlot(tmp, map_reg); |
496 } else if (FLAG_vector_stores) { | 496 } else { |
497 PopVectorAndSlot(); | 497 PopVectorAndSlot(); |
498 } | 498 } |
499 GenerateRestoreName(name); | 499 GenerateRestoreName(name); |
500 StoreTransitionStub stub(isolate(), | 500 StoreTransitionStub stub(isolate(), |
501 FieldIndex::ForDescriptor(*transition, descriptor), | 501 FieldIndex::ForDescriptor(*transition, descriptor), |
502 representation, store_mode); | 502 representation, store_mode); |
503 GenerateTailCall(masm(), stub.GetCode()); | 503 GenerateTailCall(masm(), stub.GetCode()); |
504 } | 504 } |
505 | 505 |
506 GenerateRestoreName(&miss, name); | 506 GenerateRestoreName(&miss, name); |
507 if (FLAG_vector_stores) PopVectorAndSlot(); | 507 PopVectorAndSlot(); |
508 TailCallBuiltin(masm(), MissBuiltin(kind())); | 508 TailCallBuiltin(masm(), MissBuiltin(kind())); |
509 | 509 |
510 return GetCode(kind(), Code::FAST, name); | 510 return GetCode(kind(), Code::FAST, name); |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 bool NamedStoreHandlerCompiler::RequiresFieldTypeChecks( | 514 bool NamedStoreHandlerCompiler::RequiresFieldTypeChecks( |
515 HeapType* field_type) const { | 515 HeapType* field_type) const { |
516 return !field_type->Classes().Done(); | 516 return !field_type->Classes().Done(); |
517 } | 517 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 : kNoExtraICState); | 605 : kNoExtraICState); |
606 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); | 606 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); |
607 } | 607 } |
608 } | 608 } |
609 | 609 |
610 handlers->Add(cached_stub); | 610 handlers->Add(cached_stub); |
611 } | 611 } |
612 } | 612 } |
613 } // namespace internal | 613 } // namespace internal |
614 } // namespace v8 | 614 } // namespace v8 |
OLD | NEW |