Index: src/ic/accessor-assembler.cc |
diff --git a/src/ic/accessor-assembler.cc b/src/ic/accessor-assembler.cc |
index 1828d59e1ad52ddd78fd978bc586c52f937af4be..6508169558ede5760b14320ff3cbcefb9665f805 100644 |
--- a/src/ic/accessor-assembler.cc |
+++ b/src/ic/accessor-assembler.cc |
@@ -1877,6 +1877,20 @@ void AccessorAssembler::LoadIC_Uninitialized(const LoadICParameters* p) { |
LoadRoot(Heap::kpremonomorphic_symbolRootIndex), |
SKIP_WRITE_BARRIER, 0, SMI_PARAMETERS); |
+ { |
+ // Special case for Function.prototype load, because it's very common |
+ // for ICs that are only executed once (MyFunc.prototype.foo = ...). |
+ Label not_function_prototype(this); |
+ GotoIf(Word32NotEqual(instance_type, Int32Constant(JS_FUNCTION_TYPE)), |
+ ¬_function_prototype); |
+ GotoIfNot(IsPrototypeString(p->name), ¬_function_prototype); |
+ Node* bit_field = LoadMapBitField(receiver_map); |
+ GotoIf(IsSetWord32(bit_field, 1 << Map::kHasNonInstancePrototype), |
+ ¬_function_prototype); |
+ Return(LoadJSFunctionPrototype(receiver, &miss)); |
+ BIND(¬_function_prototype); |
+ } |
+ |
GenericPropertyLoad(receiver, receiver_map, instance_type, p->name, p, &miss, |
kDontUseStubCache); |