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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 holder->LocalLookupRealNamedProperty(*name, lookup); | 1119 holder->LocalLookupRealNamedProperty(*name, lookup); |
1120 if (lookup->IsFound()) return; | 1120 if (lookup->IsFound()) return; |
1121 if (holder->GetPrototype()->IsNull()) return; | 1121 if (holder->GetPrototype()->IsNull()) return; |
1122 holder->GetPrototype()->Lookup(*name, lookup); | 1122 holder->GetPrototype()->Lookup(*name, lookup); |
1123 } | 1123 } |
1124 | 1124 |
1125 | 1125 |
1126 #define __ ACCESS_MASM(masm()) | 1126 #define __ ACCESS_MASM(masm()) |
1127 | 1127 |
1128 | 1128 |
1129 CallKind CallStubCompiler::call_kind() { | |
1130 return CallICBase::Contextual::decode(extra_state_) | |
1131 ? CALL_AS_FUNCTION | |
1132 : CALL_AS_METHOD; | |
1133 } | |
1134 | |
1135 | |
1129 void CallStubCompiler::HandlerFrontendFooter(Label* miss) { | 1136 void CallStubCompiler::HandlerFrontendFooter(Label* miss) { |
1130 __ bind(miss); | 1137 __ bind(miss); |
1131 GenerateMissBranch(); | 1138 GenerateMissBranch(); |
1132 } | 1139 } |
1133 | 1140 |
1134 | 1141 |
1142 void CallStubCompiler::GenerateCallFunction(Handle<Object> object, | |
Igor Sheludko
2013/11/28 13:06:08
What about name like GenerateTailCallFunction() or
Toon Verwaest
2013/11/28 15:24:09
Done.
| |
1143 Handle<JSFunction> function) { | |
1144 PatchGlobalProxy(object); | |
1145 ParameterCount expected(function); | |
1146 __ InvokeFunction(function, expected, arguments(), | |
1147 JUMP_FUNCTION, NullCallWrapper(), call_kind()); | |
1148 } | |
1149 | |
1150 | |
1151 void CallStubCompiler::GenerateCallFunction(Handle<Object> object, | |
Igor Sheludko
2013/11/28 13:06:08
Same suggestion about name as above.
Toon Verwaest
2013/11/28 15:24:09
Done.
| |
1152 Register actual_closure, | |
1153 Handle<JSFunction> function) { | |
1154 PatchGlobalProxy(object); | |
1155 ParameterCount expected(function); | |
1156 __ InvokeFunction(actual_closure, expected, arguments(), | |
1157 JUMP_FUNCTION, NullCallWrapper(), call_kind()); | |
1158 } | |
1159 | |
1160 | |
1161 Handle<Code> CallStubCompiler::CompileCallConstant( | |
1162 Handle<Object> object, | |
1163 Handle<JSObject> holder, | |
1164 Handle<Name> name, | |
1165 CheckType check, | |
1166 Handle<JSFunction> function) { | |
1167 if (HasCustomCallGenerator(function)) { | |
1168 Handle<Code> code = CompileCustomCall(object, holder, | |
1169 Handle<Cell>::null(), | |
1170 function, Handle<String>::cast(name), | |
1171 Code::FAST); | |
1172 // A null handle means bail out to the regular compiler code below. | |
1173 if (!code.is_null()) return code; | |
1174 } | |
1175 | |
1176 Label miss; | |
1177 HandlerFrontendHeader(object, holder, name, check, &miss); | |
1178 GenerateCallFunction(object, function); | |
1179 HandlerFrontendFooter(&miss); | |
1180 | |
1181 // Return the generated code. | |
1182 return GetCode(function); | |
1183 } | |
1184 | |
1185 | |
1135 Register LoadStubCompiler::HandlerFrontendHeader( | 1186 Register LoadStubCompiler::HandlerFrontendHeader( |
1136 Handle<Type> type, | 1187 Handle<Type> type, |
1137 Register object_reg, | 1188 Register object_reg, |
1138 Handle<JSObject> holder, | 1189 Handle<JSObject> holder, |
1139 Handle<Name> name, | 1190 Handle<Name> name, |
1140 Label* miss) { | 1191 Label* miss) { |
1141 PrototypeCheckType check_type = CHECK_ALL_MAPS; | 1192 PrototypeCheckType check_type = CHECK_ALL_MAPS; |
1142 int function_index = -1; | 1193 int function_index = -1; |
1143 if (type->Is(Type::String())) { | 1194 if (type->Is(Type::String())) { |
1144 function_index = Context::STRING_FUNCTION_INDEX; | 1195 function_index = Context::STRING_FUNCTION_INDEX; |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1839 Handle<FunctionTemplateInfo>( | 1890 Handle<FunctionTemplateInfo>( |
1840 FunctionTemplateInfo::cast(signature->receiver())); | 1891 FunctionTemplateInfo::cast(signature->receiver())); |
1841 } | 1892 } |
1842 } | 1893 } |
1843 | 1894 |
1844 is_simple_api_call_ = true; | 1895 is_simple_api_call_ = true; |
1845 } | 1896 } |
1846 | 1897 |
1847 | 1898 |
1848 } } // namespace v8::internal | 1899 } } // namespace v8::internal |
OLD | NEW |