| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 state.set_external_callback(v8::ToCData<Address>(callback_obj)); | 1056 state.set_external_callback(v8::ToCData<Address>(callback_obj)); |
| 1057 #endif | 1057 #endif |
| 1058 value = callback(new_args); | 1058 value = callback(new_args); |
| 1059 } | 1059 } |
| 1060 if (value.IsEmpty()) { | 1060 if (value.IsEmpty()) { |
| 1061 result = heap->undefined_value(); | 1061 result = heap->undefined_value(); |
| 1062 } else { | 1062 } else { |
| 1063 result = *reinterpret_cast<Object**>(*value); | 1063 result = *reinterpret_cast<Object**>(*value); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 RETURN_IF_SCHEDULED_EXCEPTION(); | 1066 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1067 if (!is_construct || result->IsJSObject()) return result; | 1067 if (!is_construct || result->IsJSObject()) return result; |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 return *args.receiver(); | 1070 return *args.receiver(); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 | 1073 |
| 1074 BUILTIN(HandleApiCall) { | 1074 BUILTIN(HandleApiCall) { |
| 1075 return HandleApiCallHelper<false>(args, isolate); | 1075 return HandleApiCallHelper<false>(args, isolate); |
| 1076 } | 1076 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 CustomArguments custom(isolate); | 1119 CustomArguments custom(isolate); |
| 1120 v8::ImplementationUtilities::PrepareArgumentsData(custom.end(), | 1120 v8::ImplementationUtilities::PrepareArgumentsData(custom.end(), |
| 1121 *data, *function, *checked_holder); | 1121 *data, *function, *checked_holder); |
| 1122 | 1122 |
| 1123 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( | 1123 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( |
| 1124 custom.end(), | 1124 custom.end(), |
| 1125 &args[0] - 1, | 1125 &args[0] - 1, |
| 1126 args_length - 1, | 1126 args_length - 1, |
| 1127 is_construct); | 1127 is_construct); |
| 1128 | 1128 |
| 1129 HandleScope scope; | 1129 HandleScope scope(isolate); |
| 1130 Object* result; | 1130 Object* result; |
| 1131 v8::Handle<v8::Value> value; | 1131 v8::Handle<v8::Value> value; |
| 1132 { | 1132 { |
| 1133 // Leaving JavaScript. | 1133 // Leaving JavaScript. |
| 1134 VMState state(isolate, EXTERNAL); | 1134 VMState state(isolate, EXTERNAL); |
| 1135 #ifdef ENABLE_LOGGING_AND_PROFILING | 1135 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 1136 state.set_external_callback(v8::ToCData<Address>(callback_obj)); | 1136 state.set_external_callback(v8::ToCData<Address>(callback_obj)); |
| 1137 #endif | 1137 #endif |
| 1138 v8::InvocationCallback callback = | 1138 v8::InvocationCallback callback = |
| 1139 v8::ToCData<v8::InvocationCallback>(callback_obj); | 1139 v8::ToCData<v8::InvocationCallback>(callback_obj); |
| 1140 | 1140 |
| 1141 value = callback(new_args); | 1141 value = callback(new_args); |
| 1142 } | 1142 } |
| 1143 if (value.IsEmpty()) { | 1143 if (value.IsEmpty()) { |
| 1144 result = heap->undefined_value(); | 1144 result = heap->undefined_value(); |
| 1145 } else { | 1145 } else { |
| 1146 result = *reinterpret_cast<Object**>(*value); | 1146 result = *reinterpret_cast<Object**>(*value); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 RETURN_IF_SCHEDULED_EXCEPTION(); | 1149 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1150 return result; | 1150 return result; |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 | 1153 |
| 1154 // Helper function to handle calls to non-function objects created through the | 1154 // Helper function to handle calls to non-function objects created through the |
| 1155 // API. The object can be called as either a constructor (using new) or just as | 1155 // API. The object can be called as either a constructor (using new) or just as |
| 1156 // a function (without new). | 1156 // a function (without new). |
| 1157 MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor( | 1157 MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor( |
| 1158 Isolate* isolate, | 1158 Isolate* isolate, |
| 1159 bool is_construct_call, | 1159 bool is_construct_call, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 #endif | 1205 #endif |
| 1206 value = callback(new_args); | 1206 value = callback(new_args); |
| 1207 } | 1207 } |
| 1208 if (value.IsEmpty()) { | 1208 if (value.IsEmpty()) { |
| 1209 result = heap->undefined_value(); | 1209 result = heap->undefined_value(); |
| 1210 } else { | 1210 } else { |
| 1211 result = *reinterpret_cast<Object**>(*value); | 1211 result = *reinterpret_cast<Object**>(*value); |
| 1212 } | 1212 } |
| 1213 } | 1213 } |
| 1214 // Check for exceptions and return result. | 1214 // Check for exceptions and return result. |
| 1215 RETURN_IF_SCHEDULED_EXCEPTION(); | 1215 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1216 return result; | 1216 return result; |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 | 1219 |
| 1220 // Handle calls to non-function objects created through the API. This delegate | 1220 // Handle calls to non-function objects created through the API. This delegate |
| 1221 // function is used when the call is a normal function call. | 1221 // function is used when the call is a normal function call. |
| 1222 BUILTIN(HandleApiCallAsFunction) { | 1222 BUILTIN(HandleApiCallAsFunction) { |
| 1223 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); | 1223 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 Code* entry = Code::cast(builtins_[i]); | 1643 Code* entry = Code::cast(builtins_[i]); |
| 1644 if (entry->contains(pc)) { | 1644 if (entry->contains(pc)) { |
| 1645 return names_[i]; | 1645 return names_[i]; |
| 1646 } | 1646 } |
| 1647 } | 1647 } |
| 1648 } | 1648 } |
| 1649 return NULL; | 1649 return NULL; |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 } } // namespace v8::internal | 1652 } } // namespace v8::internal |
| OLD | NEW |