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 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 if (is_construct) { | 1166 if (is_construct) { |
1167 Handle<FunctionTemplateInfo> desc(fun_data, isolate); | 1167 Handle<FunctionTemplateInfo> desc(fun_data, isolate); |
1168 bool pending_exception = false; | 1168 bool pending_exception = false; |
1169 isolate->factory()->ConfigureInstance( | 1169 isolate->factory()->ConfigureInstance( |
1170 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); | 1170 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); |
1171 ASSERT(isolate->has_pending_exception() == pending_exception); | 1171 ASSERT(isolate->has_pending_exception() == pending_exception); |
1172 if (pending_exception) return Failure::Exception(); | 1172 if (pending_exception) return Failure::Exception(); |
1173 fun_data = *desc; | 1173 fun_data = *desc; |
1174 } | 1174 } |
1175 | 1175 |
| 1176 SharedFunctionInfo* shared = function->shared(); |
| 1177 if (shared->is_classic_mode() && !shared->native()) { |
| 1178 Object* recv = args[0]; |
| 1179 ASSERT(!recv->IsNull()); |
| 1180 if (recv->IsUndefined()) { |
| 1181 args[0] = function->context()->global_object()->global_receiver(); |
| 1182 } |
| 1183 } |
| 1184 |
1176 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); | 1185 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); |
1177 | 1186 |
1178 if (raw_holder->IsNull()) { | 1187 if (raw_holder->IsNull()) { |
1179 // This function cannot be called with the given receiver. Abort! | 1188 // This function cannot be called with the given receiver. Abort! |
1180 Handle<Object> obj = | 1189 Handle<Object> obj = |
1181 isolate->factory()->NewTypeError( | 1190 isolate->factory()->NewTypeError( |
1182 "illegal_invocation", HandleVector(&function, 1)); | 1191 "illegal_invocation", HandleVector(&function, 1)); |
1183 return isolate->Throw(*obj); | 1192 return isolate->Throw(*obj); |
1184 } | 1193 } |
1185 | 1194 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 } | 1739 } |
1731 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1740 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1732 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1741 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1733 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1742 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1734 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1743 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1735 #undef DEFINE_BUILTIN_ACCESSOR_C | 1744 #undef DEFINE_BUILTIN_ACCESSOR_C |
1736 #undef DEFINE_BUILTIN_ACCESSOR_A | 1745 #undef DEFINE_BUILTIN_ACCESSOR_A |
1737 | 1746 |
1738 | 1747 |
1739 } } // namespace v8::internal | 1748 } } // namespace v8::internal |
OLD | NEW |