OLD | NEW |
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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 void KeyedStoreICTrampolineTFStub::GenerateAssembly( | 471 void KeyedStoreICTrampolineTFStub::GenerateAssembly( |
472 CodeAssemblerState* state) const { | 472 CodeAssemblerState* state) const { |
473 AccessorAssembler::GenerateKeyedStoreICTrampolineTF(state, language_mode()); | 473 AccessorAssembler::GenerateKeyedStoreICTrampolineTF(state, language_mode()); |
474 } | 474 } |
475 | 475 |
476 void KeyedStoreICTFStub::GenerateAssembly( | 476 void KeyedStoreICTFStub::GenerateAssembly( |
477 compiler::CodeAssemblerState* state) const { | 477 compiler::CodeAssemblerState* state) const { |
478 AccessorAssembler::GenerateKeyedStoreICTF(state, language_mode()); | 478 AccessorAssembler::GenerateKeyedStoreICTF(state, language_mode()); |
479 } | 479 } |
480 | 480 |
481 void StoreMapStub::GenerateAssembly(compiler::CodeAssemblerState* state) const { | |
482 typedef compiler::Node Node; | |
483 CodeStubAssembler assembler(state); | |
484 | |
485 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | |
486 Node* map = assembler.Parameter(Descriptor::kMap); | |
487 Node* value = assembler.Parameter(Descriptor::kValue); | |
488 | |
489 assembler.StoreMap(receiver, map); | |
490 assembler.Return(value); | |
491 } | |
492 | |
493 void StoreTransitionStub::GenerateAssembly( | |
494 compiler::CodeAssemblerState* state) const { | |
495 typedef CodeStubAssembler::Label Label; | |
496 typedef compiler::Node Node; | |
497 CodeStubAssembler assembler(state); | |
498 | |
499 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | |
500 Node* name = assembler.Parameter(Descriptor::kName); | |
501 Node* offset = | |
502 assembler.SmiUntag(assembler.Parameter(Descriptor::kFieldOffset)); | |
503 Node* value = assembler.Parameter(Descriptor::kValue); | |
504 Node* map = assembler.Parameter(Descriptor::kMap); | |
505 Node* slot = assembler.Parameter(Descriptor::kSlot); | |
506 Node* vector = assembler.Parameter(Descriptor::kVector); | |
507 Node* context = assembler.Parameter(Descriptor::kContext); | |
508 | |
509 Label miss(&assembler); | |
510 | |
511 Representation representation = this->representation(); | |
512 assembler.Comment("StoreTransitionStub: is_inobject: %d: representation: %s", | |
513 is_inobject(), representation.Mnemonic()); | |
514 | |
515 Node* prepared_value = | |
516 assembler.PrepareValueForWrite(value, representation, &miss); | |
517 | |
518 if (store_mode() == StoreTransitionStub::ExtendStorageAndStoreMapAndValue) { | |
519 assembler.Comment("Extend storage"); | |
520 assembler.ExtendPropertiesBackingStore(receiver); | |
521 } else { | |
522 DCHECK(store_mode() == StoreTransitionStub::StoreMapAndValue); | |
523 } | |
524 | |
525 // Store the new value into the "extended" object. | |
526 assembler.Comment("Store value"); | |
527 assembler.StoreNamedField(receiver, offset, is_inobject(), representation, | |
528 prepared_value, true); | |
529 | |
530 // And finally update the map. | |
531 assembler.Comment("Store map"); | |
532 assembler.StoreMap(receiver, map); | |
533 assembler.Return(value); | |
534 | |
535 // Only store to tagged field never bails out. | |
536 if (!representation.IsTagged()) { | |
537 assembler.Bind(&miss); | |
538 { | |
539 assembler.Comment("Miss"); | |
540 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | |
541 vector, receiver, name); | |
542 } | |
543 } | |
544 } | |
545 | |
546 void ElementsTransitionAndStoreStub::GenerateAssembly( | 481 void ElementsTransitionAndStoreStub::GenerateAssembly( |
547 compiler::CodeAssemblerState* state) const { | 482 compiler::CodeAssemblerState* state) const { |
548 typedef CodeStubAssembler::Label Label; | 483 typedef CodeStubAssembler::Label Label; |
549 typedef compiler::Node Node; | 484 typedef compiler::Node Node; |
550 CodeStubAssembler assembler(state); | 485 CodeStubAssembler assembler(state); |
551 | 486 |
552 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | 487 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
553 Node* key = assembler.Parameter(Descriptor::kName); | 488 Node* key = assembler.Parameter(Descriptor::kName); |
554 Node* value = assembler.Parameter(Descriptor::kValue); | 489 Node* value = assembler.Parameter(Descriptor::kValue); |
555 Node* map = assembler.Parameter(Descriptor::kMap); | 490 Node* map = assembler.Parameter(Descriptor::kMap); |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 DCHECK(receiver_is_holder()); | 1827 DCHECK(receiver_is_holder()); |
1893 Node* holder = receiver; | 1828 Node* holder = receiver; |
1894 Node* map = assembler.LoadMap(receiver); | 1829 Node* map = assembler.LoadMap(receiver); |
1895 Node* descriptors = assembler.LoadMapDescriptors(map); | 1830 Node* descriptors = assembler.LoadMapDescriptors(map); |
1896 Node* callback = assembler.LoadFixedArrayElement( | 1831 Node* callback = assembler.LoadFixedArrayElement( |
1897 descriptors, DescriptorArray::ToValueIndex(index())); | 1832 descriptors, DescriptorArray::ToValueIndex(index())); |
1898 assembler.TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver, | 1833 assembler.TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver, |
1899 holder, callback); | 1834 holder, callback); |
1900 } | 1835 } |
1901 | 1836 |
1902 void StoreFieldStub::GenerateAssembly( | |
1903 compiler::CodeAssemblerState* state) const { | |
1904 typedef CodeStubAssembler::Label Label; | |
1905 typedef compiler::Node Node; | |
1906 CodeStubAssembler assembler(state); | |
1907 | |
1908 FieldIndex index = this->index(); | |
1909 Representation representation = this->representation(); | |
1910 | |
1911 assembler.Comment("StoreFieldStub: inobject=%d, offset=%d, rep=%s", | |
1912 index.is_inobject(), index.offset(), | |
1913 representation.Mnemonic()); | |
1914 | |
1915 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | |
1916 Node* name = assembler.Parameter(Descriptor::kName); | |
1917 Node* value = assembler.Parameter(Descriptor::kValue); | |
1918 Node* slot = assembler.Parameter(Descriptor::kSlot); | |
1919 Node* vector = assembler.Parameter(Descriptor::kVector); | |
1920 Node* context = assembler.Parameter(Descriptor::kContext); | |
1921 | |
1922 Label miss(&assembler); | |
1923 | |
1924 Node* prepared_value = | |
1925 assembler.PrepareValueForWrite(value, representation, &miss); | |
1926 assembler.StoreNamedField(receiver, index, representation, prepared_value, | |
1927 false); | |
1928 assembler.Return(value); | |
1929 | |
1930 // Only stores to tagged field can't bailout. | |
1931 if (!representation.IsTagged()) { | |
1932 assembler.Bind(&miss); | |
1933 { | |
1934 assembler.Comment("Miss"); | |
1935 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | |
1936 vector, receiver, name); | |
1937 } | |
1938 } | |
1939 } | |
1940 | |
1941 void StoreGlobalStub::GenerateAssembly( | 1837 void StoreGlobalStub::GenerateAssembly( |
1942 compiler::CodeAssemblerState* state) const { | 1838 compiler::CodeAssemblerState* state) const { |
1943 typedef CodeStubAssembler::Label Label; | 1839 typedef CodeStubAssembler::Label Label; |
1944 typedef compiler::Node Node; | 1840 typedef compiler::Node Node; |
1945 CodeStubAssembler assembler(state); | 1841 CodeStubAssembler assembler(state); |
1946 | 1842 |
1947 assembler.Comment( | 1843 assembler.Comment( |
1948 "StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d", | 1844 "StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d", |
1949 cell_type(), PropertyCellType::kConstantType == cell_type() | 1845 cell_type(), PropertyCellType::kConstantType == cell_type() |
1950 ? static_cast<int>(constant_type()) | 1846 ? static_cast<int>(constant_type()) |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 } | 3117 } |
3222 | 3118 |
3223 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 3119 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
3224 : PlatformCodeStub(isolate) {} | 3120 : PlatformCodeStub(isolate) {} |
3225 | 3121 |
3226 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 3122 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
3227 : PlatformCodeStub(isolate) {} | 3123 : PlatformCodeStub(isolate) {} |
3228 | 3124 |
3229 } // namespace internal | 3125 } // namespace internal |
3230 } // namespace v8 | 3126 } // namespace v8 |
OLD | NEW |