| 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/field-type.h" | 7 #include "src/field-type.h" |
| 8 #include "src/ic/call-optimization.h" | 8 #include "src/ic/call-optimization.h" |
| 9 #include "src/ic/handler-configuration-inl.h" | 9 #include "src/ic/handler-configuration-inl.h" |
| 10 #include "src/ic/ic-inl.h" | 10 #include "src/ic/ic-inl.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 #define __ ACCESS_MASM(masm()) | 91 #define __ ACCESS_MASM(masm()) |
| 92 | 92 |
| 93 | 93 |
| 94 Register NamedLoadHandlerCompiler::FrontendHeader(Register object_reg, | 94 Register NamedLoadHandlerCompiler::FrontendHeader(Register object_reg, |
| 95 Handle<Name> name, | 95 Handle<Name> name, |
| 96 Label* miss, | 96 Label* miss, |
| 97 ReturnHolder return_what) { | 97 ReturnHolder return_what) { |
| 98 PrototypeCheckType check_type = SKIP_RECEIVER; | |
| 99 int function_index = map()->IsPrimitiveMap() | |
| 100 ? map()->GetConstructorFunctionIndex() | |
| 101 : Map::kNoConstructorFunctionIndex; | |
| 102 if (function_index != Map::kNoConstructorFunctionIndex) { | |
| 103 GenerateDirectLoadGlobalFunctionPrototype(masm(), function_index, | |
| 104 scratch1(), miss); | |
| 105 Object* function = isolate()->native_context()->get(function_index); | |
| 106 Object* prototype = JSFunction::cast(function)->instance_prototype(); | |
| 107 Handle<Map> map(JSObject::cast(prototype)->map()); | |
| 108 set_map(map); | |
| 109 object_reg = scratch1(); | |
| 110 check_type = CHECK_ALL_MAPS; | |
| 111 } | |
| 112 | |
| 113 // Check that the maps starting from the prototype haven't changed. | 98 // Check that the maps starting from the prototype haven't changed. |
| 114 return CheckPrototypes(object_reg, scratch1(), scratch2(), scratch3(), name, | 99 return CheckPrototypes(object_reg, scratch1(), scratch2(), scratch3(), name, |
| 115 miss, check_type, return_what); | 100 miss, return_what); |
| 116 } | 101 } |
| 117 | 102 |
| 118 | 103 |
| 119 // Frontend for store uses the name register. It has to be restored before a | 104 // Frontend for store uses the name register. It has to be restored before a |
| 120 // miss. | 105 // miss. |
| 121 Register NamedStoreHandlerCompiler::FrontendHeader(Register object_reg, | 106 Register NamedStoreHandlerCompiler::FrontendHeader(Register object_reg, |
| 122 Handle<Name> name, | 107 Handle<Name> name, |
| 123 Label* miss, | 108 Label* miss, |
| 124 ReturnHolder return_what) { | 109 ReturnHolder return_what) { |
| 125 return CheckPrototypes(object_reg, this->name(), scratch1(), scratch2(), name, | 110 return CheckPrototypes(object_reg, this->name(), scratch1(), scratch2(), name, |
| 126 miss, SKIP_RECEIVER, return_what); | 111 miss, return_what); |
| 127 } | 112 } |
| 128 | 113 |
| 129 | 114 |
| 130 Register PropertyHandlerCompiler::Frontend(Handle<Name> name) { | 115 Register PropertyHandlerCompiler::Frontend(Handle<Name> name) { |
| 131 Label miss; | 116 Label miss; |
| 132 if (IC::ShouldPushPopSlotAndVector(kind())) { | 117 if (IC::ShouldPushPopSlotAndVector(kind())) { |
| 133 PushVectorAndSlot(); | 118 PushVectorAndSlot(); |
| 134 } | 119 } |
| 135 Register reg = FrontendHeader(receiver(), name, &miss, RETURN_HOLDER); | 120 Register reg = FrontendHeader(receiver(), name, &miss, RETURN_HOLDER); |
| 136 FrontendFooter(name, &miss); | 121 FrontendFooter(name, &miss); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 } | 644 } |
| 660 | 645 |
| 661 void ElementHandlerCompiler::CompileElementHandlers( | 646 void ElementHandlerCompiler::CompileElementHandlers( |
| 662 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { | 647 MapHandleList* receiver_maps, List<Handle<Object>>* handlers) { |
| 663 for (int i = 0; i < receiver_maps->length(); ++i) { | 648 for (int i = 0; i < receiver_maps->length(); ++i) { |
| 664 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); | 649 handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate())); |
| 665 } | 650 } |
| 666 } | 651 } |
| 667 } // namespace internal | 652 } // namespace internal |
| 668 } // namespace v8 | 653 } // namespace v8 |
| OLD | NEW |