OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/builtins.h" | 12 #include "src/builtins.h" |
13 #include "src/cpu-profiler.h" | 13 #include "src/cpu-profiler.h" |
14 #include "src/gdb-jit.h" | 14 #include "src/gdb-jit.h" |
15 #include "src/heap/mark-compact.h" | 15 #include "src/heap/mark-compact.h" |
16 #include "src/heap-profiler.h" | 16 #include "src/heap-profiler.h" |
17 #include "src/ic/handler-compiler.h" | 17 #include "src/ic/handler-compiler.h" |
18 #include "src/ic/ic.h" | 18 #include "src/ic/ic.h" |
| 19 #include "src/messages.h" |
19 #include "src/prototype.h" | 20 #include "src/prototype.h" |
20 #include "src/vm-state-inl.h" | 21 #include "src/vm-state-inl.h" |
21 | 22 |
22 namespace v8 { | 23 namespace v8 { |
23 namespace internal { | 24 namespace internal { |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 // Arguments object passed to C++ builtins. | 28 // Arguments object passed to C++ builtins. |
28 template <BuiltinExtraArguments extra_args> | 29 template <BuiltinExtraArguments extra_args> |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 } | 1020 } |
1020 | 1021 |
1021 | 1022 |
1022 // ----------------------------------------------------------------------------- | 1023 // ----------------------------------------------------------------------------- |
1023 // Throwers for restricted function properties and strict arguments object | 1024 // Throwers for restricted function properties and strict arguments object |
1024 // properties | 1025 // properties |
1025 | 1026 |
1026 | 1027 |
1027 BUILTIN(RestrictedFunctionPropertiesThrower) { | 1028 BUILTIN(RestrictedFunctionPropertiesThrower) { |
1028 HandleScope scope(isolate); | 1029 HandleScope scope(isolate); |
1029 THROW_NEW_ERROR_RETURN_FAILURE(isolate, | 1030 THROW_NEW_ERROR_RETURN_FAILURE( |
1030 NewTypeError("restricted_function_properties", | 1031 isolate, NewTypeError(MessageTemplate::kRestrictedFunctionProperties)); |
1031 HandleVector<Object>(NULL, 0))); | |
1032 } | 1032 } |
1033 | 1033 |
1034 | 1034 |
1035 BUILTIN(RestrictedStrictArgumentsPropertiesThrower) { | 1035 BUILTIN(RestrictedStrictArgumentsPropertiesThrower) { |
1036 HandleScope scope(isolate); | 1036 HandleScope scope(isolate); |
1037 THROW_NEW_ERROR_RETURN_FAILURE( | 1037 THROW_NEW_ERROR_RETURN_FAILURE( |
1038 isolate, | 1038 isolate, NewTypeError(MessageTemplate::kStrictPoisonPill)); |
1039 NewTypeError("strict_poison_pill", HandleVector<Object>(NULL, 0))); | |
1040 } | 1039 } |
1041 | 1040 |
1042 | 1041 |
1043 // ----------------------------------------------------------------------------- | 1042 // ----------------------------------------------------------------------------- |
1044 // | 1043 // |
1045 | 1044 |
1046 | 1045 |
1047 template <bool is_construct> | 1046 template <bool is_construct> |
1048 MUST_USE_RESULT static MaybeHandle<Object> HandleApiCallHelper( | 1047 MUST_USE_RESULT static MaybeHandle<Object> HandleApiCallHelper( |
1049 Isolate* isolate, BuiltinArguments<NEEDS_CALLED_FUNCTION>& args) { | 1048 Isolate* isolate, BuiltinArguments<NEEDS_CALLED_FUNCTION>& args) { |
(...skipping 23 matching lines...) Expand all Loading... |
1073 isolate->ReportFailedAccessCheck(js_receiver); | 1072 isolate->ReportFailedAccessCheck(js_receiver); |
1074 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 1073 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
1075 } | 1074 } |
1076 } | 1075 } |
1077 } | 1076 } |
1078 | 1077 |
1079 Object* raw_holder = fun_data->GetCompatibleReceiver(isolate, args[0]); | 1078 Object* raw_holder = fun_data->GetCompatibleReceiver(isolate, args[0]); |
1080 | 1079 |
1081 if (raw_holder->IsNull()) { | 1080 if (raw_holder->IsNull()) { |
1082 // This function cannot be called with the given receiver. Abort! | 1081 // This function cannot be called with the given receiver. Abort! |
1083 THROW_NEW_ERROR( | 1082 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIllegalInvocation), |
1084 isolate, NewTypeError("illegal_invocation", HandleVector(&function, 1)), | 1083 Object); |
1085 Object); | |
1086 } | 1084 } |
1087 | 1085 |
1088 Object* raw_call_data = fun_data->call_code(); | 1086 Object* raw_call_data = fun_data->call_code(); |
1089 if (!raw_call_data->IsUndefined()) { | 1087 if (!raw_call_data->IsUndefined()) { |
1090 // TODO(ishell): remove this debugging code. | 1088 // TODO(ishell): remove this debugging code. |
1091 CHECK(raw_call_data->IsCallHandlerInfo()); | 1089 CHECK(raw_call_data->IsCallHandlerInfo()); |
1092 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1090 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); |
1093 Object* callback_obj = call_data->callback(); | 1091 Object* callback_obj = call_data->callback(); |
1094 v8::FunctionCallback callback = | 1092 v8::FunctionCallback callback = |
1095 v8::ToCData<v8::FunctionCallback>(callback_obj); | 1093 v8::ToCData<v8::FunctionCallback>(callback_obj); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 } | 1670 } |
1673 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1671 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1674 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1672 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1675 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1673 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1676 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1674 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1677 #undef DEFINE_BUILTIN_ACCESSOR_C | 1675 #undef DEFINE_BUILTIN_ACCESSOR_C |
1678 #undef DEFINE_BUILTIN_ACCESSOR_A | 1676 #undef DEFINE_BUILTIN_ACCESSOR_A |
1679 | 1677 |
1680 | 1678 |
1681 } } // namespace v8::internal | 1679 } } // namespace v8::internal |
OLD | NEW |