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