OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 if (probe->IsCode()) return Handle<Code>::cast(probe); | 680 if (probe->IsCode()) return Handle<Code>::cast(probe); |
681 | 681 |
682 StoreStubCompiler compiler(isolate_, strict_mode); | 682 StoreStubCompiler compiler(isolate_, strict_mode); |
683 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); | 683 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); |
684 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 684 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
685 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 685 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
686 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); | 686 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
687 return code; | 687 return code; |
688 } | 688 } |
689 | 689 |
| 690 Handle<Code> KeyedStoreStubCompiler::CompileStoreField(Handle<JSObject> object, |
| 691 int index, |
| 692 Handle<Map> transition, |
| 693 Handle<String> name) { |
| 694 CALL_HEAP_FUNCTION(isolate(), |
| 695 CompileStoreField(*object, index, |
| 696 (transition.is_null() |
| 697 ? NULL |
| 698 : *transition), |
| 699 *name), |
| 700 Code); |
| 701 } |
| 702 |
| 703 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name, |
| 704 Handle<JSObject> receiver, |
| 705 int field_index, |
| 706 Handle<Map> transition, |
| 707 StrictModeFlag strict_mode) { |
| 708 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION; |
| 709 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 710 Code::KEYED_STORE_IC, type, strict_mode); |
| 711 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
| 712 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 713 |
| 714 KeyedStoreStubCompiler compiler(isolate(), strict_mode); |
| 715 Handle<Code> code = |
| 716 compiler.CompileStoreField(receiver, field_index, transition, name); |
| 717 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); |
| 718 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); |
| 719 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
| 720 return code; |
| 721 } |
| 722 |
690 | 723 |
691 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, | |
692 JSObject* receiver, | |
693 int field_index, | |
694 Map* transition, | |
695 StrictModeFlag strict_mode) { | |
696 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | |
697 Code::Flags flags = Code::ComputeMonomorphicFlags( | |
698 Code::KEYED_STORE_IC, type, strict_mode); | |
699 Object* code = receiver->map()->FindInCodeCache(name, flags); | |
700 if (code->IsUndefined()) { | |
701 HandleScope scope(isolate()); | |
702 KeyedStoreStubCompiler compiler(isolate(), strict_mode); | |
703 { MaybeObject* maybe_code = | |
704 compiler.CompileStoreField(receiver, field_index, transition, name); | |
705 if (!maybe_code->ToObject(&code)) return maybe_code; | |
706 } | |
707 PROFILE(isolate(), | |
708 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, | |
709 Code::cast(code), name)); | |
710 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); | |
711 Object* result; | |
712 { MaybeObject* maybe_result = | |
713 receiver->UpdateMapCodeCache(name, Code::cast(code)); | |
714 if (!maybe_result->ToObject(&result)) return maybe_result; | |
715 } | |
716 } | |
717 return code; | |
718 } | |
719 | |
720 #define CALL_LOGGER_TAG(kind, type) \ | 724 #define CALL_LOGGER_TAG(kind, type) \ |
721 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) | 725 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) |
722 | 726 |
723 MaybeObject* StubCache::ComputeCallConstant(int argc, | 727 MaybeObject* StubCache::ComputeCallConstant(int argc, |
724 Code::Kind kind, | 728 Code::Kind kind, |
725 Code::ExtraICState extra_ic_state, | 729 Code::ExtraICState extra_ic_state, |
726 String* name, | 730 String* name, |
727 Object* object, | 731 Object* object, |
728 JSObject* holder, | 732 JSObject* holder, |
729 JSFunction* function) { | 733 JSFunction* function) { |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 expected_receiver_type_ = | 1935 expected_receiver_type_ = |
1932 FunctionTemplateInfo::cast(signature->receiver()); | 1936 FunctionTemplateInfo::cast(signature->receiver()); |
1933 } | 1937 } |
1934 } | 1938 } |
1935 | 1939 |
1936 is_simple_api_call_ = true; | 1940 is_simple_api_call_ = true; |
1937 } | 1941 } |
1938 | 1942 |
1939 | 1943 |
1940 } } // namespace v8::internal | 1944 } } // namespace v8::internal |
OLD | NEW |