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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 holder->LocalLookupRealNamedProperty(*name, lookup); | 1121 holder->LocalLookupRealNamedProperty(*name, lookup); |
1122 if (lookup->IsFound()) return; | 1122 if (lookup->IsFound()) return; |
1123 if (holder->GetPrototype()->IsNull()) return; | 1123 if (holder->GetPrototype()->IsNull()) return; |
1124 holder->GetPrototype()->Lookup(*name, lookup); | 1124 holder->GetPrototype()->Lookup(*name, lookup); |
1125 } | 1125 } |
1126 | 1126 |
1127 | 1127 |
1128 #define __ ACCESS_MASM(masm()) | 1128 #define __ ACCESS_MASM(masm()) |
1129 | 1129 |
1130 | 1130 |
1131 CallKind CallStubCompiler::call_kind() { | |
1132 return CallICBase::Contextual::decode(extra_state_) | |
1133 ? CALL_AS_FUNCTION | |
1134 : CALL_AS_METHOD; | |
1135 } | |
1136 | |
1137 | |
1138 void CallStubCompiler::HandlerFrontendFooter(Label* miss) { | 1131 void CallStubCompiler::HandlerFrontendFooter(Label* miss) { |
1139 __ bind(miss); | 1132 __ bind(miss); |
1140 GenerateMissBranch(); | 1133 GenerateMissBranch(); |
1141 } | 1134 } |
1142 | 1135 |
1143 | 1136 |
1144 void CallStubCompiler::GenerateJumpFunctionIgnoreReceiver( | |
1145 Handle<JSFunction> function) { | |
1146 ParameterCount expected(function); | |
1147 __ InvokeFunction(function, expected, arguments(), | |
1148 JUMP_FUNCTION, NullCallWrapper(), call_kind()); | |
1149 } | |
1150 | |
1151 | |
1152 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | |
1153 Handle<JSFunction> function) { | |
1154 PatchGlobalProxy(object); | |
1155 GenerateJumpFunctionIgnoreReceiver(function); | |
1156 } | |
1157 | |
1158 | |
1159 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | |
1160 Register actual_closure, | |
1161 Handle<JSFunction> function) { | |
1162 PatchGlobalProxy(object); | |
1163 ParameterCount expected(function); | |
1164 __ InvokeFunction(actual_closure, expected, arguments(), | |
1165 JUMP_FUNCTION, NullCallWrapper(), call_kind()); | |
1166 } | |
1167 | |
1168 | |
1169 Handle<Code> CallStubCompiler::CompileCallConstant( | |
1170 Handle<Object> object, | |
1171 Handle<JSObject> holder, | |
1172 Handle<Name> name, | |
1173 CheckType check, | |
1174 Handle<JSFunction> function) { | |
1175 if (HasCustomCallGenerator(function)) { | |
1176 Handle<Code> code = CompileCustomCall(object, holder, | |
1177 Handle<Cell>::null(), | |
1178 function, Handle<String>::cast(name), | |
1179 Code::FAST); | |
1180 // A null handle means bail out to the regular compiler code below. | |
1181 if (!code.is_null()) return code; | |
1182 } | |
1183 | |
1184 Label miss; | |
1185 HandlerFrontendHeader(object, holder, name, check, &miss); | |
1186 GenerateJumpFunction(object, function); | |
1187 HandlerFrontendFooter(&miss); | |
1188 | |
1189 // Return the generated code. | |
1190 return GetCode(function); | |
1191 } | |
1192 | |
1193 | |
1194 Register LoadStubCompiler::HandlerFrontendHeader( | 1137 Register LoadStubCompiler::HandlerFrontendHeader( |
1195 Handle<Type> type, | 1138 Handle<Type> type, |
1196 Register object_reg, | 1139 Register object_reg, |
1197 Handle<JSObject> holder, | 1140 Handle<JSObject> holder, |
1198 Handle<Name> name, | 1141 Handle<Name> name, |
1199 Label* miss) { | 1142 Label* miss) { |
1200 PrototypeCheckType check_type = CHECK_ALL_MAPS; | 1143 PrototypeCheckType check_type = CHECK_ALL_MAPS; |
1201 int function_index = -1; | 1144 int function_index = -1; |
1202 if (type->Is(Type::String())) { | 1145 if (type->Is(Type::String())) { |
1203 function_index = Context::STRING_FUNCTION_INDEX; | 1146 function_index = Context::STRING_FUNCTION_INDEX; |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 Handle<FunctionTemplateInfo>( | 1841 Handle<FunctionTemplateInfo>( |
1899 FunctionTemplateInfo::cast(signature->receiver())); | 1842 FunctionTemplateInfo::cast(signature->receiver())); |
1900 } | 1843 } |
1901 } | 1844 } |
1902 | 1845 |
1903 is_simple_api_call_ = true; | 1846 is_simple_api_call_ = true; |
1904 } | 1847 } |
1905 | 1848 |
1906 | 1849 |
1907 } } // namespace v8::internal | 1850 } } // namespace v8::internal |
OLD | NEW |