| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Handle<Name> name); | 105 Handle<Name> name); |
| 106 | 106 |
| 107 // Computes the right stub matching. Inserts the result in the | 107 // Computes the right stub matching. Inserts the result in the |
| 108 // cache before returning. This might compile a stub if needed. | 108 // cache before returning. This might compile a stub if needed. |
| 109 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, | 109 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, |
| 110 Handle<JSObject> object); | 110 Handle<JSObject> object); |
| 111 | 111 |
| 112 Handle<Code> ComputeLoadField(Handle<Name> name, | 112 Handle<Code> ComputeLoadField(Handle<Name> name, |
| 113 Handle<JSObject> object, | 113 Handle<JSObject> object, |
| 114 Handle<JSObject> holder, | 114 Handle<JSObject> holder, |
| 115 PropertyIndex field_index); | 115 PropertyIndex field_index, |
| 116 Representation representation); |
| 116 | 117 |
| 117 Handle<Code> ComputeLoadCallback(Handle<Name> name, | 118 Handle<Code> ComputeLoadCallback(Handle<Name> name, |
| 118 Handle<JSObject> object, | 119 Handle<JSObject> object, |
| 119 Handle<JSObject> holder, | 120 Handle<JSObject> holder, |
| 120 Handle<ExecutableAccessorInfo> callback); | 121 Handle<ExecutableAccessorInfo> callback); |
| 121 | 122 |
| 122 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, | 123 Handle<Code> ComputeLoadViaGetter(Handle<Name> name, |
| 123 Handle<JSObject> object, | 124 Handle<JSObject> object, |
| 124 Handle<JSObject> holder, | 125 Handle<JSObject> holder, |
| 125 Handle<JSFunction> getter); | 126 Handle<JSFunction> getter); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 140 Handle<JSObject> object, | 141 Handle<JSObject> object, |
| 141 Handle<GlobalObject> holder, | 142 Handle<GlobalObject> holder, |
| 142 Handle<JSGlobalPropertyCell> cell, | 143 Handle<JSGlobalPropertyCell> cell, |
| 143 bool is_dont_delete); | 144 bool is_dont_delete); |
| 144 | 145 |
| 145 // --- | 146 // --- |
| 146 | 147 |
| 147 Handle<Code> ComputeKeyedLoadField(Handle<Name> name, | 148 Handle<Code> ComputeKeyedLoadField(Handle<Name> name, |
| 148 Handle<JSObject> object, | 149 Handle<JSObject> object, |
| 149 Handle<JSObject> holder, | 150 Handle<JSObject> holder, |
| 150 PropertyIndex field_index); | 151 PropertyIndex field_index, |
| 152 Representation representation); |
| 151 | 153 |
| 152 Handle<Code> ComputeKeyedLoadCallback( | 154 Handle<Code> ComputeKeyedLoadCallback( |
| 153 Handle<Name> name, | 155 Handle<Name> name, |
| 154 Handle<JSObject> object, | 156 Handle<JSObject> object, |
| 155 Handle<JSObject> holder, | 157 Handle<JSObject> holder, |
| 156 Handle<ExecutableAccessorInfo> callback); | 158 Handle<ExecutableAccessorInfo> callback); |
| 157 | 159 |
| 158 Handle<Code> ComputeKeyedLoadConstant(Handle<Name> name, | 160 Handle<Code> ComputeKeyedLoadConstant(Handle<Name> name, |
| 159 Handle<JSObject> object, | 161 Handle<JSObject> object, |
| 160 Handle<JSObject> holder, | 162 Handle<JSObject> holder, |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 // where the generated code is not allowed to have references to | 501 // where the generated code is not allowed to have references to |
| 500 // objects from a context. | 502 // objects from a context. |
| 501 static void GenerateDirectLoadGlobalFunctionPrototype(MacroAssembler* masm, | 503 static void GenerateDirectLoadGlobalFunctionPrototype(MacroAssembler* masm, |
| 502 int index, | 504 int index, |
| 503 Register prototype, | 505 Register prototype, |
| 504 Label* miss); | 506 Label* miss); |
| 505 | 507 |
| 506 static void GenerateFastPropertyLoad(MacroAssembler* masm, | 508 static void GenerateFastPropertyLoad(MacroAssembler* masm, |
| 507 Register dst, | 509 Register dst, |
| 508 Register src, | 510 Register src, |
| 509 Handle<JSObject> holder, | 511 bool inobject, |
| 510 PropertyIndex index); | 512 int index, |
| 511 static void DoGenerateFastPropertyLoad(MacroAssembler* masm, | 513 Representation representation); |
| 512 Register dst, | |
| 513 Register src, | |
| 514 bool inobject, | |
| 515 int index); | |
| 516 | 514 |
| 517 static void GenerateLoadArrayLength(MacroAssembler* masm, | 515 static void GenerateLoadArrayLength(MacroAssembler* masm, |
| 518 Register receiver, | 516 Register receiver, |
| 519 Register scratch, | 517 Register scratch, |
| 520 Label* miss_label); | 518 Label* miss_label); |
| 521 | 519 |
| 522 static void GenerateLoadStringLength(MacroAssembler* masm, | 520 static void GenerateLoadStringLength(MacroAssembler* masm, |
| 523 Register receiver, | 521 Register receiver, |
| 524 Register scratch1, | 522 Register scratch1, |
| 525 Register scratch2, | 523 Register scratch2, |
| 526 Label* miss_label, | 524 Label* miss_label, |
| 527 bool support_wrappers); | 525 bool support_wrappers); |
| 528 | 526 |
| 529 static void GenerateLoadFunctionPrototype(MacroAssembler* masm, | 527 static void GenerateLoadFunctionPrototype(MacroAssembler* masm, |
| 530 Register receiver, | 528 Register receiver, |
| 531 Register scratch1, | 529 Register scratch1, |
| 532 Register scratch2, | 530 Register scratch2, |
| 533 Label* miss_label); | 531 Label* miss_label); |
| 534 | 532 |
| 535 void GenerateStoreTransition(MacroAssembler* masm, | 533 void GenerateStoreTransition(MacroAssembler* masm, |
| 536 Handle<JSObject> object, | 534 Handle<JSObject> object, |
| 537 LookupResult* lookup, | 535 LookupResult* lookup, |
| 538 Handle<Map> transition, | 536 Handle<Map> transition, |
| 539 Handle<Name> name, | 537 Handle<Name> name, |
| 540 Register receiver_reg, | 538 Register receiver_reg, |
| 541 Register name_reg, | 539 Register name_reg, |
| 542 Register value_reg, | 540 Register value_reg, |
| 543 Register scratch1, | 541 Register scratch1, |
| 544 Register scratch2, | 542 Register scratch2, |
| 543 Register scratch3, |
| 545 Label* miss_label, | 544 Label* miss_label, |
| 546 Label* miss_restore_name); | 545 Label* miss_restore_name, |
| 546 Label* slow); |
| 547 | 547 |
| 548 void GenerateStoreField(MacroAssembler* masm, | 548 void GenerateStoreField(MacroAssembler* masm, |
| 549 Handle<JSObject> object, | 549 Handle<JSObject> object, |
| 550 LookupResult* lookup, | 550 LookupResult* lookup, |
| 551 Register receiver_reg, | 551 Register receiver_reg, |
| 552 Register name_reg, | 552 Register name_reg, |
| 553 Register value_reg, | 553 Register value_reg, |
| 554 Register scratch1, | 554 Register scratch1, |
| 555 Register scratch2, | 555 Register scratch2, |
| 556 Label* miss_label); | 556 Label* miss_label); |
| 557 | 557 |
| 558 static Builtins::Name MissBuiltin(Code::Kind kind) { | 558 static Builtins::Name MissBuiltin(Code::Kind kind) { |
| 559 switch (kind) { | 559 switch (kind) { |
| 560 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; | 560 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
| 561 case Code::STORE_IC: return Builtins::kStoreIC_Miss; | 561 case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
| 562 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; | 562 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
| 563 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; | 563 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
| 564 default: UNREACHABLE(); | 564 default: UNREACHABLE(); |
| 565 } | 565 } |
| 566 return Builtins::kLoadIC_Miss; | 566 return Builtins::kLoadIC_Miss; |
| 567 } | 567 } |
| 568 static Builtins::Name SlowBuiltin(Code::Kind kind) { |
| 569 switch (kind) { |
| 570 case Code::STORE_IC: return Builtins::kStoreIC_Slow; |
| 571 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; |
| 572 default: UNREACHABLE(); |
| 573 } |
| 574 return Builtins::kStoreIC_Slow; |
| 575 } |
| 568 static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name); | 576 static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name); |
| 569 | 577 |
| 570 // Generates code that verifies that the property holder has not changed | 578 // Generates code that verifies that the property holder has not changed |
| 571 // (checking maps of objects in the prototype chain for fast and global | 579 // (checking maps of objects in the prototype chain for fast and global |
| 572 // objects or doing negative lookup for slow objects, ensures that the | 580 // objects or doing negative lookup for slow objects, ensures that the |
| 573 // property cells for global objects are still empty) and checks that the map | 581 // property cells for global objects are still empty) and checks that the map |
| 574 // of the holder has not changed. If necessary the function also generates | 582 // of the holder has not changed. If necessary the function also generates |
| 575 // code for security check in case of global object holders. Helps to make | 583 // code for security check in case of global object holders. Helps to make |
| 576 // sure that the current IC is still valid. | 584 // sure that the current IC is still valid. |
| 577 // | 585 // |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 644 |
| 637 class BaseLoadStubCompiler: public StubCompiler { | 645 class BaseLoadStubCompiler: public StubCompiler { |
| 638 public: | 646 public: |
| 639 BaseLoadStubCompiler(Isolate* isolate, Register* registers) | 647 BaseLoadStubCompiler(Isolate* isolate, Register* registers) |
| 640 : StubCompiler(isolate), registers_(registers) { } | 648 : StubCompiler(isolate), registers_(registers) { } |
| 641 virtual ~BaseLoadStubCompiler() { } | 649 virtual ~BaseLoadStubCompiler() { } |
| 642 | 650 |
| 643 Handle<Code> CompileLoadField(Handle<JSObject> object, | 651 Handle<Code> CompileLoadField(Handle<JSObject> object, |
| 644 Handle<JSObject> holder, | 652 Handle<JSObject> holder, |
| 645 Handle<Name> name, | 653 Handle<Name> name, |
| 646 PropertyIndex index); | 654 PropertyIndex index, |
| 655 Representation representation); |
| 647 | 656 |
| 648 Handle<Code> CompileLoadCallback(Handle<JSObject> object, | 657 Handle<Code> CompileLoadCallback(Handle<JSObject> object, |
| 649 Handle<JSObject> holder, | 658 Handle<JSObject> holder, |
| 650 Handle<Name> name, | 659 Handle<Name> name, |
| 651 Handle<ExecutableAccessorInfo> callback); | 660 Handle<ExecutableAccessorInfo> callback); |
| 652 | 661 |
| 653 Handle<Code> CompileLoadConstant(Handle<JSObject> object, | 662 Handle<Code> CompileLoadConstant(Handle<JSObject> object, |
| 654 Handle<JSObject> holder, | 663 Handle<JSObject> holder, |
| 655 Handle<Name> name, | 664 Handle<Name> name, |
| 656 Handle<JSFunction> value); | 665 Handle<JSFunction> value); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 Label* success, | 697 Label* success, |
| 689 Handle<ExecutableAccessorInfo> callback); | 698 Handle<ExecutableAccessorInfo> callback); |
| 690 void NonexistentHandlerFrontend(Handle<JSObject> object, | 699 void NonexistentHandlerFrontend(Handle<JSObject> object, |
| 691 Handle<JSObject> last, | 700 Handle<JSObject> last, |
| 692 Handle<Name> name, | 701 Handle<Name> name, |
| 693 Label* success, | 702 Label* success, |
| 694 Handle<GlobalObject> global); | 703 Handle<GlobalObject> global); |
| 695 | 704 |
| 696 void GenerateLoadField(Register reg, | 705 void GenerateLoadField(Register reg, |
| 697 Handle<JSObject> holder, | 706 Handle<JSObject> holder, |
| 698 PropertyIndex index); | 707 PropertyIndex field, |
| 708 Representation representation); |
| 699 void GenerateLoadConstant(Handle<JSFunction> value); | 709 void GenerateLoadConstant(Handle<JSFunction> value); |
| 700 void GenerateLoadCallback(Register reg, | 710 void GenerateLoadCallback(Register reg, |
| 701 Handle<ExecutableAccessorInfo> callback); | 711 Handle<ExecutableAccessorInfo> callback); |
| 702 void GenerateLoadInterceptor(Register holder_reg, | 712 void GenerateLoadInterceptor(Register holder_reg, |
| 703 Handle<JSObject> object, | 713 Handle<JSObject> object, |
| 704 Handle<JSObject> holder, | 714 Handle<JSObject> holder, |
| 705 LookupResult* lookup, | 715 LookupResult* lookup, |
| 706 Handle<Name> name); | 716 Handle<Name> name); |
| 707 void GenerateLoadPostInterceptor(Register reg, | 717 void GenerateLoadPostInterceptor(Register reg, |
| 708 Handle<JSObject> interceptor_holder, | 718 Handle<JSObject> interceptor_holder, |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 Handle<JSFunction> constant_function_; | 1124 Handle<JSFunction> constant_function_; |
| 1115 bool is_simple_api_call_; | 1125 bool is_simple_api_call_; |
| 1116 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1126 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1117 Handle<CallHandlerInfo> api_call_info_; | 1127 Handle<CallHandlerInfo> api_call_info_; |
| 1118 }; | 1128 }; |
| 1119 | 1129 |
| 1120 | 1130 |
| 1121 } } // namespace v8::internal | 1131 } } // namespace v8::internal |
| 1122 | 1132 |
| 1123 #endif // V8_STUB_CACHE_H_ | 1133 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |