| 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 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "api.h" | 30 #include "api.h" |
| 31 #include "arguments.h" | 31 #include "arguments.h" |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "builtins.h" | 33 #include "builtins.h" |
| 34 #include "ic-inl.h" | 34 #include "ic-inl.h" |
| 35 #include "vm-state-inl.h" |
| 35 | 36 |
| 36 namespace v8 { | 37 namespace v8 { |
| 37 namespace internal { | 38 namespace internal { |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 // Arguments object passed to C++ builtins. | 42 // Arguments object passed to C++ builtins. |
| 42 template <BuiltinExtraArguments extra_args> | 43 template <BuiltinExtraArguments extra_args> |
| 43 class BuiltinArguments : public Arguments { | 44 class BuiltinArguments : public Arguments { |
| 44 public: | 45 public: |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( | 1046 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( |
| 1046 custom.end(), | 1047 custom.end(), |
| 1047 &args[0] - 1, | 1048 &args[0] - 1, |
| 1048 args.length() - 1, | 1049 args.length() - 1, |
| 1049 is_construct); | 1050 is_construct); |
| 1050 | 1051 |
| 1051 v8::Handle<v8::Value> value; | 1052 v8::Handle<v8::Value> value; |
| 1052 { | 1053 { |
| 1053 // Leaving JavaScript. | 1054 // Leaving JavaScript. |
| 1054 VMState state(isolate, EXTERNAL); | 1055 VMState state(isolate, EXTERNAL); |
| 1055 #ifdef ENABLE_LOGGING_AND_PROFILING | 1056 ExternalCallbackScope call_scope(isolate, |
| 1056 state.set_external_callback(v8::ToCData<Address>(callback_obj)); | 1057 v8::ToCData<Address>(callback_obj)); |
| 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(isolate); | 1066 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1067 if (!is_construct || result->IsJSObject()) return result; | 1067 if (!is_construct || result->IsJSObject()) return result; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 #ifdef DEBUG | 1118 #ifdef DEBUG |
| 1119 VerifyTypeCheck(Utils::OpenHandle(*new_args.Holder()), | 1119 VerifyTypeCheck(Utils::OpenHandle(*new_args.Holder()), |
| 1120 Utils::OpenHandle(*new_args.Callee())); | 1120 Utils::OpenHandle(*new_args.Callee())); |
| 1121 #endif | 1121 #endif |
| 1122 HandleScope scope(isolate); | 1122 HandleScope scope(isolate); |
| 1123 Object* result; | 1123 Object* result; |
| 1124 v8::Handle<v8::Value> value; | 1124 v8::Handle<v8::Value> value; |
| 1125 { | 1125 { |
| 1126 // Leaving JavaScript. | 1126 // Leaving JavaScript. |
| 1127 VMState state(isolate, EXTERNAL); | 1127 VMState state(isolate, EXTERNAL); |
| 1128 #ifdef ENABLE_LOGGING_AND_PROFILING | 1128 ExternalCallbackScope call_scope(isolate, |
| 1129 state.set_external_callback(v8::ToCData<Address>(callback_obj)); | 1129 v8::ToCData<Address>(callback_obj)); |
| 1130 #endif | |
| 1131 v8::InvocationCallback callback = | 1130 v8::InvocationCallback callback = |
| 1132 v8::ToCData<v8::InvocationCallback>(callback_obj); | 1131 v8::ToCData<v8::InvocationCallback>(callback_obj); |
| 1133 | 1132 |
| 1134 value = callback(new_args); | 1133 value = callback(new_args); |
| 1135 } | 1134 } |
| 1136 if (value.IsEmpty()) { | 1135 if (value.IsEmpty()) { |
| 1137 result = heap->undefined_value(); | 1136 result = heap->undefined_value(); |
| 1138 } else { | 1137 } else { |
| 1139 result = *reinterpret_cast<Object**>(*value); | 1138 result = *reinterpret_cast<Object**>(*value); |
| 1140 } | 1139 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 call_data->data(), constructor, obj); | 1185 call_data->data(), constructor, obj); |
| 1187 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( | 1186 v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( |
| 1188 custom.end(), | 1187 custom.end(), |
| 1189 &args[0] - 1, | 1188 &args[0] - 1, |
| 1190 args.length() - 1, | 1189 args.length() - 1, |
| 1191 is_construct_call); | 1190 is_construct_call); |
| 1192 v8::Handle<v8::Value> value; | 1191 v8::Handle<v8::Value> value; |
| 1193 { | 1192 { |
| 1194 // Leaving JavaScript. | 1193 // Leaving JavaScript. |
| 1195 VMState state(isolate, EXTERNAL); | 1194 VMState state(isolate, EXTERNAL); |
| 1196 #ifdef ENABLE_LOGGING_AND_PROFILING | 1195 ExternalCallbackScope call_scope(isolate, |
| 1197 state.set_external_callback(v8::ToCData<Address>(callback_obj)); | 1196 v8::ToCData<Address>(callback_obj)); |
| 1198 #endif | |
| 1199 value = callback(new_args); | 1197 value = callback(new_args); |
| 1200 } | 1198 } |
| 1201 if (value.IsEmpty()) { | 1199 if (value.IsEmpty()) { |
| 1202 result = heap->undefined_value(); | 1200 result = heap->undefined_value(); |
| 1203 } else { | 1201 } else { |
| 1204 result = *reinterpret_cast<Object**>(*value); | 1202 result = *reinterpret_cast<Object**>(*value); |
| 1205 } | 1203 } |
| 1206 } | 1204 } |
| 1207 // Check for exceptions and return result. | 1205 // Check for exceptions and return result. |
| 1208 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1206 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) { | 1347 static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) { |
| 1350 StoreIC::GenerateMegamorphic(masm); | 1348 StoreIC::GenerateMegamorphic(masm); |
| 1351 } | 1349 } |
| 1352 | 1350 |
| 1353 | 1351 |
| 1354 static void Generate_StoreIC_ArrayLength(MacroAssembler* masm) { | 1352 static void Generate_StoreIC_ArrayLength(MacroAssembler* masm) { |
| 1355 StoreIC::GenerateArrayLength(masm); | 1353 StoreIC::GenerateArrayLength(masm); |
| 1356 } | 1354 } |
| 1357 | 1355 |
| 1358 | 1356 |
| 1357 static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) { |
| 1358 StoreIC::GenerateGlobalProxy(masm); |
| 1359 } |
| 1360 |
| 1361 |
| 1359 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) { | 1362 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) { |
| 1360 KeyedStoreIC::GenerateGeneric(masm); | 1363 KeyedStoreIC::GenerateGeneric(masm); |
| 1361 } | 1364 } |
| 1362 | 1365 |
| 1363 | 1366 |
| 1364 static void Generate_KeyedStoreIC_ExternalByteArray(MacroAssembler* masm) { | 1367 static void Generate_KeyedStoreIC_ExternalByteArray(MacroAssembler* masm) { |
| 1365 KeyedStoreIC::GenerateExternalArray(masm, kExternalByteArray); | 1368 KeyedStoreIC::GenerateExternalArray(masm, kExternalByteArray); |
| 1366 } | 1369 } |
| 1367 | 1370 |
| 1368 | 1371 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 for (int i = 0; i < builtin_count; i++) { | 1638 for (int i = 0; i < builtin_count; i++) { |
| 1636 Code* entry = Code::cast(builtins_[i]); | 1639 Code* entry = Code::cast(builtins_[i]); |
| 1637 if (entry->contains(pc)) { | 1640 if (entry->contains(pc)) { |
| 1638 return names_[i]; | 1641 return names_[i]; |
| 1639 } | 1642 } |
| 1640 } | 1643 } |
| 1641 } | 1644 } |
| 1642 return NULL; | 1645 return NULL; |
| 1643 } | 1646 } |
| 1644 | 1647 |
| 1648 |
| 1645 } } // namespace v8::internal | 1649 } } // namespace v8::internal |
| OLD | NEW |